I have a player and an enemy object in my game.
Player is blue and enemy is orangish. So when I collide with enemy from side without touching the floor(left side of the image) then the enemy is killed but i want player object to take hit/damage without killing the enemy. Player object only gets hit when player is touching the floor and colliding with the enemy(right side of the image). I want my player object to get hit in both of the examples. And I should be able to kill enemy when i hit it from the top like Mario games.
Here is the code that i am using.
PLEASE ASK IF YOU WANT TO KNOW ANYTHING ABOUT THE GAME. E.G. PLAYER BEHAVIOURS.
Develop games in your browser. Powerful, performant & highly capable.
player on collision with enemy
---(sub event) player is falling
---(sub event) player y < enemy y ----- enemy destroy
else ---- player get hit