[SOLVED]How do I spawn object at the designated location?

Hi guys , i just re-open gdevelop. and since new update i try to redo the tutorial

yet somehow this section of tutorial has take 30 minutes of my time

basically the explosion wont spawn at the center of the object

The tank was on the black marker

can someone enlighten me please.

This is the point. Yes I already tried creating a new points, still the same.

this is the event

Hi @Esdeepee,
To create the explosion at the right point,

  1. Center the creation explosion object at its center
  2. 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.

@akbarhabeebb Hey, thanks for the reply.

I tried to update and redo everything from scratch in case it’s a bug or something yet it still not working.

here is the update :

and here is when it’s played :

Both point is already at the center of the object.

Yes, I am trying that tutorial, and somehow it’s not working. Did I miss something?

@MayhemCats Thanks for your reply

It’s possible, but as you can see above in this post. it’s still not working.
Can you see where I go wrong? it’ll be helpful.

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”.

of course! Thank you.
the origin point from the explosion is the one that being called.

Is there any other way to called the center position of the object automatically? instead of the origin points?

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.

1 Like