Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Collision detection doesn't work for Anchors other than TopLeft #30

Open
kurtome opened this issue Nov 23, 2023 · 0 comments
Open

Collision detection doesn't work for Anchors other than TopLeft #30

kurtome opened this issue Nov 23, 2023 · 0 comments

Comments

@kurtome
Copy link
Owner

kurtome commented Nov 23, 2023

CollisionDetectionBehavior.intersectsOther has math that assumes the x and y for each entity are all relative to the top-left corner, which is the default Anchor. So, if you change an entity Anchor.Center, the hitbox won't actually match up with the collision detection (it'll be off by half the width in this case).

This bug is currently visible in the examples/standard_platformer because the Coins are Anchor.Center, how the next PR will change them to use the default anchor to avoid this issue.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant