Description

Triggered when a touch event starts.

Example

// Prints the touch position when a screen touch has started
var event = script.createEvent("TouchStartEvent");
event.bind(function(eventData)
{
var touchedPos = eventData.getTouchPosition();
print("touch started at " + touchedPos.x + " " + touchedPos.y);
});
interface TouchStartEvent {
    enabled: boolean;
    bind(evCallback): void;
    getSceneObject(): SceneObject;
    getTouchId(): number;
    getTouchPosition(): vec2;
    getTypeName(): string;
    isOfType(type): boolean;
    isSame(other): boolean;
}

Hierarchy (view full)

Properties

enabled: boolean

Description

If true, the event is able to trigger. If false, the event will not trigger.

Methods

  • Parameters

    • evCallback: ((arg1) => void)
        • (arg1): void
        • Parameters

          • arg1: this

          Returns void

    Returns void

    Description

    Binds a callback function to this event.

  • Returns number

    Description

    Returns the ID of this specific touch. Useful for distinguishing between touches when multiple are occurring simultaneously.

  • Returns vec2

    Description

    Returns the normalized 2D screen position of the users touch. The normalized coordinates range from ([0-1], [0-1]), (0,0) being top-left and (1,1) being bottom-right.

  • Parameters

    • type: string

    Returns boolean

    Description

    Returns true if the object matches or derives from the passed in type.

  • Parameters

    Returns boolean

    Description

    Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

Generated using TypeDoc