overlapping

open override fun overlapping(actorA: Actor, actorB: Actor): Boolean

Note. overlapping( actor1, actor2 ) can be quicker/slower than overlapping( actor2, actor1 ) If actor1 is axis-aligned actor2 is rotated, place=ing actor2 first may be slower, because the bounds check will catch more cases (and therefore the pixel-tests aren't needed).


open override fun overlapping(actorA: Actor, others: Iterable<Actor>): Boolean

Do any of others overlap actorA.

If others contains actorA, it is ignored (i.e. an actor never overlaps itself). This lets you check if an actor is overlapping anything on the same stage using :

if ( myOverlapping.overlapping( actorA, actorA.parent.children) ) ...

The default implementation iterates over others and returns true if any of them overlap.

This doesn't give any indication which of others is overlapping, so is no use when you want to cause damage to both overlapping actors. It is often used to check for collisions with scenery. In which case, consider placing all the scenery in a separate stage, so you ever need to filter actors to find only the scenery.