1

I have one sprite on the main scene and another on a positioned layer (with the later being on the main scene too).

I want to detect collisions between them but the boundingBox() function of the sprite on the layer is offsetting by the position of the parent layer.

How do I detect a collision between the two sprites?

Terry Morgan
  • 114
  • 1
  • 10

1 Answers1

0

Try something like this:

if(goog.math.Box.intersects(this.sprite1.getBoundingBox(), sprite2.getBoundingBox())){
    //do something...
}
Bo Persson
  • 90,663
  • 31
  • 146
  • 203
jtstroup
  • 73
  • 6