Hello community, first excuse my English.
I’m starting with this, and I need to make a game platforms.
I need to do is that when hitting an enemy subtract the player score and push aside. But if the character jump over an enemy’s okay to destroy it (this is already done when I start a new project). Classic Mario game
In conclusion, you subtract points and push to one side when player collides with an enemy from the sides or bottom.
It is understood?
I guess that the conditions to check if the player is being hit are the opposite (NOT advanced condition) of the ones to check if the player jumps over the enemy. I mean, if you check if the player jumps over an enemy this way:
Conditions: Player is in collision with Enemy
OR (if is true any of):
Player.PointY(Bottom) < Enemy.PointY(Centre)
Player.Variable(invincibility) = 1
Actions: Delete object Enemy
Add +100 to variable Score
The conditions to check if the player is being hit could be:
Conditions: Player is in collision with Enemy
NOT (invert the logic result of):
OR (if is true any of):
Player.PointY(Bottom) < Enemy.PointY(Centre)
Player.Variable(invincibility) = 1
Actions: Do -1 to variable Lives
Do = 1 to variable Invincibility
To push the player, you can use a variable “Pushing”, if it’s 1 or -1 (depends on the push direction, a little time after being hit it becomes = 0 again), simulate pressing left or right
Another way would be using built-in forces, but it’s not recommended