jetlag2d
    Preparing search index...

    Function relativeZone

    • Report the cardinal direction that one must travel from the center of self in order to reach other. Specializing collision behavior based on this direction allows things like "defeat by jumping" to work when falling onto an actor, but not when jumping up into it.

      The raw center-to-center offset is normalized by each axis's combined half-extents before comparing them. Without this, a platform that's much wider than it is tall (a typical one-way platform) would misclassify an off-center landing as "E"/"W" instead of "N", since the raw horizontal offset so easily exceeds the raw vertical one.

      Parameters

      • self: Actor

        The actor whose side is being classified

      • other: Actor

        The actor touching self, whose position determines the zone

      Returns DIRECTION