We have created a platformer with gravity, How can we code the game to kill the enemy when
mySprite jumps and lands on top of it?
( similar to original Mario)
1 Like
Using an overlap event you can check whenever a sprite of kind player overlaps any enemy sprite, inside of this event you need to check if the players sprite has a lower y value than the enemy’s using an if statement and within that statement destroy the enemy sprite.
Here is an example
I would also recommend checking that the player is moving down (Vy > 0) because otherwise you can bounce weird and stuff.
1 Like