With this function you can start the playback of the given sequence. You supply the sequence element ID as returned by layer_sequence_create() or by one of the layer element functions and the function will play the sequence, which you can then pause if required using the function layer_sequence_pause()
layer_sequence_play(sequence_element_id)
| Argument | Description |
|---|---|
| sequence_element_id | The unique ID value of the sequence element to target |
N/A
if keyboard_check_pressed(ord("P"))
{
global.Pause = !global.Pause;
var a = layer_get_all_elements(layer);
for (var i = 0; i < array_length(a); i++;)
{
if layer_get_element_type(a[i]) == layerelementtype_sequence
{
if global.Pause
{
layer_sequence_pause(a[i]);
}
else
{
layer_sequence_play(a[i]);
}
}
}
}
The above code checks to see if the game has been paused or not when a key is pressed. If the game is paused, then it loops through all sequence elements on the current layer (the layer of the calling instance) and pauses their playback, and if the game is not paused, then the loop will start their playback again.