I’m trying to create a 2D platformer for the first time ever for me and I have this Slime Monster that I want the player to able to jump on to kill it… but if the Slime Monster walks in to the player, or vice versa, the player should die. You know, the behaviour from Mario, when he collides with a Goomba he dies, but if he jumps on it, the Goomba dies…
How can this be re-created?
You could try adding an empty gameobject parented to the monster. Then add a simple box collider to it which fits the top of the monster. Then add a script to detect collision?
I dont know how effective this would be or if it will work at all as its untested.
An alternative to try would be to simply check the Y coord of the player and if the player.y >= monsterPosition.y + someOffest than it hit the top of the monster.
2 Likes
This is how it’s done in Mario (and many other games). When there’s a collision, the higher (greater Y value) sprite wins.
2 Likes