Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_darkness_sound_bullet_Step_0

(view raw script w/o annotations or w/e)
1
if (init == 0)
2
{
3
    destroyonhit = false;
4
    init = 1;
5
    image_xscale = 15;
6
    image_yscale = 15;
7
    if (dir == 8)
8
    {
9
        y_change = -1;
10
        sound = 542;
11
    }
12
    else if (dir == 6)
13
    {
14
        x_change = 1;
15
        sound = 10;
16
    }
17
    else if (dir == 2)
18
    {
19
        y_change = 1;
20
        sound = 503;
21
    }
22
    else if (dir == 4)
23
    {
24
        x_change = -1;
25
        sound = 59;
26
    }
27
}
28
timer++;
29
if (timer == delay && con < 3)
30
{
31
    con++;
32
    if (con <= 3)
33
    {
34
        timer = 0;
35
        var _dist = (3 - con) * 75;
36
        if (con == 3)
37
        {
38
            lightsource = instance_create(x + (x_change * 30), y + (y_change * 30), obj_lightsource_static);
39
            x += (x_change * 70);
40
            y += (y_change * 70);
41
            var _snd = snd_play(sound);
42
            lightsource.visible = false;
43
            lightsource.radius = 60;
44
            active = true;
45
        }
46
        else if (y_change != 0)
47
        {
48
            var _snd = snd_play(sound);
49
            snd_pitch(_snd, 1 - ((3 - con) * y_change * 0.1));
50
        }
51
        else
52
        {
53
            audio_play_sound_at(sound, x + (_dist * x_change), y + (_dist * y_change), 0, 100, 300, 1, false, 1);
54
        }
55
    }
56
}
57
if (con == 3)
58
{
59
    if (timer == 1)
60
        lightsource.radius = 70;
61
    else if (timer == 2)
62
        lightsource.radius = 75;
63
    else if (timer > 2)
64
        lightsource.radius = lerp(75, 0, 
scr_ease_in
scr_ease_in

function
scr_ease_in(arg0, arg1)
{ if (arg1 < -3 || arg1 > 7) return arg0; switch (arg1) { case -3: return ease_in_bounce(arg0, 0, 1, 1); case -2: return ease_in_elastic(arg0, 0, 1, 1); case -1: var _s = 1.70158; return arg0 * arg0 * (((_s + 1) * arg0) - _s); case 0: return arg0; case 1: return -cos(arg0 * 1.5707963267948966) + 1; case 6: return power(2, 10 * (arg0 - 1)); case 7: return -(sqrt(1 - sqr(arg0)) - 1); default: return power(arg0, arg1); } }
((timer - 2) / 20, 1));
65
    if (timer == 4)
66
        active = false;
67
    if (timer == 30)
68
        instance_destroy();
69
}