Constructor
new Action(actFunction)
This constructor is used by static ActionFactory methods.
Actions store their total running time, as some Actions run only for a precise amount of time.
Actions store their total running time, as some Actions run only for a precise amount of time.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
actFunction |
function | null | function that will be applied to the Sprite this Action is attached to; must take parameters (targetSprite, deltaTime, totalTime). |
Methods
apply(targetSprite, deltaTime) → {boolean}
Increments totalTime by deltaTime and applies function to target.
Parameters:
Name | Type | Description |
---|---|---|
targetSprite |
Sprite | the sprite to which the function will be applied |
deltaTime |
number | elapsed time (seconds) since previous iteration of game loop (typically approximately 1/60 second) |
Returns:
true if the function has completed, false otherwise
- Type
- boolean
reset()
Sets totalTime to 0, effectively restarting this Action.