Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Faulty enemy collision #24

Open
cchartr opened this issue May 23, 2015 · 1 comment
Open

Faulty enemy collision #24

cchartr opened this issue May 23, 2015 · 1 comment

Comments

@cchartr
Copy link
Contributor

cchartr commented May 23, 2015

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.

@parasyte
Copy link
Collaborator

@cchartr This is a bug in melonJS that will be fixed by melonjs/melonJS#574

There's also a thread on the forum where the tutorial issue was reported, including the details of what causes it (and how to add a workaround): https://groups.google.com/forum/#!msg/melonjs/lAS974m-IxU/uqWm7HdoAVYJ

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants