Trying to make it so when enemies collide they transform into one larger enemy

Hey there!
For my game I’m trying to make it so when two enemies collide they turn into one, larger enemy.
What I have currently:


This works partially, except if one enemy that’s already been scaled up collides with one that hasn’t been, there’s no way of knowing how to delete the smaller one. Any ideas how to fix this problem?

You could give the enemy a object variable that changes based on it’s size. Then have an event where if two enemies collide and have difference variables, the one with the lower value gets deleted.

Are the enemies on the same horizontal level when colliding? You could also delete the enemy that has the higher Y value. Just a suggestion.

1 Like

How would I do that? There’s no way to choose an object but choosing all, choosing random, or nearest to a position.

They could collide anywhere and the larger one could be in any position, so I can’t.

I’d say try something like this:


Be aware though that it may do weird stuff if more than two instances collide on the same frame. Generally, interactions between two instances of the same object is not really supported by GDevelop, you’d need to use a secondary for a safer solution, though it’s be probably more complex than this.

3 Likes

Thanks! I’ll try this!