Particle Effects - Grisgram/gml-raptor GitHub Wiki

Particles are a great way to bring your scene to life. Be it small dust clouds on the floor, or snow/rain effects, that make your environment more immersive, or power-up enemy deaths, ship explosions and any other fast paced effects in your scene.

GameMaker offers ParticleSystems for this, and you can create ParticleTypes, that follow specific rules defined by a ParticleEmitter. However, the particle system is quite complex because it offers an immense amount of options.

While latest GameMaker versions even offer a particle editor in the IDE, and a new asset type has been created for them, I still miss a comfortable way to attach such effects to sprites, specific frames or even make an emitter follow an object. While some of these features are possible with Sequences and other IDE/runtime features, I am personally more on the coding-side, and not so much on the click-in-a-designer-side.

Therefore, raptor offers its own management of particles, a comfortable particle editor, an export interface for those particles, and the raptor engine has full integrated runtime support for those particles you define in the editor.

Tool chain

1. Particle Editor

image particle_anim

First of all, I would like to introduce you to the Particle Editor by Mickey from GameMaker Casts, a fellow community member at the GameMaker Kitchen discord. He created an explicit GML Raptor export interface in his editor for me, to create GML source code, that you can copy directly to your game project.

When using the raptor particle engine, I strongly recommend, that you use this Particle Editor, as the export interface really saves you a ton of time.
Experiment with the tool, get used to it, and when you have your particle set up, choose "Export" in the editor.

2. Import to raptor

I will not do a complete documentation of the editor here, but I will write a short guide, on how to export to raptor.

image

On the Export tab, choose GML Raptor from the dropdown box, where you will see three options:

Option Type Description
Emitter string The name of the emitter in your GML code.
I normally prefix them with em, something like emExplosion_Big
Particle string The name of the particle type in your GML code.
I normally name them equal to their emitter, but prefixed with pt. So, for the emExplosion_Big, I'd name the particles ptExplosion_Big
PARTSYS_Index int This very important value needs a bit more explanation, read on below
in the RoomController Setup

3. Setup in the RoomController

The RoomController offers an instance variable that you should set in the room, where you want to use the particles: particle_layer_names.

image

  • If you do not have any particles in your room, leave the value as undefined.
  • If you need only one layer to render your particles, just set it to a string value which holds the name of the layer, like "Particles_Layer".
  • If you have several layers of particles (like background and foreground particles), you may also set the variable to a string array, like
    ["Particles_Back", "Particles_Fore"]

And this second, special case, when you have more than one layer for particles, is the moment, where the PARTSYS Index of the Particle Editor comes into play. To have the particles rendered through the first emitter of your array, set the index to 0, to render it through the second emitter, set it to 1. This value is the array index of the particle_layer_names, where you want this effect to become visible.


Note

The layer type of all layers that shall render particles must be Instance Layer!


4. The Game_ParticleTypes script

In the _GAME_SETUP_ section of the project template you will find a script named Game_ParticleTypes. It contains only one single function:

function setup_particle_types() {
	
}

When you hit the Export Button in the Particle Editor, it copies a lot of GML code to the clipboard. Just open this script and paste the code generated into this function.

That's it! Now you can use your designed particles with raptor!

Now, with the particle types and emitters set up in your room, it's time to look at their usage in the Room Designer, in GameMaker and in code during runtime of your game. Read on at Particle Effects Runtime.

⚠️ **GitHub.com Fallback** ⚠️