You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.
Jumping on the enemy hurts the player, not the enemy.
It seems the code assumes that on a collision, response.a will be the player and response.b will be the enemy. This is not always the case. Both the enemy and the player fire a collision response when calling me.collision.check(this), it seems the player fires one with response.a being itself and response.b being the enemy, and for the enemy it's the other way around.
Also, the enemy checks whether the player's falling flag is set, but it has been previously unset by the player's collision code, resulting in the enemy not being actually hurt.
The "platformer" example in the melonJS code seems to handle that better. Maybe the tutorial could take inspiration from that.
The text was updated successfully, but these errors were encountered:
Jumping on the enemy hurts the player, not the enemy.
It seems the code assumes that on a collision,
response.a
will be the player andresponse.b
will be the enemy. This is not always the case. Both the enemy and the player fire a collision response when callingme.collision.check(this)
, it seems the player fires one withresponse.a
being itself andresponse.b
being the enemy, and for the enemy it's the other way around.Also, the enemy checks whether the player's
falling
flag is set, but it has been previously unset by the player's collision code, resulting in the enemy not being actually hurt.The "platformer" example in the melonJS code seems to handle that better. Maybe the tutorial could take inspiration from that.
The text was updated successfully, but these errors were encountered: