Burst, rain and launch colourful confetti into your GameMaker projects.
Confetti Engine
A modular confetti system for GameMaker that can rain, burst and launch animated confetti into the game world, with support for custom sprites and text-based confetti.
Features
- Spawn animated confetti using rain, burst and directional launch effects.
- Choose whether confetti expires or lands inside the game world.
- Choose fade, sparkle, scale, spiral or pop exit animations.
- Use the included sprite, custom sprites or generated text sprites.
- Control which objects confetti can land on and which destroy it.
Licence
You may use the Confetti Engine in personal or commercial projects.
Credit is not required, but is appreciated.
How to Use
Place obj_confetti_init into a room at the start of your game.
This persistent object only needs to be created once. It creates the global variables and particle systems required by the Confetti Engine.
obj_confetti_init exists before creating confetti.Configuration Arrays
global.confetti_layer_collision_objects
- Contains objects that confetti is allowed to land on.
- Confetti landing on these objects moves to
ABOVE_LAYER. - Characters are usually omitted because they normally walk above landed confetti.
confetti_destroy_collision_objects
- Contains objects that destroy confetti on contact.
- Use this for walls and surfaces where confetti should not remain.
font_array_
- Contains fonts that may be used for text confetti.
- The fonts are pre-baked into the texture page to prevent text from being cut off before the font loads.
Macros
#macro ABOVE_LAYER
Default: "Above"
The layer on which confetti is initially created. It should draw above characters and most room objects.
#macro FLOOR_LAYER
Default: "Floor"
The layer that landed confetti moves to when it reaches the floor. It should draw below characters and other game objects.
#macro CONFETTI_MAX_INSTANCES
Default: 2000
The maximum number of confetti instances allowed at once. Set it to undefined or -1 to disable the limit.
Main Functions
confetti_fall_create()
Rains confetti throughout a rectangular area.
confetti_burst_create()
Bursts confetti outward from a rectangular origin.
confetti_launch_create()
Launches confetti in a directional cone.
confetti_text_sprite_create()
Converts text into a temporary sprite for use as confetti.
obj_confetti_spawner in the Example folder for calls using these functions.Function Arguments
Arguments marked Optional have default values.
confetti_fall_create()
| Argument | Required | Description |
|---|---|---|
_settle_style | Yes | settle_style.expire or settle_style.inworld. |
_exit_style | Optional | Exit animation; defaults to exit_style.fade. |
_amount | Yes | Number of confetti instances. |
_min_x, _max_x | Yes | Horizontal spawn range. |
_min_y, _max_y | Yes | Vertical spawn range. |
_scale | Optional | Draw scale; default 1. |
_colour | Optional | Draw colour; default c_white. |
_sprite_index | Optional | Sprite; default spr_confetti. |
confetti_burst_create()
| Argument | Required | Description |
|---|---|---|
_settle_style | Yes | settle_style.expire or settle_style.inworld. |
_exit_style | Optional | Exit animation; defaults to exit_style.fade. |
_amount | Yes | Number of confetti instances. |
_min_x, _max_x | Yes | Horizontal origin range. |
_min_y, _max_y | Yes | Vertical origin range. |
_scale | Optional | Draw scale; default 1. |
_force | Optional | Outward force; default random_range(7,18). |
_colour | Optional | Draw colour; default c_white. |
_sprite_index | Optional | Sprite; default spr_confetti. |
confetti_launch_create()
| Argument | Required | Description |
|---|---|---|
_settle_style | Yes | settle_style.expire or settle_style.inworld. |
_exit_style | Optional | Exit animation; defaults to exit_style.fade. |
_amount | Yes | Number of confetti instances. |
_min_x, _max_x | Yes | Horizontal launch range. |
_min_y, _max_y | Yes | Vertical launch range. |
_scale | Optional | Draw scale; default 1. |
_force_min, _force_max | Optional | Minimum and maximum launch force; defaults 5 and 18. |
_dir | Optional | Launch direction; default 90. |
_angle_offset_min, _angle_offset_max | Optional | Cone offsets relative to _dir; defaults -25 and 25. |
_colour | Optional | Draw colour; default c_white. |
_sprite_index | Optional | Sprite; default spr_confetti. |
confetti_text_sprite_create()
The readme identifies this function as the text-to-sprite helper but does not provide its exact argument signature.
Settle Styles
settle_style.expire
Confetti continues falling until its lifespan ends, then it is destroyed. Use this for temporary effects that play over the game.
settle_style.inworld
Confetti falls to its landing position. It moves to ABOVE_LAYER when landing on configured objects; otherwise it moves to FLOOR_LAYER.
Exit Styles
exit_style.fade
Fades until opacity reaches zero.
exit_style.sparkle
Fades and creates sparkle particles.
exit_style.scale
Shrinks out of existence.
exit_style.spiral
Spins and fades away.
exit_style.pop
Bounces and creates sparkle particles.
Usage Examples
Adjust room coordinates, colours, sprites and amounts to suit your project.
confetti_fall_create()
Victory confetti rain
confetti_fall_create(
settle_style.expire,
exit_style.fade,
250,
0,
room_width,
-64,
0,
1,
c_white,
spr_confetti
);Rains 250 pieces across the room and fades them after their lifespan.
Festival confetti
confetti_fall_create(
settle_style.inworld,
exit_style.sparkle,
120,
0,
room_width,
-32,
32,
0.75,
c_yellow,
spr_confetti
);Creates yellow confetti that can settle in the room and later disappear with sparkles.
confetti_burst_create()
Treasure chest celebration
confetti_burst_create(
settle_style.inworld,
exit_style.pop,
80,
x - 8,
x + 8,
y - 8,
y + 8,
1,
14,
c_yellow,
spr_confetti
);Bursts yellow confetti from a chest and lets it settle inside the world.
Custom star burst
confetti_burst_create(
settle_style.expire,
exit_style.sparkle,
50,
x,
x,
y,
y,
1.5,
10,
c_aqua,
spr_star
);Uses a custom star sprite for a magical burst.
confetti_launch_create()
Confetti cannon
confetti_launch_create(
settle_style.inworld,
exit_style.fade,
100,
64,
96,
room_height - 32,
room_height,
1,
8,
18,
45,
-12,
12,
c_white,
spr_confetti
);Launches confetti diagonally upward from the bottom-left of the room.
Boss defeat launch
confetti_launch_create(
settle_style.expire,
exit_style.spiral,
160,
boss.x - 16,
boss.x + 16,
boss.y - 16,
boss.y + 16,
1.25,
10,
22,
90,
-35,
35,
c_red,
spr_confetti
);Launches a wide red cone from the defeated boss.
Text confetti
Celebration text
var _text_sprite = confetti_text_sprite_create("LEVEL UP!");
confetti_burst_create(
settle_style.expire,
exit_style.sparkle,
24,
x,
x,
y,
y,
1,
9,
c_white,
_text_sprite
);Creates a temporary text sprite and uses it in a confetti burst.
Additional Information
- Disabling the confetti limit may reduce frame rate when excessive numbers of instances are created.
- Use
settle_style.expirefor short-lived overlays andsettle_style.inworldwhen pieces should land in the room. - Populate the collision arrays before using in-world confetti.
- Add fonts used by text confetti to
font_array_.
Fat Pint Games