The Sequence Object Struct
A sequence object is the name given to the struct retrieved from the sequence asset as defined in the asset browser for your game. This struct will have the following properties that can be changed:
- name: This is the name of the sequence as a string and you can get or set this value as required. Note that sequences created using the function sequence_create() will
not have a name and this will simply be an empty string "".
- loopmode: This is the playback mode of the sequence object and can be get or set. It will return (or can be set to) the following constants:
| Constant |
Description |
Value |
| seqplay_oneshot |
The sequence will play once then stop when finished. |
0 |
| seqplay_loop |
The sequence will loop, with the playhead going back to the start when it reaches the end of the playback region. |
1 |
| seqplay_pingpong |
The sequence will loop, with the playhead reversing direction when it reaches the end of the playback region. |
2 |
- playbackSpeed: This specifies the playback speed of the sequence, which is interpreted as either frames-per-second or frames-per-game-frame depending on the playbackSpeedType (see below). You can get or
set this value.
- playbackSpeedType: This specifies how the playbackSpeed should be interpreted and you can get or set this value. You can use one of the following constants to set the value (or one of these constants will
be returned if checking the property):
| Constant |
Description |
Value |
| spritespeed_framespersecond |
Specifies that playbackSpeed should be interpreted as frames-per-second |
0 |
| spritespeed_framespergameframe |
Specifies that playbackSpeed should be interpreted as frames-per-game-frame. |
1 |
- length: The length of the sequence in frames. You can get or set this value, but note that making a sequence shorter may cause issues if a sequence instance referencing this sequence has its playhead set to past the new length.
- volume: This is a scalar value from 0 to 1 that is used to scale the volume of all audio tracks in the sequence. You can get or set this value and it will modify the global audio output for all tracks - for example, if you have an audio track
with a volume of 0.8 and then set the sequence volume property to 0.5, the audio track will have a final volume of 0.4.
- xorigin: This is the origin of the sequence along the X axis. You can get or set this value.
- yorigin: This is the origin of the sequence along the Y axis. You can get or set this value.
- messageEventKeyframes: This allows access to the message event keyframes for the sequence. You can get or set these message events, and when getting this property an array of keyframe structs is returned, and for setting the property you
should supply an array of keyframe structs. For more information, please see the page on Sequence Events and Moments.
- momentKeyframes: This allows access to the moment event keyframes for the sequence. You can get or set these moment events, and when getting this property an array of keyframe structs is returned, and for setting the property you should supply
an array of keyframe structs. For more information, please see the page on Sequence Events and Moments.
- tracks: This allows access to the list of asset tracks on the top level of the sequence. You can get or set this property, and when getting this property an array of track structs is returned, and for setting
the property you should supply an array of track structs. For more information, please see the section below on Track Structs.
Note that if you want to access the properties of a sequence that has been created in the asset browser, you must first call the function sequence_get() on the asset index to retrieve
the sequence object struct. Also note that any changes made to this sequence struct will mean that all further instances of this sequence asset will also have thse changes, and they will be maintained as long as the game is running, even if you call
the game_restart() function.