Reference ‐ Animation Queue - KormexGit/GM-Animate GitHub Wiki
The animation queue system allows you to play multiple animations in a row without needing to constantly monitor if the current animation has finished or not. This can be very useful for things like dynamically playing transition animations.
If anything has been added to the queue, then the first queued animation will be automatically changed to when the current animation ends. After a queued animation is changed to, it will be removed from the queue. If multiple animations are queued, then the one at position 0 will be used and all the others will move up a slot.
animation_queue_add
Add an animation to the end of the queue.
animation_queue_add(_sprite, _loop = true, _track = 0)
Argument | Type | Description |
---|---|---|
_sprite | Sprite Asset | The sprite to queue |
_loop | Bool | (Optional) Whether the queued animation should loop or not. If more animations are queued after this one, this argument is irrelevant |
_track | Real (Int) | (Optional) The track to queue an animation for |
Returns: N/A (Undefined)
animation_queue_insert
Inserts an animation into the specified position in the queue.
[!NOTE] If _index is larger than the current queue length, then animation_queue_add will automatically be run instead, putting the animation at the end of the queue.
[!CAUTION] Queue positions cannot be negative!
animation_queue_insert(_sprite, _index, _loop = true, _track = 0)
Argument | Type | Description |
---|---|---|
_sprite | Sprite Asset | The sprite to queue |
_index | Real (Int) | The position in the queue to insert the animation into |
_loop | Bool | (Optional) Whether the queued animation should loop or not. If more animations are queued after this one, this argument is irrelevant |
_track | Real (Int) | (Optional) The track to queue an animation for |
Returns: N/A (Undefined)
animation_queue_clear
Clears the queue, removing all queued animations.
animation_queue_clear(_track = 0)
Argument | Type | Description |
---|---|---|
_track | Real (Int) | (Optional) The track to clear |
Returns: N/A (Undefined)
animation_queue_remove_index
Removes the animation at the specified position in the queue.
animation_queue_remove_index(_index, _track = 0)
Argument | Type | Description |
---|---|---|
_index | Real (Int) | The position to remove from the queue |
_track | Real (Int) | (Optional) The track to remove from |
Returns: N/A (Undefined)
animation_queue_remove_sprite
Removes the specified sprite from the queue. If the sprite has been queued multiple times, this will remove all of them.
animation_queue_remove_sprite(_sprite, _track = 0)
Argument | Type | Description |
---|---|---|
_sprite | Sprite Asset | The sprite to remove from the queue |
_track | Real (Int) | (Optional) The track to remove from |
Returns: N/A (Undefined)
animation_queue_get_length
Returns the number of animations currently queued.
animation_queue_get_length(_track = 0)
Argument | Type | Description |
---|---|---|
_track | Real (Int) | (Optional) The track to check |
Returns: Real
animation_queue_get
Returns an array of all currently queued sprites.
animation_queue_get(_track = 0)
Argument | Type | Description |
---|---|---|
_track | Real (Int) | (Optional) The track to check |
Returns: Array of sprite assets
animation_queue_get_index
Gets the position of the specified sprite in the queue. If the sprite is not present, -1 will be returned. If the sprite is present multiple times, then the first position will be returned. If you want every position a sprite is in, use animation_queue_get_all_indexes instead.
animation_queue_get_index(_sprite, _track = 0)
Argument | Type | Description |
---|---|---|
_sprite | Sprite Asset | The sprite to check for |
_track | Real (Int) | (Optional) The track to check |
Returns: Real
animation_queue_get_all_indexes
Gets every position of the specified sprite in the queue. If the sprite is not present, an empty array will be returned. If you want first position a sprite is in, use animation_queue_get_index instead.
animation_queue_get_all_indexes(_sprite, _track = 0)
Argument | Type | Description |
---|---|---|
_sprite | Sprite Asset | The sprite to check for |
_track | Real (Int) | (Optional) The track to check |
Returns: Array of reals