| 100 | /// Returns the axis aligned bounding box of the (scaled) sprite, ignoring |
| 101 | /// rotation. Useful for broad phase collision checks. |
| 102 | public Rectangle getBounds() { |
| 103 | float sw = getRenderWidth() * scaleX; |
| 104 | float sh = getRenderHeight() * scaleY; |
| 105 | int bx = (int) Math.round(x - anchorX * sw); |
| 106 | int by = (int) Math.round(y - anchorY * sh); |
| 107 | return new Rectangle(bx, by, Math.round(sw), Math.round(sh)); |
| 108 | } |
| 109 | |
| 110 | /// Returns true if this sprite's bounding box intersects the other's. |
| 111 | public boolean intersects(Sprite other) { |