GameMaker Studio 2 v2022.2 (or Feb’22) introduces text animation in Sequences, video playback at runtime (beta only), and various smaller feature additions.
Text in Sequences
Sequences are used to create animations
and allow the use of sprites, objects, sounds, and other
Sequences. Now, you can also write, format, and animate text inside the
Sequence Editor.
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 colour,
alignment, various spacing values, and enable or disable wrapping:
Use wrapping to confine your text within a frame, or disable it to keep your text on a single line. 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.
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.
Read Text in Sequences in the GameMaker manual for detailed information.
Video Playback (Beta Only)
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.
Call video_open() to load a
video file, and video_draw() to draw it to a surface that is returned in an array.
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.
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.
The video playback feature will be added to Stable once its implementation is completely finished on all platforms.
CSS Colours
GameMaker has always supported hex
values entered directly into your code to represent colours. This
would, however, require the format ‘$BBGGRR’ (Blue, Green, Red), which isn’t
compatible with various mainstream applications and languages.
Release 2022.2 introduces the ability
to write CSS colours in your GML code. You can use the format
‘#RRGGBB’ (Red, Green, Blue) to write hex colours, just like you would in CSS
or in your drawing application (e.g. Photoshop).
This also allows for more compatibility
within GameMaker itself, as various colour pickers throughout the IDE use the RRGGBB format. So you can now copy a colour value from
such a colour picker, and drop it in your code with a hash/pound
symbol (#) in the beginning.
Copy on Write Option
Copy on Write behaviour for arrays has
been removed in v2022.2. For users who would like to retain that
behaviour for their projects, a new option has been added to the
General
Game Options, called “Enable Copy on Write Behaviour
for Arrays”.
In previous versions of GameMaker, if
you modified an array that was passed through a function as an
argument, or was retrieved from a data structure, the original array
would not be modified. Instead, a new copy of the array would be
created with your modifications. This is referred to as the “Copy
on Write” behaviour.
You could work around this by using the
@ accessor, which would modify the original array instead of
creating a new copy. However, the Copy on Write behaviour was not
reliable, and it caused some users issues that were difficult to
track down.
Due to this, the Copy on Write
behaviour has been removed.
If you modify an array now, regardless of where you got it from, only
the original array will be modified, and a copy will not be created.
To copy an array now, you must use array_copy().
Projects that rely on the Copy on Write
Behaviour may break with this change, so we have provided an option
to revert to the pre-2022.2 array behaviour. Enabling this option
reverts only the opened project to the old array behaviour, and all
other projects remain unchanged – this is because it’s a “Game
Option” and not a GMS2 preference.
Read more about this release in our Release Notes, and update your GameMaker version to check out these new features. Download the beta to try video playback, and our new intelligent code completion system (Feather).
If you’ve got questions about these features, hit me up on Twitter
@itsmatharoo.
Happy GameMaking!