Overlapping

interface Overlapping

Checks if two actors overlap each other.

PixelOverlapping is the easiest to use, because it just works, with a single method call - no extra setup required.

FYI, Most game engines I've seen either don't support pixel-based overlap detection, or encourage you to use hit boxes. Hit boxes are more flexible, and faster, but IMHO, a PITA. In games such as Thrust, if you don't get the hit boxes perfect, it ruins the game somewhat - life and death becomes slightly random.

Simplistic overlapping detection is O(n²). If you have n objects they each have to check (n-1) other objects. So, when the number of object goes up 10 times, the time goes up by a factor of 100. This is bad! If you have lots Actors, consider using an algorithm which doesn't use brute-force of checking every combination. For example, divide the world into sections, then you only need to check actors in the same, or neighbouring sections.

Inheritors

Functions

Link copied to clipboard
open fun overlapping(actorA: Actor, others: Iterable<Actor>): Boolean

Do any of others overlap actorA.

abstract fun overlapping(actorA: Actor, actorB: Actor): Boolean