Static catch-all class used to access global properties and functions.
Static variables
static read only choose : Dynamic
The choose function randomly chooses and returns one of the provided values.
static elapsed : Float
Game time elapsed since the last frame. For fixed framerate, this will be a constant 1/framerate.
static pan : Float
Global panning factor for all sounds, a value from -1 to 1. Panning only applies to mono sounds. It is ignored on stereo.
The currently active Scene object. When you set this, the Scene is flagged to switch, but won't actually do so until the end of the current frame.
static write only time : Float
Static functions
static alarm (delay : Float, complete : Void ->Void, , type : TweenType, tweener : Tweener) : Alarm
Schedules a callback for the future. Shorthand for creating an Alarm tween, starting it and adding it to a Tweener.
Parameters:
delay | The duration to wait before calling the callback. | |
complete | The function to be called when complete. | |
type | Tween type. | |
tweener | The Tweener object to add this Alarm to. Defaults to HXP.tweener. |
Returns:
The added Alarm object. Example: HXP.alarm(5.0, callbackFunction, TweenType.Looping); // Calls callbackFunction every 5 seconds
static clear<T> (array : Array<T>) : Void
Empties an array of its' contents
Parameters:
array | filled array |
static frames (from : Int, to : Int, skip : Int = 0) : Array<Int>
Gets an array of frame indices.
Parameters:
from | Starting frame. | |
to | Ending frame. | |
skip | Skip amount every frame (eg. use 1 for every 2nd frame). |
Returns:
The array.
static indexOf<T> (arr : Array<T>, v : T) : Int
Optimized version of Lambda.indexOf for Array on dynamic platforms (Lambda.indexOf is less performant on those targets).
Parameters:
arr | The array to look into. | |
param | The value to look for. |
Returns:
Returns the index of the first element [v] within Array [arr]. This function uses operator [==] to check for equality. If [v] does not exist in [arr], the result is -1.
static insertSortedKey<T> (list : Array<T>, key : T, compare : T ->T ->Int, ) : Void
Binary insertion sort
Parameters:
list | A list to insert into | |
key | The key to insert | |
compare | A comparison function to determine sort order |
static next<T> (current : T, options : Array<T>, loop : Bool = true) : T
Returns the next item after current in the list of options.
Parameters:
current | The currently selected item (must be one of the options). | |
options | An array of all the items to cycle through. | |
loop | If true, will jump to the first item after the last item is reached. |
Returns:
The next item in the list.
static prev<T> (current : T, options : Array<T>, loop : Bool = true) : T
Returns the item previous to the current in the list of options.
Parameters:
current | The currently selected item (must be one of the options). | |
options | An array of all the items to cycle through. | |
loop | If true, will jump to the last item after the first is reached. |
Returns:
The previous item in the list.
static resize (width : Int, height : Int) : Void
Resize the screen.
Parameters:
width | New width. | |
height | New height. |
static setCamera (x : Float = 0, y : Float = 0) : Void
Sets the camera position.
Parameters:
x | X position. | |
y | Y position. |
static shuffle<T> (a : Array<T>) : Void
Shuffles the elements in the array.
Parameters:
a | The Object to shuffle (an Array or Vector). |
static swap<T> (current : T, a : T, b : T) : T
Swaps the current item between a and b. Useful for quick state/string/value swapping.
Parameters:
current | The currently selected item. | |
a | Item a. | |
b | Item b. |
Returns:
Returns a if current is b, and b if current is a.
static timeFlag () : Float
Sets a time flag.
Returns:
Time elapsed (in milliseconds) since the last time flag was set.
static tween (object : Dynamic, values : Dynamic, duration : Float, ?options : Dynamic) : MultiVarTween
Tweens numeric public properties of an Object. Shorthand for creating a MultiVarTween tween, starting it and adding it to a Tweener.
Parameters:
object | The object containing the properties to tween. | |
values | An object containing key/value pairs of properties and target values. | |
duration | Duration of the tween. | |
options | An object containing key/value pairs of the following optional parameters: type Tween type. complete Optional completion callback function. ease Optional easer function. tweener The Tweener to add this Tween to. |
Returns:
The added MultiVarTween object. Example: HXP.tween(object, { x: 500, y: 350 }, 2.0, { ease: Float -> Float, complete: onComplete } );