Godot Version
v4.6.1
Question
(Had no idea how to title this)
When making enemies with composition (for example, I have parts that control movement, projectiles, other specific stuff etc.), is there a way to make it slightly easier setting all the different exported variables for these? Like somehow passing the exported variables to the top node so that they are all in one place? Really basic non-functional example in image. I don't think I can just pass variables down as the components would change per enemy
I use composition in a similar way. However, instead of passing data up to the character class, I pass it down from the character to the components when the character instance is created.
I use a resource that defines the values that are common to all characters. I then create instances of that resource for each character in the game. I keep those in a separate class so I can modify all the character values from one location.
When an instance of a specific character is created, I read the associated values from the resource list and then pass them on to the relevant component.
1 Like