Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_music_wobbler_Step_0

(view raw script w/o annotations or w/e)
1
if (!snd_is_playing(global.currentsong[1]))
2
{
3
    global.currentsong[0] = snd_init("castletown.ogg");
4
    global.currentsong[1] = mus_loop_ext(global.currentsong[0], 1, 1);
5
}
6
if (auto)
7
{
8
    if (init == 0)
9
    {
10
        init = 1;
11
        active = true;
12
        strength = 0;
13
        timer = -1200;
14
    }
15
    if (timer < 180)
16
        timer++;
17
    strength = remap_clamped(320, 640, 0, 0.1, camerax()) * max(0, timer / 180);
18
}
19
if (
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
() && sunkus_kb_check_pressed(77))
20
{
21
    if (!snd_is_playing(global.currentsong[1]))
22
    {
23
        global.currentsong[0] = snd_init("castletown.ogg");
24
        global.currentsong[1] = mus_loop_ext(global.currentsong[0], 1, 1);
25
    }
26
    else
27
    {
28
        active = !active;
29
    }
30
    siner = 0;
31
}
32
if (active && snd_is_playing(global.currentsong[1]))
33
{
34
    siner++;
35
    if (strength < 30 && !auto)
36
        strength += 0.5;
37
    snd_pitch(global.currentsong[1], 1 + (sin(siner / 4) * 0.05 * (strength / 30)));
38
}
39
if (!active && strength > 0)
40
{
41
    strength -= 3;
42
    snd_pitch(global.currentsong[1], 1 + (sin(siner / 4) * 0.05 * (strength / 30)));
43
}