Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_board_susiedig_fakesusie_Step_0

(view raw script w/o annotations or w/e)
1
if (kris == 0)
2
{
3
    with (obj_mainchara_board)
4
    {
5
        if (name == "kris")
6
            other.kris = id;
7
    }
8
}
9
if (ralsei == 0)
10
{
11
    with (obj_mainchara_board)
12
    {
13
        if (name == "ralsei")
14
            other.ralsei = id;
15
    }
16
}
17
if (global.interact == 0)
18
{
19
    image_speed = speed / 4;
20
    if (con == 0)
21
    {
22
        targetspot = instance_find(obj_board_susiedig_groundspots, irandom(instance_number(obj_board_susiedig_groundspots) - 1));
23
        if (targetspot != -4)
24
        {
25
            tx = targetspot.x;
26
            ty = targetspot.y - 16;
27
            timer = 0;
28
            con = 1;
29
        }
30
        else
31
        {
32
            con = 99;
33
        }
34
    }
35
    if (con == 1)
36
    {
37
        if (x > tx)
38
        {
39
            x -= 4;
40
            facing = 3;
41
            image_speed = 0.25;
42
        }
43
        if (x < tx)
44
        {
45
            facing = 1;
46
            x += 4;
47
            image_speed = 0.25;
48
        }
49
        if (x == tx)
50
        {
51
            image_speed = 0;
52
            image_index = 0;
53
            timer++;
54
            if (timer >= 3)
55
            {
56
                timer = 0;
57
                con = 2;
58
            }
59
        }
60
    }
61
    if (con == 2)
62
    {
63
        if (y > ty)
64
        {
65
            facing = 2;
66
            image_speed = 0.25;
67
            y -= 4;
68
        }
69
        if (y < ty)
70
        {
71
            facing = 0;
72
            image_speed = 0.25;
73
            y += 4;
74
        }
75
        if (y == ty)
76
        {
77
            facing = 0;
78
            image_speed = 0;
79
            image_index = 0;
80
            timer++;
81
            if (timer >= 3)
82
            {
83
                timer = 0;
84
                con = 3;
85
            }
86
        }
87
    }
88
    if (con == 3)
89
    {
90
        var pickuptime = 3;
91
        var holdtime = 7;
92
        var waittime = 2;
93
        timer++;
94
        if (timer == 1)
95
        {
96
            facing = 99;
97
            sprite_index = spr_board_susie_dig;
98
            snd_play(snd_grab);
99
            image_index = 0;
100
        }
101
        if (timer == pickuptime)
102
        {
103
            image_index = 1;
104
            if (instance_number(obj_board_susiedig_groundspots) == 1)
105
            {
106
                dugup = instance_create(room_width, room_height, obj_board_pickup);
107
                with (dugup)
108
                {
109
                    snd_play(snd_item);
110
                    type = "key";
111
                    con = 2;
112
                    image_index = sprite_get_number(sprite_index) - 1;
113
                    image_alpha = 1;
114
                    image_speed = 0;
115
                    
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();
}
();
116
                    with (obj_b1susiedig)
117
                        endsong = 1;
118
                }
119
            }
120
            else
121
            {
122
                dugup = instance_create(room_width, room_height, obj_board_bomb);
123
            }
124
            dugup.visible = 0;
125
            bombcount++;
126
            throwobject = instance_create(x, y, obj_board_grabobject);
127
            throwobject.ignoreplayer = 1;
128
            throwobject.grabdaddy = id;
129
            throwobject.grabbedid = dugup;
130
            safe_delete(targetspot);
131
        }
132
        if (timer == (pickuptime + 1))
133
        {
134
            holding = 1;
135
            var ydif = y - kris.y;
136
            var xdif = x - kris.x;
137
            if (abs(ydif) > abs(xdif))
138
            {
139
                if (ydif < 0)
140
                    facing = 0;
141
                else
142
                    facing = 2;
143
            }
144
            else if (xdif < 0)
145
            {
146
                facing = 1;
147
            }
148
            else
149
            {
150
                facing = 3;
151
            }
152
        }
153
        if (timer == (pickuptime + 1 + holdtime))
154
        {
155
            holding = 0;
156
            snd_play(snd_board_throw);
157
            throwobject.con = 1;
158
        }
159
        if (timer == (pickuptime + 1 + holdtime + waittime))
160
            con = 0;
161
    }
162
    
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();
}
();
163
    if (facing == 0)
164
        sprite_index = spr_board_susie_walk_down;
165
    if (facing == 3)
166
        sprite_index = spr_board_susie_walk_left;
167
    if (facing == 1)
168
        sprite_index = spr_board_susie_walk_right;
169
    if (facing == 2)
170
        sprite_index = spr_board_susie_walk_up;
171
    if (holding == 1)
172
    {
173
        if (facing == 0)
174
            sprite_index = spr_board_susie_walk_down_armsup;
175
        if (facing == 3)
176
            sprite_index = spr_board_susie_walk_left_armsup;
177
        if (facing == 1)
178
            sprite_index = spr_board_susie_walk_right_armsup;
179
        if (facing == 2)
180
            sprite_index = spr_board_susie_walk_up_armsup;
181
    }
182
    if (manageralsei == false)
183
    {
184
        if (ralsei.iframes > 0)
185
        {
186
            manageralsei = true;
187
            ralsei.follow = false;
188
            ralsei.canfreemove = true;
189
            raltimer = 15;
190
        }
191
    }
192
    if (manageralsei)
193
    {
194
        raltimer++;
195
        if ((raltimer % 15) == 0)
196
        {
197
            
scr_pathfind_end
scr_pathfind_end

function
scr_pathfind_end(arg0)
{ with (obj_mainchara_board) { if (name == arg0) { path_end(); path_target_x = -1; path_target_y = -1; is_moving_timer = 0; is_moving = false; } } }
("ralsei");
198
            var _targx = irandom_range(1, 9);
199
            var _targy = irandom_range(1, 6);
200
            if (abs(_targx - ralsei.x) < 32)
201
                _targx += (32 * choose(-1, 1));
202
            if (abs(_targy - ralsei.y) < 32)
203
                _targy += (32 * choose(-1, 1));
204
            with (obj_board_bomb)
205
            {
206
                if (abs(x - _targx) < 32)
207
                {
208
                    _targx += (32 * choose(-1, 1));
209
                    debug_message("x=bombx");
210
                }
211
                if (abs(y - _targy) < 32)
212
                {
213
                    _targy += (32 * choose(-1, 1));
214
                    debug_message("y=bomby");
215
                }
216
            }
217
            
scr_pathfind_to_point
scr_pathfind_to_point

function
scr_pathfind_to_point(arg0, arg1, arg2)
{ var __destx = arg1 + 16; var __desty = arg2 + 16; if (arg1 < 12 && arg2 < 8) { __destx = 128 + (32 * arg1) + 16; __desty = 64 + (32 * arg2) + 16; } with (obj_mainchara_board) { if (name == arg0) { path_end(); is_moving_timer = 0; is_moving = true; path_target_x = __destx; path_target_y = __desty; follow = false; if (argument_count == 4) { if (argument3 != -1) path_end_facing = argument3; } if (argument_count == 5) { if (argument4 != -1) allow_diagonals = argument4; } } } }
("ralsei", _targx, _targy);
218
        }
219
    }
220
}
221
else
222
{
223
    image_speed = 0;
224
}