dthrasher90

checking positions

Recommended Posts

Here's a good way to do it using two rectangles:

https://phaser.io/examples/v2/geometry/rectangle-intersects

You could just use the bounds of the sprite instead of one of the rectangles, then check if intersects exists and has height/width to determine if a part of the sprite is within the target rectangle.  Furthermore, you could check to see if intersects has the same bounds as your sprite if you want to see if the sprite is all the way inside the rectangle.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.