Sign in to follow this  
ptotheaul

geometry contains when inside of a group

Recommended Posts

I have a polygon and a sprite inside of an extended group that I'm trying to check .contains on.  Even though the polygon and the sprite are visually overlapping the contains is returning false.  Would the .contains be relative to the stage even though

//hitx , hity are points in the main game world passed into this which is an extended group that is placed at a position on the stage

Building.prototype.checkbuildingoverlap = function(hitx, hity) {

   //this is just set up so i can see the spot i'm checking in the .contains
    this.tempspot.x = hitx - this.x;
    this.tempspot.y = hity - this.y;

//this.buildinggraphics is a polygon shape
    if (this.buildinggraphics.contains(hitx - this.x, hity - this.y)) {
        console.log("CONTAINS IS HAPPENING");
    }
    
}

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

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.