Looking for 2D Platformer like Mario example

Merry Christmas!

I’ve recently been trying to create a 2D Platform game pretty much like Super Mario. I’m having difficulty with the movement and stomping on enemies so I’ve been looking for a good example project to learn from.

There are a few of 2D Platformers on the asset store but they all use guns to fight enemies and not all use the new 2D features of Unity.

Does anyone have or know of somewhere to find a good example project of something like Super Mario where you run around, jump on platforms and stomp on enemies? Preferably using the 2D Unity features. Cheers :slight_smile:

Google “2d mario tutorial” the first 3 links are unity. Dont know if the third one uses it. The first two dont since they are old but quite detailed and could prove some challenge in conversion.

Out of curiosity do you mean like in Super Mario Bros were you have to hold down the button to jump high?

Try the Learn page. it’s got a platformer with guns using unity’s new 2D features, by unity. If you can’t work out stomping, perhaps make a separate post focussed on how far you’ve got so far.

Early mario had a very simple logic: if velocity of mario is downward and he touches an enemy, the enemy dies. Later titles probably extend that to mario also being in the air.

There are some youtube videos about mario playing AIs that show that: the AIs learn to abuse that to kill enemies without actually jumping on the enemy.

1 Like

Wait, how can you velocity be downwards and you not be in the air? Maybe I’m missing something here. The only way I see it is on falling/moving platforms, in the case of you hitting the side of the enemy instead of the head. Is that what you are referring too?

The Other Brothers head stomp code simply checks if vel.y<0 and hit.y> half char height.
Basically, if it’s moving down and it collided above the enemy from halfway up then it’s a valid stomp. The reason for the halfway check is so that coming down, you won’t stomp something if you brush your face against it for example and its on a platform higher than you.

1 Like

Oh, man did I nuke this. I always thought there was a trigger that extended past the rigid body.

Same here, very easy to over complicate things.

1 Like

That sounds great thanks! So much simpler than what I was trying to do haha!

Later titles have parts where the ground is not flat. So you could be walking down a hill.

Thanks, I knew I was missing something, duh. I’ve played pretty much all of them up to the Gamecube so I should have known that.