Hi Penhoat,
The way the original Super Mario Bros. handled it actually had nothing to do with the head, and only depended on the player velocity. If Mario was falling when he touched an enemy, then that was a ‘stomp’, but if Mario was level or raising (jumping up) then it counted as a ‘bad touch’ and he lost a life or his superpower.
This is pretty easy to implement, just define the collision shape for your enemies, and in the collision response, look at the player’s Z velocity. If it is less than 0 then stomp the enemy, otherwise if it’s >= 0 then the hero is jumping or standing and should take damage.
Cheers,
Ha, Mickaek everywhere to bring help on 2D Developer , anyway as said you can based on Velocity simple, and Also check the Current X position of the Player depending on what you expect !