Hi @Esdeepee,
To create the explosion at the right point,
Center the creation explosion object at its center
Use the center point of the enemy to create the explosion object.
You need to place the Origin point values of the explosion object into the center of the object. So, when the explosion object is created it will be initiated from the center rather than from the top left. And change the creation location of the explosion by changing the actions (enemy.PointX(“Centre”) and enemy.PointY(“Centre”)).
I wish you are following this tutorial: Tank shooter - Beginner tutorial [GDevelop wiki]
I hope it helped you, If it doesn’t please let me know where I went wrong.
I’m not sure if this will help, but maybe try dragging the “Create object Explode” action to be ABOVE the “Delete object: Enemy” action?
I think the “Enemy” object is being destroyed before the explosion is created, so it doesn’t know where to create the explosion. ^^; I could be wrong, though.
I think what you’re doing is assuming the explosion animation starts in the centre and moves outwards. But the individual frames of the animation are all the same size, origin and centre, they just have more blank space around them. You need to start the animation from its origin point, which is top left.
If you look at the “Adding Explosions” part of the tutorial you’ll see the animation frames, the ones with checkerboard backgrounds. The size of the checkerboard is always the same, it’s the explosion graphic that gets “bigger”.
In the tutorial they don’t use “Center” it puts Center without quotes, maybe that’s the problem?? Another option is to center yourself the explosion using X and Y coordinates of enemy object.
enemy.X() and enemy.Y() witll give you the upper left pixel position on screen.