Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_custom_particle_system_Step_0

(view raw script w/o annotations or w/e)
1
if (global.pause_plat)
2
    exit;
3
if (instance_exists(obj_mainchara_dash) && obj_mainchara_dash.hitstop > 0)
4
    exit;
5
if (particle_system_lifetime > 0)
6
{
7
    particle_system_lifetime--;
8
    if (particle_system_lifetime <= 0)
9
    {
10
        auto_cleanup = true;
11
        frames_between_emissions = 0;
12
    }
13
}
14
if (frames_between_emissions > 0)
15
{
16
    emission_timer++;
17
    if (emission_timer >= frames_between_emissions)
18
    {
19
        emission_timer = 0;
20
        repeat (particles_per_emission)
21
            emit();
22
    }
23
}
24
var num_particles = array_length(particle_data);
25
var i = num_particles - 1;
26
while (i >= 0)
27
{
28
    with (particle_data[i])
29
    {
30
        timer++;
31
        x += hspeed;
32
        y += vspeed;
33
        vspeed += gravity;
34
        hspeed *= (1 - friction);
35
        vspeed *= (1 - friction);
36
        image_index += image_speed;
37
        image_alpha -= fadeout_speed;
38
        other.particle_step_func(self);
39
        if ((animation_mode && image_index >= sprite_get_number(sprite_index)) || (fadeout_speed > 0 && image_alpha <= 0) || timer >= lifetime)
40
            array_delete(other.particle_data, i, 1);
41
    }
42
    i--;
43
}
44
if (auto_cleanup && array_length(particle_data) == 0)
45
    instance_destroy();