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.

Collision shape not centered with renderable shape #35

@Hectate

Description

@Hectate

While doing the platformer tutorial I discovered that the collision shape was aligning itself with the left edge of the renderable shape, instead of centered. The tutorial implies that centering will be done automatically around the origin, and shows a picture that appears to indicate this. The only other reference to the collision shape/size is that it can be adjusted in Tiled (which functions).

I corrected this by adding this.renderable.translate(-16, 0); to my init function for the PlayerEntity. I'm uncertain if is the best approach, and I'm not certain if this is a bug with melonJS, or just undocumented behavior that should be added to the tutorial.

Without the offset:
image

With the offset:
image

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