Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_shadow_mantle_fire_controller_Step_0

(view raw script w/o annotations or w/e)
1
if (!instance_exists(obj_shadow_mantle_enemy))
2
{
3
    debug_print("saved crash");
4
    exit;
5
}
6
if (_type == 0)
7
{
8
    timer++;
9
    if (timer == 3)
10
    {
11
        if (count < 6)
12
        {
13
            fire = instance_create(x, y, obj_shadow_mantle_fire);
14
            fire.rotator_target = obj_shadow_mantle_enemy.id;
15
            fire.place = 0 + (count * 60) + (6 * count);
16
            fire._type = _type;
17
            timer = 0;
18
            count++;
19
        }
20
        else
21
        {
22
            instance_destroy();
23
        }
24
    }
25
}
26
if (_type == 1)
27
{
28
    timer++;
29
    if (timer == 3)
30
    {
31
        if (count < 6)
32
        {
33
            fire = instance_create(x, y, obj_shadow_mantle_fire);
34
            fire.rotator_target = obj_shadow_mantle_enemy.id;
35
            fire.place = 0 + (count * 60) + (6 * count);
36
            fire._type = _type;
37
            timer = 0;
38
            count++;
39
        }
40
        else
41
        {
42
            with (obj_shadow_mantle_fire)
43
                len_speed = 10;
44
            instance_destroy();
45
        }
46
    }
47
}
48
if (_type == 2)
49
{
50
    timer++;
51
    if (timer == 3)
52
    {
53
        if (count < 6)
54
        {
55
            fire = instance_create(x, y, obj_shadow_mantle_fire);
56
            fire.rotator_target = obj_shadow_mantle_enemy.id;
57
            fire.place = 0 + (count * 60) + (6 * count) + offset;
58
            fire._type = _type;
59
            fire.len = 40;
60
            if (dir == -1)
61
                fire.place_speed = -2;
62
            timer = 0;
63
            count++;
64
        }
65
        else
66
        {
67
            with (obj_shadow_mantle_fire)
68
                con = 1;
69
            instance_destroy();
70
        }
71
    }
72
}
73
if (_type == 3)
74
{
75
    timer++;
76
    if (timer == 3)
77
    {
78
        if (count < 6)
79
        {
80
            fire = instance_create(x, y, obj_shadow_mantle_fire);
81
            fire.rotator_target = obj_shadow_mantle_enemy.id;
82
            fire.place = 0 + (count * 60) + (6 * count) + offset;
83
            fire._type = _type;
84
            fire.len = 40;
85
            if (dir == -1)
86
                fire.place_speed = -2;
87
            timer = 0;
88
            count++;
89
        }
90
        else
91
        {
92
            with (obj_shadow_mantle_fire)
93
                con = 1;
94
            instance_destroy();
95
        }
96
    }
97
}
98
if (_type == 4)
99
{
100
    with (obj_shadow_mantle_fire)
101
    {
102
        if (image_alpha == 1)
103
            image_alpha = 0;
104
        else
105
            image_alpha = 1;
106
    }
107
    timer++;
108
    if (timer == 1 && con2 == 0)
109
    {
110
        if (count < 6)
111
        {
112
            fire = instance_create(x, y, obj_shadow_mantle_fire);
113
            fire.rotator_target = obj_shadow_mantle_enemy.id;
114
            fire.place = offset + (count * 60);
115
            fire._type = _type;
116
            fire.len = 50;
117
            fire.place_speed = 0;
118
            timer = 0;
119
            count++;
120
        }
121
        else
122
        {
123
            with (obj_shadow_mantle_fire)
124
                con = 1;
125
            con2 = 1;
126
        }
127
    }
128
    if (timer == 16)
129
    {
130
        with (obj_shadow_mantle_fire)
131
            image_alpha = 1;
132
        instance_destroy();
133
    }
134
}
135
if (_type == 4.5)
136
{
137
    with (obj_shadow_mantle_fire)
138
    {
139
        if (image_alpha == 1)
140
            image_alpha = 0;
141
        else
142
            image_alpha = 1;
143
    }
144
    timer++;
145
    if (timer == 1 && con2 == 0)
146
    {
147
        if (count < 6)
148
        {
149
            fire = instance_create(x, y, obj_shadow_mantle_fire);
150
            fire.rotator_target = obj_shadow_mantle_enemy.id;
151
            fire.place = offset + (count * 60);
152
            fire._type = _type;
153
            fire.len = 50;
154
            fire.place_speed = 0;
155
            timer = 0;
156
            count++;
157
        }
158
        else
159
        {
160
            with (obj_shadow_mantle_fire)
161
                con = 1;
162
            con2 = 1;
163
        }
164
    }
165
    if (timer == 21)
166
    {
167
        with (obj_shadow_mantle_fire)
168
            image_alpha = 1;
169
        instance_destroy();
170
    }
171
}
172
if (_type == 5)
173
{
174
    with (obj_shadow_mantle_fire)
175
    {
176
        if (image_alpha == 1)
177
            image_alpha = 0;
178
        else
179
            image_alpha = 1;
180
    }
181
    timer++;
182
    if (timer == 2 && con2 == 0)
183
    {
184
        if (count < 6)
185
        {
186
            fire = instance_create(x, y, obj_shadow_mantle_fire);
187
            fire.rotator_target = obj_shadow_mantle_enemy.id;
188
            fire.place = offset + (count * 60);
189
            fire._type = _type;
190
            fire.len = 50;
191
            fire.place_speed = 0;
192
            timer = 0;
193
            count++;
194
        }
195
        else
196
        {
197
            with (obj_shadow_mantle_fire)
198
                con = 1;
199
            con2 = 1;
200
        }
201
    }
202
    if (timer == 10)
203
    {
204
        with (obj_shadow_mantle_fire)
205
            image_alpha = 1;
206
        instance_destroy();
207
    }
208
}
209
if (_type == 6)
210
{
211
    fireballtimer++;
212
    if (fireballtimer > 30)
213
    {
214
        if (fireballcount < 3)
215
        {
216
            snd_stop(snd_board_torch);
217
            snd_play(snd_board_torch);
218
            for (var i = 0; i < 6; i++)
219
            {
220
                var fireball = instance_create(obj_shadow_mantle_enemy.x + 16, obj_shadow_mantle_enemy.y + 16, obj_shadow_mantle_fire3);
221
                fireball.speed = 2;
222
                fireball.direction = (i * 60) + (totalcount * 5);
223
                fireball.gravity_direction = fireball.direction + 180;
224
                fireball.gravity = 0.2333333333333333;
225
                fireball.depth = obj_shadow_mantle_enemy.depth - 10;
226
                fireball.image_speed = 0.25;
227
            }
228
            fireballcount++;
229
            totalcount++;
230
            fireballtimer -= 2;
231
        }
232
    }
233
    if (fireballtimer >= 40)
234
        instance_destroy();
235
}
236
if (_type == 7)
237
{
238
    fireballtimer++;
239
    if (fireballtimer > 30)
240
    {
241
        if (fireballcount < 3)
242
        {
243
            snd_stop(snd_board_torch);
244
            snd_play(snd_board_torch);
245
            for (var i = 0; i < 6; i++)
246
            {
247
                var fireball = instance_create(obj_shadow_mantle_enemy.x + 16, obj_shadow_mantle_enemy.y + 16, obj_shadow_mantle_fire3);
248
                fireball.speed = 2;
249
                fireball.direction = (i * 60) + (totalcount * 5);
250
                fireball.gravity_direction = fireball.direction + 180;
251
                fireball.gravity = 0.3666666666666667;
252
                fireball.depth = obj_mainchara_board.depth - 10;
253
                fireball.image_speed = 0.25;
254
                fireball.activetimer = 18;
255
            }
256
            fireballcount++;
257
            totalcount++;
258
            fireballtimer -= 2;
259
        }
260
    }
261
    if (fireballtimer >= 40)
262
        instance_destroy();
263
}
264
if (_type == 8)
265
{
266
    spin_a += 0.5;
267
    spin_speed = 1.6 + (sin(spin_a / 6) * 1.2);
268
    if (spin_speed < 1.5)
269
        spin_speed = 1.5;
270
    angle += spin_speed;
271
    if (spin_a == 40 || spin_a == 100)
272
        instance_create(x, y, obj_shadow_mantle_bomb_spawn);
273
    if (spin_a == 70)
274
    {
275
        bullet = instance_create(x + 16, y + 29, obj_shadow_mantle_bomb);
276
        bullet.depth = depth - 5;
277
        bullet.targetx = 464;
278
        bullet.targety = 160 + (irandom(2) * 32) + 29;
279
    }
280
    fireballtimer++;
281
    if (fireballtimer > 30 && i_ex(obj_shadow_mantle_enemy))
282
    {
283
        if (fireballcount < 50)
284
        {
285
            snd_stop(snd_board_torch);
286
            snd_play(snd_board_torch);
287
            for (var i = 0; i < 3; i++)
288
            {
289
                var dir = (i * 120) + angle;
290
                var fireball = instance_create(obj_shadow_mantle_enemy.x + 16 + lengthdir_x(24, dir), obj_shadow_mantle_enemy.y + 16 + lengthdir_y(24, dir), obj_shadow_mantle_fire3);
291
                fireball.speed = 0;
292
                fireball.direction = dir;
293
                fireball.gravity_direction = fireball.direction;
294
                fireball.gravity = 0.7;
295
                fireball.depth = obj_mainchara_board.depth - 10;
296
                fireball.image_speed = 0.25;
297
                fireball.activetimer = 10;
298
                fireball._type = 1;
299
            }
300
            fireballcount++;
301
            fireballtimer -= 4;
302
        }
303
    }
304
    if (fireballtimer >= 32)
305
        instance_destroy();
306
}