Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_pushableblock_board_Step_0

(view raw script w/o annotations or w/e)
1
scr_depth_board
scr_depth_board

function
scr_depth_board()
{ depth = 1000000 - ((y * 10) + ((sprite_height - sprite_yoffset) * 10)); } function scr_board_depth() {
scr_depth_board();
}
();
2
if (init == 0)
3
{
4
    if (sprite_index != spr_ralsei_board_stoolforme)
5
        sprite_index = custom_sprite;
6
    if (sprite_index == spr_ralsei_board_stoolforme)
7
    {
8
        pushsound = 131;
9
        stopsnd = 131;
10
    }
11
    if (extflag == "rockSecretBlockTrig")
12
        sprite_index = spr_board_rocksecret_moveableRock;
13
    if (extflag == "b2enrichmentenclosure")
14
        pushonce = true;
15
    init = 1;
16
    if (place_meeting(x, y, obj_board_controller.kris_object))
17
        jello = true;
18
    if (sprite_index != spr_ralsei_board_stoolforme)
19
        mp_grid_add_cell(global.grid, x / 32, y / 32);
20
}
21
if (jello == true)
22
{
23
    if (!place_meeting(x, y, obj_board_controller.kris_object))
24
        jello = false;
25
}
26
if (active == 1)
27
{
28
    var _xx, _yy;
29
    if (con == 1)
30
    {
31
        _xx = 0;
32
        _yy = 0;
33
        if (dir == "right")
34
            _xx = 32;
35
        if (dir == "left")
36
            _xx = -32;
37
        if (dir == "down")
38
            _yy = 32;
39
        if (dir == "up")
40
            _yy = -32;
41
        x += _xx;
42
        y += _yy;
43
        var checker = instance_place(x, y, obj_board_solid);
44
        if (blocked == true)
45
            checker = 99;
46
        if (checker == -4)
47
            checker = instance_place(x, y, obj_board_solidenemy);
48
        if (blockedbyplayer && checker == -4)
49
            checker = instance_place(x, y, obj_mainchara_board);
50
        if (i_ex(checker))
51
        {
52
            if ((checker.image_alpha == 0 || checker.visible == false) && checker.object_index == obj_mainchara_board)
53
                checker = -4;
54
        }
55
        if (!freeroam)
56
        {
57
            if (checker == -4)
58
                checker = collision_rectangle(132, 68, 508, 92, object_index, true, false);
59
            if (checker == -4)
60
                checker = collision_rectangle(132, 292, 508, 316, object_index, true, false);
61
            if (checker == -4)
62
                checker = collision_rectangle(132, 68, 156, 316, object_index, true, false);
63
            if (checker == -4)
64
                checker = collision_rectangle(484, 68, 508, 316, object_index, true, false);
65
        }
66
        if (checker != -4)
67
        {
68
            snd_play_pitch(stopsnd, 1.2);
69
            con = 99;
70
        }
71
        else
72
        {
73
            con = 2;
74
            for (var i = 0; i < 3; i++)
75
                snd_play_delay(pushsound, 1 + (2 * i), 1, 1.5 + (i / 20));
76
        }
77
        x -= _xx;
78
        y -= _yy;
79
    }
80
    if (con == 2)
81
    {
82
        
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpvar_respect() { if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
___lerpvar.respectglobalinteract = true; return ___lerpvar; }
("x", x, x + _xx, pushspeed);
83
        
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpvar_respect() { if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
___lerpvar.respectglobalinteract = true; return ___lerpvar; }
("y", y, y + _yy, pushspeed);
84
        pushcount++;
85
        timer = 0;
86
        con = 3;
87
    }
88
    if (con == 3)
89
    {
90
        timer++;
91
        if (place_meeting(x, y, obj_board_event_push1_blocktrigger) || place_meeting(x, y, obj_board_event_push2_blocktrigger))
92
        {
93
            if (pushonce == 0)
94
            {
95
                pushcount = 1;
96
                pushonce = 1;
97
            }
98
        }
99
        if (timer >= pushspeed)
100
        {
101
            waspushed++;
102
            con = 99;
103
        }
104
    }
105
    if (con == 99)
106
    {
107
        if (pushonce == 0)
108
            con = 0;
109
        if (pushonce == 1 && pushcount != 0)
110
            con = 199;
111
        else
112
            con = 0;
113
        if (sprite_index != spr_ralsei_board_stoolforme)
114
            mp_grid_add_cell(global.grid, x / 32, y / 32);
115
        global.interact = 0;
116
        with (obj_dw_b3bs_mysterypuzzle)
117
            update = true;
118
        with (obj_dw_b3bs_extrapuzzle)
119
            update = true;
120
        with (obj_board_enemy_deer)
121
            blockinteract = 0;
122
    }
123
}
124
else if (daddy != 0 && abandonmentissues)
125
{
126
    if (!(x >= 128 && x <= 512 && y >= 64 && y <= 320))
127
        instance_destroy();
128
}
129
if (ralseipush == true)
130
{
131
    ralseipush = false;
132
    var pusher = -4;
133
    with (obj_mainchara_board)
134
    {
135
        if (name == "ralsei")
136
            pusher = id;
137
    }
138
    if (con == 0)
139
    {
140
        x = floor(x / 32) * 32;
141
        y = floor(y / 32) * 32;
142
        switch (pusher.facing)
143
        {
144
            case 0:
145
                dir = "down";
146
                break;
147
            case 1:
148
                dir = "right";
149
                break;
150
            case 2:
151
                dir = "up";
152
                break;
153
            case 3:
154
                dir = "left";
155
                break;
156
        }
157
        global.interact = 1;
158
        con = 1;
159
        mp_grid_clear_cell(global.grid, x / 32, y / 32);
160
    }
161
}