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

I think the function 'hit' doesn't work as expect in some cases #15

Open
windschaser opened this issue Jan 22, 2018 · 0 comments
Open

Comments

@windschaser
Copy link

windschaser commented Jan 22, 2018

  1. The doc says anySprite.circular = true; will make the sprite be interpreted as circular. In fact it doesn't work. I notice there's a block in the source code:
if (aIsASprite && bIsASprite) {
          //Yes, but what kind of sprites?
          if (a.diameter && b.diameter) {
            //They're circles
            return circleVsCircle(a, b);
          } else if (a.diameter && !b.diameter) {
            //The first one is a circle and the second is a rectangle
            return circleVsRectangle(a, b);
          } else {
            //They're rectangles
            return rectangleVsRectangle(a, b);
          }
        }

It seems that the function hit uses diameter as the flag of circle rather than circular. After my testing ,anySprite.diameter= true; works well.

  1. It seems that function movingCircleCollision works well----I mean both the circles move when they hit each other. But rectangleCollision and circleRectangleCollision won't move the second sprite passed into function. Is that a bug?
    P.S. I have passed the correct parameters, the call seems like this: b.hit(circle, rect, true, true);
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

No branches or pull requests

1 participant