Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_traintrack_switch_Step_2

(view raw script w/o annotations or w/e)
1
if (pressed == 0)
2
{
3
    var _waiting = false;
4
    with (obj_traintrack_moving_parent)
5
    {
6
        if (con != 0)
7
            _waiting = true;
8
    }
9
    if (!_waiting && (place_meeting(x, y, obj_homealone_heart) || place_meeting(x, y, obj_train_snowball)))
10
        pressed = 1;
11
}
12
else if (pressed == 1)
13
{
14
    pressed = 2;
15
    snd_play_pitch(snd_noise, 1.2);
16
}
17
else if (pressed == -1 || pressed == -2)
18
{
19
    pressed = 0;
20
    snd_play_pitch(snd_noise, 0.8);
21
}
22
else if (pressed == 2)
23
{
24
    var _waiting = false;
25
    with (obj_traintrack_moving_parent)
26
    {
27
        if (con != 0)
28
            _waiting = true;
29
    }
30
    if (!_waiting && !place_meeting(x, y, obj_homealone_heart) && !place_meeting(x, y, obj_train_snowball))
31
    {
32
        if (toggle)
33
            pressed = -2;
34
        else
35
            pressed = -1;
36
    }
37
}
38
if (pressed == 0)
39
    image_index = 0;
40
else
41
    image_index = 1;