public boolean intersects(Actor other) { int thisBounds1; if (this.image == null) { if (other.image != null) { thisBounds1 = this.gameLayer.getCellSize(); return other.containsPoint( location.x() * thisBounds1 + thisBounds1 / 2, location.y() * thisBounds1 + thisBounds1 / 2); } else { return location.x == other.location.x && location.y == other.location.y; } } else if (other.image == null) { thisBounds1 = this.gameLayer.getCellSize(); return this.containsPoint( other.location.x() * thisBounds1 + thisBounds1 / 2, other.location.y() * thisBounds1 + thisBounds1 / 2); } else { RectBox thisBounds = this.getBoundingRect(); RectBox otherBounds = other.getBoundingRect(); if (this.rotation == 0 && other.rotation == 0) { return thisBounds.intersects(otherBounds); } else if (!thisBounds.intersects(otherBounds)) { return false; } else { int[] myX = this.xs; int[] myY = this.ys; int[] otherX = other.xs; int[] otherY = other.ys; return checkOutside(myX, myY, otherX, otherY) ? false : !checkOutside(otherX, otherY, myX, myY); } } }