Skip to main content
Participant
November 4, 2021
Question

hitTest query

  • November 4, 2021
  • 1 reply
  • 93 views

Hi.

I am trying the following code - no luck.

if this.mc_circle.hitTest(this.doggy){
console.log("hitTest works");
}

All the examples I have seen on the forum are to do with x and y positions (localX, localY)

 

 

 

    This topic has been closed for replies.

    1 reply

    kglad
    Community Expert
    Community Expert
    November 7, 2021

    you have incorrect syntax.  hitTest in createjs takes two arguments, an x and a y.

     

    EaselJS v1.0.0 API Documentation : EaselJS (createjs.com)

     

    you can use:

     

    if this.mc_circle.hitTest(this.doggy.x, this.doggy.y){
    console.log("hitTest works");
    }