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

Collision shape not centered with renderable shape #35

Open
Hectate opened this issue Apr 4, 2020 · 0 comments
Open

Collision shape not centered with renderable shape #35

Hectate opened this issue Apr 4, 2020 · 0 comments

Comments

@Hectate
Copy link

Hectate commented Apr 4, 2020

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

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

1 participant