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

Allow Sprite to be a circle #317

Closed
straker opened this issue Sep 15, 2022 · 2 comments · Fixed by #404
Closed

Allow Sprite to be a circle #317

straker opened this issue Sep 15, 2022 · 2 comments · Fixed by #404
Labels
feature New feature or enhancement

Comments

@straker
Copy link
Owner

straker commented Sep 15, 2022

If radius is passed to sprite, draw circle instead of square.

Sprite({
  x: 0,
  y: 0,
  color: 'red',
  radius: 5
});

Additional this should allow collision detection between circle vs circle and circle vs square. Would also need to look through the code to see what other things may break / need to be updated to handle circles.

@straker straker added the feature New feature or enhancement label Sep 15, 2022
@crhallberg
Copy link
Contributor

crhallberg commented Oct 19, 2022

Would you expect x and y to be in the center of the circle or in the corner - which would allow rects and circles with the same x and y to occupy the same space?

This could be done by setting a default anchor of 0.5 when radius is set.

@straker
Copy link
Owner Author

straker commented Oct 20, 2022

Ya. Ideally the sprites draw position would be the same regardless if it's a square or circle. A centered anchor property would draw both centered around the x/y position.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or enhancement
Projects
None yet
2 participants