A collection of reusable scripts for GameMaker.
Most of these were created for personal projects and game jams. Some are adapted from tutorials, while others are based on work by other developers (properly credited where applicable).
Documentation follows the JSDoc standard, based on the official GameMaker Docs
Stops a sprite animation either immediately or when it reaches the final frame.
animation_stop(instant);
- instant {bool} If true, stops the animation immediately. If false, waits until the last frame before stopping.
Sets common drawing parameters for use in the Draw event.
draw_setup(font, color, halign, valign);
-
font {font} Font used for drawing text.
-
color {color} Drawing color.
-
halign {real} Horizontal alignment (fa_left, fa_center, fa_right).
-
valign {real} Vertical alignment (fa_top, fa_middle, fa_bottom).
Creates and returns a struct representing an item.
item_struct(name, sprite, object, collected, [ui_sprite]);
-
name {string} Item name or identifier.
-
sprite {sprite} In-game sprite.
-
object {object} Associated object.
-
collected {bool} Whether the item has been collected.
-
ui_sprite {sprite} (optional) Sprite used for UI display.
Triggers a screenshake effect through a dedicated controller object.
screenshake(magnitude, time, fade);
-
magnitude {real} Intensity of the shake.
-
time {real} Duration in steps.
-
fade {real} How quickly the effect fades out.
Changes an object's sprite and ensures the animation restarts from the first frame at default speed.
sprite_change(sprite);
- sprite {sprite} The new sprite to assign.