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

Faulty enemy collision #24

@cchartr

Description

@cchartr

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions