Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_floorswitch_Step_0

(view raw script w/o annotations or w/e)
1
if (init == 0)
2
{
3
    if (custdepth != -1)
4
        depth = custdepth;
5
    sprite_index = sprite;
6
    if (globalflag != -1)
7
    {
8
        if (global.flag[globalflag])
9
        {
10
            pressed = 1;
11
            pushonce = true;
12
        }
13
    }
14
    init = 1;
15
}
16
if (pressed == 0)
17
{
18
    image_index = 0;
19
    var dopress = false;
20
    if (place_meeting(x, y, obj_mainchara))
21
        dopress = true;
22
    if (actorpressable)
23
    {
24
        if (place_meeting(x, y, obj_actor))
25
            dopress = true;
26
    }
27
    if (caterpressable)
28
    {
29
        if (place_meeting(x, y, obj_caterpillarchara) || place_meeting(x, y, obj_caterpillar_generic))
30
            dopress = true;
31
    }
32
    if (dopress)
33
    {
34
        if (globalflag != -1)
35
            global.flag[globalflag] = 1;
36
        switch (actsound)
37
        {
38
            case 0:
39
            default:
40
                snd_play(snd_spearappear, 0.6, 1.2);
41
                snd_play(snd_spearappear, 0.8, 1.4);
42
                snd_play(snd_noise, 0.6);
43
                break;
44
            case -1:
45
                break;
46
            case 3:
47
                snd_play(snd_churchbell_long, 1, 1.1);
48
                break;
49
        }
50
        presscount++;
51
        event_user(0);
52
        pressed = 1;
53
    }
54
}
55
if (pressed)
56
{
57
    image_index = 1;
58
    if (!pushonce)
59
    {
60
        var stillpressed = false;
61
        if (place_meeting(x, y, obj_mainchara))
62
            stillpressed = true;
63
        if (actorpressable)
64
        {
65
            if (place_meeting(x, y, obj_actor))
66
                stillpressed = true;
67
        }
68
        if (caterpressable)
69
        {
70
            if (place_meeting(x, y, obj_caterpillarchara) || place_meeting(x, y, obj_caterpillar_generic))
71
                stillpressed = true;
72
        }
73
        if (!stillpressed)
74
        {
75
            switch (actsound)
76
            {
77
                case 0:
78
                default:
79
                    snd_play(snd_noise, 1, 0.8);
80
                    break;
81
            }
82
            pressed = false;
83
        }
84
    }
85
}