GameMaker Studio 2 has always been a popular choice for developers looking to create 2D games. With its intuitive interface and powerful features, it has helped countless developers bring their visions to life. But with the recent release of version 2022.2, GameMaker Studio 2 has introduced a new feature that promises to revolutionize the way developers create animations: the Sequences system.
What is the Sequences System?
A Sequence in GameMaker Studio 2 is essentially a collection of assets that perform a dynamic animation over time. They can contain sprites, instances, sounds, and other things, and are used to create animations. The Sequences system allows developers to write, format, and animate text inside the Sequence Editor, adding a new layer of depth and complexity to their games.
How Does it Work?
To create a text animation in a Sequence, you simply click on the Text tool and drag in the canvas to create a text area. This opens up the Inspector, where you can enter your text, change the color, alignment, various spacing values, and enable or disable wrapping.
// Example of creating a text animation in a Sequencevar seq = layer_sequence_create(layer, x, y, "my_sequence");
sequence_element_text(seq, "Hello, world!", 0, 0, 100, 100);
The size of the wrapping frame is provided as a parameter, called ‘Frame Size’. When your text hits the horizontal end of the frame, it wraps to the next line, and when it hits the bottom end, it gets cut off.
In addition to the usual parameters (Position, Rotation, Colour, etc.), you can also animate the Character Spacing, Line Spacing, Paragraph Spacing, and Frame Size of your text track. Just add a parameter track and place keyframes in the Dope Sheet for animation.
// Example of animating text parameters in a Sequence
var seq = layer_sequence_create(layer, x, y, "my_sequence");
var text = sequence_element_text(seq, "Hello, world!", 0, 0, 100, 100);
sequence_element_text_set_spacing(seq, text, 1, 1, 1);
sequence_element_text_set_frame_size(seq, text, 200, 200);
It’s important to note that you can’t currently modify the text in a Sequence instance at runtime. However, you can modify a Sequence Object struct to change the text in any of a Sequence asset’s tracks.
Other New Features in GameMaker Studio 2 v2022.2
In addition to the Sequences system, GameMaker Studio 2 v2022.2 also introduces video playback at runtime (currently in beta), and various smaller feature additions. With the beta version of GameMaker, you can now load a video file at runtime and play it. This feature was previously available on some console exports, and has been expanded to support all targets.
// Example of loading and playing a video at runtime
var video = video_open("my_video.mp4");
video_draw(video, 0, 0, 800, 600);
You can also change the volume for your video by calling video_set_volume()
, and call video_close()
when you no longer need the video.
// Example of changing video volume and closing the video
video_set_volume(video, 0.5);
video_close(video);
Only one video can be loaded at a time, so when you call video_open()
it loads the specified video file into the only available video slot. It does not return an ID (identifier) value as all other video functions directly manipulate the video that’s currently loaded and don’t require video identifiers.
Conclusion
The introduction of the Sequences system in GameMaker Studio 2 v2022.2 is a game-changer for developers. It allows for more complex and dynamic animations, adding a new layer of depth to games. With the addition of video playback at runtime and various other smaller features, GameMaker Studio 2 continues to prove itself as a powerful tool for game development.
Whether you’re a seasoned developer or just starting out, the new Sequences system in GameMaker Studio 2 is worth checking out. It might just be the feature you need to bring your game to the next level.