Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Arcade.Body.reset() sizes bodies of scaled sprites incorrectly #10

Closed
samme opened this issue Jan 20, 2017 · 0 comments · Fixed by #11
Closed

Arcade.Body.reset() sizes bodies of scaled sprites incorrectly #10

samme opened this issue Jan 20, 2017 · 0 comments · Fixed by #11

Comments

@samme
Copy link
Collaborator

samme commented Jan 20, 2017

http://codepen.io/samme/pen/apJBWP?editors=0010

  • A sprite with a physics body and exists = false
  • Modify its scale
  • Call sprite.reset(…) or sprite.body.reset(…)
  • The body dimensions don't match the sprite dimensions

This can happen if you try scaling weapon bullets (which don't exist until they are reset when fired).

It happens because

  • sprite.reset() → body.reset() updates the cached scale but doesn't resize the body
  • body.preUpdate() → body.updateBounds() resizes the body only if the cached scale is wrong

This issue is about (delete as applicable)

  • A bug in the API (2.6, 2.7)
samme pushed a commit to samme/phaser-ce that referenced this issue Jan 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant