Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_lancergotchi_Step_0

(view raw script w/o annotations or w/e)
1
var speedrate = 1;
2
if (global.chapter == 3)
3
    speedrate = 2;
4
sleeptimer++;
5
if (movecon == 0 || movecon == 1)
6
{
7
    if (con == 0)
8
    {
9
        if (movecon == 0)
10
        {
11
            hspeed = -4 * speedrate;
12
            sprite_index = lsprite;
13
        }
14
        if (movecon == 1)
15
        {
16
            hspeed = 4 * speedrate;
17
            sprite_index = rsprite;
18
        }
19
        if ((camerax() + 320) > x && hspeed < 0)
20
            hspeed *= -1;
21
        if ((camerax() + 320) < x && hspeed > 0)
22
            hspeed *= -1;
23
        con = 1;
24
        contimer = 0;
25
        contimermax = 30 / speedrate;
26
        flipchance = choose(0, 1, 2);
27
        if (flipchance == 2)
28
        {
29
            sprite_index = choose(dsprite, spr_lancer_ut_flip);
30
            image_speed = 0.25;
31
        }
32
    }
33
    if (con == 1)
34
    {
35
        stop = 0;
36
        contimer++;
37
        if (x < minx)
38
            stop = 1;
39
        if (x > maxx)
40
            stop = 1;
41
        if (contimer > contimermax)
42
            stop = 1;
43
        if (stop == 1)
44
        {
45
            hspeed = 0;
46
            sprite_index = choose(dsprite, dsprite, spr_lancer_ut_flip);
47
            image_speed = 0.25;
48
            alarm[0]
 = 30 / speedrate;
gml_Object_obj_lancergotchi_Alarm_0.gml

remmovecon = movecon; movecon = choose(0, 1, 2, 4); if (movecon == remmovecon) movecon = choose(0, 1, 2, 4); con = 0; if (sleeptimer >= 900) movecon = 10; if (global.chapter == 3 && global.fighting == 1) { movecon = choose(0, 1, 4, 4); if (sleeptimer >= threshold) { movecon = 7; sleeptimer = 0; threshold = choose(90, 120); } }
49
            con = 2;
50
        }
51
    }
52
}
53
if (movecon == 2 || movecon == 3)
54
{
55
    if (con == 0)
56
    {
57
        if (movecon == 3)
58
        {
59
            vspeed = -8;
60
            gravity = 1;
61
            y -= 4;
62
            hspeed = choose(0, 3, 6);
63
        }
64
        if ((camerax() + 320) > x && hspeed < 0)
65
            hspeed *= -1;
66
        if ((camerax() + 320) < x && hspeed > 0)
67
            hspeed *= -1;
68
        spincount = 0;
69
        spintimer = 0;
70
        spinmax = 8;
71
        con = 1;
72
        sprite_index = dsprite;
73
    }
74
    if (con == 1)
75
    {
76
        if (y >= maxy)
77
        {
78
            gravity = 0;
79
            vspeed = 0;
80
        }
81
        if (x <= minx)
82
        {
83
            x += 4;
84
            hspeed = -hspeed;
85
        }
86
        if (x >= maxx)
87
        {
88
            x -= 4;
89
            hspeed = -hspeed;
90
        }
91
        spintimer++;
92
        if (spintimer >= 3)
93
        {
94
            if (sprite_index == dsprite)
95
                sprite_index = lsprite;
96
            else if (sprite_index == lsprite)
97
                sprite_index = usprite;
98
            else if (sprite_index == usprite)
99
                sprite_index = rsprite;
100
            else if (sprite_index == rsprite)
101
                sprite_index = dsprite;
102
            spincount++;
103
            spintimer = 0;
104
        }
105
        if (spincount >= 8)
106
        {
107
            hspeed = 0;
108
            vspeed = 0;
109
            gravity = 0;
110
            con = 2;
111
            alarm[0]
 = 30;
gml_Object_obj_lancergotchi_Alarm_0.gml

remmovecon = movecon; movecon = choose(0, 1, 2, 4); if (movecon == remmovecon) movecon = choose(0, 1, 2, 4); con = 0; if (sleeptimer >= 900) movecon = 10; if (global.chapter == 3 && global.fighting == 1) { movecon = choose(0, 1, 4, 4); if (sleeptimer >= threshold) { movecon = 7; sleeptimer = 0; threshold = choose(90, 120); } }
112
        }
113
    }
114
}
115
if (movecon == 4)
116
{
117
    if (con == 0)
118
    {
119
        sprite_index = spr_ch3_dw_shutta_lancer_wave_notongue;
120
        if (fake)
121
            sprite_index = spr_ch3_dw_shutta_lancer_wave_notongue_fake;
122
        image_index = 0;
123
        image_speed = 0.5;
124
        wavetimer = 0;
125
        con = 1;
126
        if (global.chapter == 3)
127
            image_speed = 0;
128
    }
129
    if (con == 1)
130
    {
131
        if (global.chapter == 3)
132
        {
133
            if (wavetimer < 6)
134
                image_index = 1;
135
            if (wavetimer == 6)
136
            {
137
                image_index = 2;
138
                image_speed = 0.5;
139
            }
140
        }
141
        wavetimer++;
142
        if (wavetimer >= 16)
143
            image_speed = 0;
144
        if (wavetimer >= 30)
145
        {
146
            alarm[0]
 = 2;
gml_Object_obj_lancergotchi_Alarm_0.gml

remmovecon = movecon; movecon = choose(0, 1, 2, 4); if (movecon == remmovecon) movecon = choose(0, 1, 2, 4); con = 0; if (sleeptimer >= 900) movecon = 10; if (global.chapter == 3 && global.fighting == 1) { movecon = choose(0, 1, 4, 4); if (sleeptimer >= threshold) { movecon = 7; sleeptimer = 0; threshold = choose(90, 120); } }
147
            con = 2;
148
        }
149
    }
150
}
151
if (movecon == 7)
152
{
153
    if (con == 0)
154
    {
155
        jumptimer = 0;
156
        sprite_index = spr_ch3_dw_shutta_lancer_wave_notongue;
157
        if (fake)
158
            sprite_index = spr_ch3_dw_shutta_lancer_wave_notongue_fake;
159
        image_speed = 0;
160
        image_index = 1;
161
        con = 1;
162
    }
163
    if (con == 1)
164
    {
165
        if (x >= maxx)
166
        {
167
            hspeed = 0;
168
            x -= 2;
169
        }
170
        if (x <= minx)
171
        {
172
            hspeed = 0;
173
            x += 2;
174
        }
175
        jumptimer++;
176
        if (jumptimer >= 10)
177
        {
178
            con = 2;
179
            jumptimer = 0;
180
            vspeed = -6 - random(8);
181
            hspeed = random_range(-4, 4);
182
            gravity = 0.5 + random(0.25);
183
            sprite_index = dsprite;
184
            spintimer = 0;
185
            spincount = 0;
186
        }
187
    }
188
    if (con == 2)
189
    {
190
        if (x >= maxx)
191
        {
192
            hspeed = 0;
193
            x -= 2;
194
        }
195
        if (x <= minx)
196
        {
197
            hspeed = 0;
198
            x += 2;
199
        }
200
        spintimer++;
201
        if (spintimer >= 3)
202
        {
203
            if (sprite_index == dsprite)
204
                sprite_index = lsprite;
205
            else if (sprite_index == lsprite)
206
                sprite_index = usprite;
207
            else if (sprite_index == usprite)
208
                sprite_index = rsprite;
209
            else if (sprite_index == rsprite)
210
                sprite_index = dsprite;
211
            spincount++;
212
            spintimer = 0;
213
        }
214
        if (vspeed >= 0)
215
        {
216
            hspeed = 0;
217
            vspeed = 0;
218
            gravity = 0;
219
            sprite_index = spr_ch3_dw_shutta_lancer_tongue;
220
            if (fake)
221
                sprite_index = spr_ch3_dw_shutta_lancer_tongue_fake;
222
            con = 3;
223
        }
224
    }
225
    if (con == 3)
226
    {
227
        jumptimer++;
228
        if (jumptimer >= 12)
229
        {
230
            jumptimer = 0;
231
            gravity = 1;
232
            sprite_index = dsprite;
233
            con = 4;
234
        }
235
    }
236
    if (con == 4)
237
    {
238
        if (y >= maxy)
239
        {
240
            hspeed = 0;
241
            vspeed = 0;
242
            gravity = 0;
243
            con = 5;
244
            alarm[0]
 = 3;
gml_Object_obj_lancergotchi_Alarm_0.gml

remmovecon = movecon; movecon = choose(0, 1, 2, 4); if (movecon == remmovecon) movecon = choose(0, 1, 2, 4); con = 0; if (sleeptimer >= 900) movecon = 10; if (global.chapter == 3 && global.fighting == 1) { movecon = choose(0, 1, 4, 4); if (sleeptimer >= threshold) { movecon = 7; sleeptimer = 0; threshold = choose(90, 120); } }
245
        }
246
    }
247
}
248
if (movecon == 10)
249
{
250
    sprite_index = spr_lancer_sleep;
251
    image_speed = 0.1;
252
    speed = 0;
253
    hspeed = 0;
254
    gravity = 0;
255
}
256
if (movecon == 11)
257
{
258
    sprite_index = spr_cutscene_20_lancer_stone;
259
    image_speed = 0;
260
    speed = 0;
261
    hspeed = 0;
262
    gravity = 0;
263
}
264
if (global.fighting != 1)
265
{
266
    if (global.submenu != 4 || global.interact != 5)
267
        instance_destroy();
268
}
269
delaydeath--;
270
if (delaydeath == 0)
271
    instance_destroy();
272
if (gravity > 0 && vspeed > 0 && (y + vspeed) > maxy)
273
{
274
    gravity = 0;
275
    vspeed = 0;
276
    y = maxy;
277
}