Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_vfx_debris_Step_0

(view raw script w/o annotations or w/e)
1
if (!init)
2
{
3
    init = true;
4
    base_hspeed = hspeed;
5
    base_vspeed = vspeed;
6
}
7
if (bouncer == 0 && (bounces > 0 || (image_angle % 90) != 0) && (timer % interval) == 0 && timer != 0)
8
    image_angle += rot;
9
timer += time_speed;
10
fader -= fade;
11
if (bouncer > 0)
12
{
13
    bouncer--;
14
    if (bouncer <= 0)
15
    {
16
        if (bounces > 0)
17
        {
18
            if (base_vspeed > 4)
19
                base_vspeed /= -2;
20
            else
21
                base_vspeed = -sqrt(base_vspeed);
22
            base_hspeed *= 0.5;
23
            time_speed = 0.5;
24
            vspeed = base_vspeed;
25
            hspeed = base_hspeed;
26
        }
27
        else
28
        {
29
            hspeed = base_hspeed;
30
            time_speed = 0.25;
31
        }
32
    }
33
}
34
else if (bounces > 0 && vspeed > 0 && (vspeed + y) > bottomy)
35
{
36
    if (fader > 1 && image_index > 9)
37
        fader = 1;
38
    else if (fader > 1.5 && image_index <= 9)
39
        fader = 1.5;
40
    if (split)
41
    {
42
        image_index = 4;
43
        split = false;
44
        var _shard = instance_copy(false);
45
        _shard.x -= 30;
46
        _shard.image_index += 1;
47
        _shard.interval--;
48
        _shard.vspeed += 2;
49
    }
50
    bounces--;
51
    y = bottomy;
52
    base_vspeed = vspeed;
53
    vspeed = 0;
54
    if (bounces > 0)
55
        hspeed = 0;
56
    bouncer = bounce_frames;
57
}
58
else if (bounces > 0)
59
{
60
    vspeed += 0.5;
61
}
62
else
63
{
64
    hspeed = 
scr_movetowards
scr_movetowards

function
scr_movetowards(arg0, arg1, arg2)
{ if (arg0 == arg1) return arg0; else if (arg0 > arg1) return max(arg0 - arg2, arg1); else return min(arg0 + arg2, arg1); } function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0) { scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1); } function scr_obj_movetowards_point(arg0, arg1, arg2) { var _distance = point_distance(x, y, arg0, arg1); if (arg2 >= _distance) { x = arg0; y = arg1; } else { var _direction = point_direction(x, y, arg0, arg1); x += lengthdir_x(arg2, _direction); y += lengthdir_y(arg2, _direction); } }
(hspeed, 0, 0.2);
65
}
66
if (fader <= -60)
67
    instance_destroy();
68
else
69
    image_blend = merge_color(c_black, c_white, clamp01(fader));