Explosion animation happens at wrong place

Hi,

I want after a ball collides with the balloon, an animation happens and the ball and the balloon to be removed.

The animation happens, but not exactly at the collision center.
I have defined that the explosion happens at the center of the ball.
You can see and test it below.

What is the problem?

thank,

Where do you want the explosion? You could assign each object their own explosion animation. All 3 could explode. Or you could use 1 large one.

The center point between the 2 objects would be the average of the Xs and Ys.

X equals (ball center X + balloon center X) / 2
Y equals (ball center Y + balloon center Y) / 2

If that’s not the issue the make sure all your points for each animation are centered.

I want the explosion occurs at the center of the ball.

I would check the points for the ball. Make sure they’re in the same place on each animation. Most of the time, I prefer to keep both points in the center of the object or the image.

https://wiki.gdevelop.io/gdevelop5/objects/sprite/edit-points/#edit-points

You can see the code below:

Did you move the Origin point of the explosion object to the middle? Otherwise, the top left corner of the explosion is placed on the center of the ball.

As you can see below it is.
Am I mistaken?

Looks okay, alternatively you can place it after creating.

But I recorded your example and watched frame by frame, it doesn’t really look like it appears in the wrong place.
Maybe you just need a custom collision mask for balloon and ball so that the collision doesn’t happen too early before there is a visible collision.
02

You can also use the Draw collisions hitboxes und Pause game execution action to see where it actually appears.

1 Like

Can you please explain more about this part?


https://wiki.gdevelop.io/gdevelop5/objects/sprite/collision-mask/

Thanks for your help.
I mixed Keith_1357 and Jack’s solutions.
Now it works.

1 Like