Fat Pint Games
Fat Pint Games › Asset Documentation › Confetti Engine
Confetti Engine logo

Burst, rain and launch colourful confetti into your GameMaker projects.

GameMaker Asset

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.

Version 1.0.0GameMaker 2023.0+Custom SpritesText Confetti

Features

Tested with: IDE 2024.11.0.179 and Runtime 2024.11.0.226.

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.

Important: Make sure 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.

See obj_confetti_spawner in the Example folder for calls using these functions.

Function Arguments

Arguments marked Optional have default values.

confetti_fall_create()

ArgumentRequiredDescription
_settle_styleYessettle_style.expire or settle_style.inworld.
_exit_styleOptionalExit animation; defaults to exit_style.fade.
_amountYesNumber of confetti instances.
_min_x, _max_xYesHorizontal spawn range.
_min_y, _max_yYesVertical spawn range.
_scaleOptionalDraw scale; default 1.
_colourOptionalDraw colour; default c_white.
_sprite_indexOptionalSprite; default spr_confetti.

confetti_burst_create()

ArgumentRequiredDescription
_settle_styleYessettle_style.expire or settle_style.inworld.
_exit_styleOptionalExit animation; defaults to exit_style.fade.
_amountYesNumber of confetti instances.
_min_x, _max_xYesHorizontal origin range.
_min_y, _max_yYesVertical origin range.
_scaleOptionalDraw scale; default 1.
_forceOptionalOutward force; default random_range(7,18).
_colourOptionalDraw colour; default c_white.
_sprite_indexOptionalSprite; default spr_confetti.

confetti_launch_create()

ArgumentRequiredDescription
_settle_styleYessettle_style.expire or settle_style.inworld.
_exit_styleOptionalExit animation; defaults to exit_style.fade.
_amountYesNumber of confetti instances.
_min_x, _max_xYesHorizontal launch range.
_min_y, _max_yYesVertical launch range.
_scaleOptionalDraw scale; default 1.
_force_min, _force_maxOptionalMinimum and maximum launch force; defaults 5 and 18.
_dirOptionalLaunch direction; default 90.
_angle_offset_min, _angle_offset_maxOptionalCone offsets relative to _dir; defaults -25 and 25.
_colourOptionalDraw colour; default c_white.
_sprite_indexOptionalSprite; 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.

Use the function definition included with the asset as the source of truth for its arguments.

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.

Note: Adjust the text helper call to match the exact function signature included with the asset.

Additional Information