Jump to content

geometry contains when inside of a group


ptotheaul
 Share

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");
    }
    
}

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...