-SOLVED-Weird animation duplication problem.

Ok, so I’ve been working on this game for a while now, and suddenly I found this problem I can’t seem to fix, whenever a bullet hits the tank, an explosion object is created, just like in the tutorial, but apparently , there’s another explosion being created that the “origin” of the game window, this usually happens when the thing has to spawn something but can’t find the location, now there’s only one event where the object bullet collides with tank, creating an explosion, if I remove the action that creates the explosion, the explosion is not created on the tank, but it’s still created on the corner of the screen, this has me baffled.
Any of you found this problem before?

If I remove the action to create the explosion object I get this:

I tripple checked the whole thing in order to make sure bullet doesn’t interact with tank at any other event and it doesn’t.


Ok so I found the problem, it recides on this event:

Basicly, this should make bullets explode when they’re further away than 500px from the enemy, but it looks like when a bullet is deleted, it tries to see if it’s further away than 500 and since it can’t find it, it assumes it’s far away and makes another explosion, since it can’t find the center of it because it was deleted, it generates another explosion at the corner. Any tips on how to achieve what I need without the bug?

Try using “centre” and not “center” and see if it helps…

uh, the point’s name is Center., and the animation spawns ok, it’s just that it spawns again on the corner at the same time.

It depends, ind GD5 the center point is actually “Center” and not “centre”.

I updated the first post with an update, I found the culprint event, but I’m clueless on how to fix it or how to achieve what I need without it.

That event is saying “If an Enemy is at a distance greater than 500 pixels from a Bullet >> Explode the Bullet”
No matter which enemy or how many of them, which bullet or how many of them, it will explode any bullet with an enemy (any one) at more than 500 pixels away.

If you want to explore bullets that are too far away from all the enemies I would do it like this:

[code]For each Bullet

Conditions: No conditions
Actions: Do = 0 to the variable "nearby_enemies"

Conditions: Enemy distance to Bullet is below 500 pixels
Actions: Do = Count(Enemy) to variable "nearby_enemies"

Conditions: Variable "nearby_enemies" is = 0
Actions: Explode Bullet[/code]

Some ideas:

  1. Add a “Destroy outside the screen” behavior to the bullet object.

  2. … or add a timer to each bullet in its creation and destroy that bullet when its timer reaches a certain amount of time.

I just removed the animation altogether from that event, works ok, I’ll try what you guys sugested at some point later. Thanks for everything!