External Exam Download Resources Web Applications Games Recycle Bin

simple particle effects | gml





More simple particle system effects can be found here.

objBall Create

speed = 3;
direction = irandom_range(1,360);
e_index = 0;
effects[0] = ef_smoke;
effects[1] = ef_explosion;
effects[2] = ef_flare;
effects[3] = ef_smoke;
effects[4] = ef_ring;

objBall Step

//effect_create_above(kind, x, y, size, colour);
//same as effect_create_below()
//choose either beneath or above all instances.

//kind: choose ef_ constants from the list on the website..
//examples include: ef_cloud, ef_smoke, etc.
//size: 0 small, 1 medium, 2 large
//colour: e.g. c_yellow, c_fuchsia, c_green etc.

//x and y not applicable for ef_rain or ef_snow

//use effect_clear() to clear all effects.

if keyboard_check(ord("R")) { // HOLD R to make it RAIN!
    effect_create_above(ef_rain, 0, 0, 0, c_dkgray); 
}

if keyboard_check(ord("S")) { // HOLD S to make it SNOW!
    effect_create_above(ef_snow, 0, 0, 1, c_white); 
}

if keyboard_check_pressed(ord("F")) { // PRESS F for FIREWORK!
    effect_create_below(ef_firework, x, y, 2, c_fuchsia); 
}

effect_create_below( effects[e_index], x, y, 0, c_gray );

if keyboard_check_pressed(vk_space){ // PRESS spacebar to cycle effects...
    e_index = e_index + 1;
    if e_index >= array_length_1d(effects) then e_index = 0; //back to start
}

move_wrap(true,true,0); //allow ball to wrap screen margins