How do I bind instances of one type to others? For example: there are 4 instances of enemies of the same type, 4 health bars of the same type. How do I link each health bar to my enemy ?So that each enemy has its own lane
Use Link to
When you create the health_bar use Link to Enemy, that way when you move the enemy and health_bar add Take into account Linked objects
health_bar is already placed on the stage, I’m not creating it
So you place 4 enemies and 4 health_bar in the level?
Is a good practice to use events to create enemies dynamically.
Repeat 4 times
Create enemy at x, y
Create health_bar at enemy.X(), enemie.Y()
Link health_bar to enemy
Then to reference all together
Change health_bar position to enemy.X(), enemy.Y()-10
Take into account linked
Of course this is pseudo you need to look at GD for the names of the actions.
??? Not if you want them at predetermined positions in the scene.
Remove the Health bars from the scene, and add them in the events, pretty much as @UlisesFreitas suggested, but without the create enemy at x,y. Use a Repeat for all [object type] event.