How do i make multiple tank instances?

Im attempting to make a top down tank game, but i cannot get the turrets to stay with individual copies of the body. they all just go to the first instance of the body. does anyone know how to fix this?

Hpbar = head
Enemies = tank

1 Like

It sounds like you are placing the turret at tank.X() and tank.Y() - or something along those lines - without using an event or condition to specify which tank. As a result, GDevelop will default to the first tank object placed on the scene.

What you’ll need to do, as shown by @ZeroX4, is repeat for each tank object but in a beginning of scene event, create a turret and place it on each tank within that repeat event.

However, instead of linking them, you could use the sticker behaviour on the turret and stick it to the tank. That way you don’t need to continuously move it in events. You can still rotate it, and if the tank rotates then the turret will retain its relative rotation to the tank.

1 Like

@MrMen i will try both of these things to confirm if they work, thank you!


this is the code that ended up working for me, thanks for yall’s help!