Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

IsFacingLeft()

Returns true if either X or Y of the provided scale is negative (but not both).

Used in engine Construct() and Draw() to flip bones or pivots if necessary.

function IsFacingLeft(scale: Vec2): Bool {
    const both: Bool = scale.x < 0 && scale.y < 0;
    const either: Bool = scale.x < 0 || scale.y < 0;
    return either && !both;
}