Very Simple Particle Effects


Particle Systems can be complicated, but if you want a nice, simple effect that you can call and customise from just one script, here's the solution

CREATE
/// @description Set-Up
image_speed = 0
image_index = irandom(image_number)
direction = random(360)
alarm[0] = 30+random(20)
friction = 0.1
image_alpha = 0.8+random(0.2)
fade = false
STEP
/// @description Fade
if fade = true then image_alpha -= 0.05
if image_alpha < 0 then instance_destroy()
ALARM 0
/// @description Time-Out
fade = true
/// @function particles(x,y,amount,speed,colour,scatter)
/// @param {real} x
/// @param {real} y
/// @param {real} amount
/// @param {real} speed
/// @param {real} colour
/// @param {real} scatter
function particles(_xx,_yy,_amount,_speed,_colour,_scatter){
repeat(_amount) {
with(instance_create_depth(_xx-(_scatter)+random(_scatter*2),_yy-(_scatter)+random(_scatter*2),depth-1,oParticles)) {
image_blend = _colour
speed = _speed-0.5+random(1)
}}}
And that's it! Now, whenever you want a nice, simple particle effect, just call:
particles(<X>,<Y>,<AMOUNT>,<SPEED>,<COLOUR>,<SCATTER_AMOUNT>)
and it'll look like this:
Easy! Enjoy!
Related Scripts
Browse these game resources from the community

My tower defense EnamyFactory constructer function
With this script you will be able to easily create new enemy types for tower defense games using just one calling object.

Super Easy Screen Shake
A little screen-shake effect can make all the difference, here's a super easy way to add one to your game!

The Most Simple Movement Code
Very simple collision code.

Why Join a Game Jam
Looking for a new challenge as a game developer? Consider participating in a game jam!