Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_fmartlet_spawner_gauntlet_Step_0

(view raw script w/o annotations or w/e)
1
if (live_call())
2
    return global.live_result;
3
var battle_box = 3154;
4
var heart = obj_heart_battle_fighting_parent;
5
var martlet_fly_x_start = 840;
6
var martlet_fly_y_target = 120;
7
var martlet_fly_y_target_bottom = 460;
8
switch (scene)
9
{
10
    case 0:
11
        with (obj_martlet_final_base)
12
        {
13
            image_angle = 0;
14
            x = lerp(x, 320, 0.25);
15
            if (image_index >= 8)
16
            {
17
                if (vspeed > -60)
18
                    vspeed -= 15;
19
            }
20
            if (image_index >= (image_number - 1))
21
            {
22
                image_speed = 0;
23
                image_index = image_number - 1;
24
            }
25
            if (y < -300)
26
            {
27
                vspeed = 0;
28
                other.scene++;
29
            }
30
        }
31
        break;
32
    case 1:
33
        cutscene_wait(1);
34
        break;
35
    case 2:
36
        if (scr_battle_box_resize_midfight
scr_battle_box_resize_midfight

function scr_battle_box_resize_midfight() { if (instance_exists(obj_dialogue_box_battle_transformation_any)) { with (obj_dialogue_box_battle_transformation_any) { battle_box_resize_midfight = true; battle_box_target_xscale = argument[0] / sprite_get_width(sprite_index); battle_box_target_yscale = argument[1] / sprite_get_height(sprite_index); if (argument_count > 2) { battle_box_target_x = argument[2]; battle_box_target_y = argument[3]; } if (abs(image_xscale - battle_box_target_xscale) < 0.01 && abs(image_yscale - battle_box_target_yscale) < 0.01 && abs(x - battle_box_target_x) < 0.1 && abs(y - battle_box_target_y) < 0.1) { var box = 3154; global.attack_surface_width = box.sprite_width - 8; global.attack_surface_height = box.sprite_height - 8; global.attack_surface_x = box.x - (global.attack_surface_width * 0.5); global.attack_surface_y = box.y - (global.attack_surface_height * 0.5); if (surface_exists(global.attack_surface)) global.attack_surface = surface_create(global.attack_surface_width, global.attack_surface_height); return true; } } } else { return false; } }
(140, 140, 320, 240))
37
            cutscene_advance();
38
        break;
39
    case 3:
40
        can_attack = true;
41
        cutscene_advance();
42
        break;
43
    case 4:
44
        break;
45
    case 5:
46
        if (scr_battle_box_resize_midfight
scr_battle_box_resize_midfight

function scr_battle_box_resize_midfight() { if (instance_exists(obj_dialogue_box_battle_transformation_any)) { with (obj_dialogue_box_battle_transformation_any) { battle_box_resize_midfight = true; battle_box_target_xscale = argument[0] / sprite_get_width(sprite_index); battle_box_target_yscale = argument[1] / sprite_get_height(sprite_index); if (argument_count > 2) { battle_box_target_x = argument[2]; battle_box_target_y = argument[3]; } if (abs(image_xscale - battle_box_target_xscale) < 0.01 && abs(image_yscale - battle_box_target_yscale) < 0.01 && abs(x - battle_box_target_x) < 0.1 && abs(y - battle_box_target_y) < 0.1) { var box = 3154; global.attack_surface_width = box.sprite_width - 8; global.attack_surface_height = box.sprite_height - 8; global.attack_surface_x = box.x - (global.attack_surface_width * 0.5); global.attack_surface_y = box.y - (global.attack_surface_height * 0.5); if (surface_exists(global.attack_surface)) global.attack_surface = surface_create(global.attack_surface_width, global.attack_surface_height); return true; } } } else { return false; } }
(652, 492, 320, 240))
47
            cutscene_advance();
48
        break;
49
    case 6:
50
        with (obj_martlet_final_base)
51
        {
52
            hspeed = -14;
53
            var y_diff = martlet_fly_x_start - 320;
54
            var y_diff_current = x - 320;
55
            y = martlet_fly_y_target + (90 * (y_diff_current / y_diff));
56
            image_angle = -10 + (40 * (y_diff_current / y_diff));
57
            if (image_alpha < 0.5)
58
                image_alpha += 0.1;
59
            if (image_index >= (image_number - 1))
60
            {
61
                image_index = image_number - 1;
62
                image_speed = 0;
63
            }
64
            if (x <= 280)
65
            {
66
                hspeed = 0;
67
                other.scene += 1;
68
                sprite_index = spr_martlet_final_fly_turn;
69
                image_index = 0;
70
                image_speed = 1;
71
            }
72
        }
73
        break;
74
    case 7:
75
        with (obj_martlet_final_base)
76
        {
77
            if (image_index >= (image_number - 1))
78
            {
79
                image_index = image_number - 1;
80
                image_speed = 0;
81
            }
82
            if (image_index >= 3)
83
            {
84
                image_xscale += 0.01;
85
                image_yscale = image_xscale;
86
                if (image_xscale < 1)
87
                {
88
                    y = martlet_fly_y_target + (((image_xscale - 0.5) / 0.5) * (martlet_fly_y_target_bottom - martlet_fly_y_target));
89
                    if (y < martlet_fly_y_target_bottom)
90
                        y += 2;
91
                }
92
                else
93
                {
94
                    if (!instance_exists(obj_fmartlet_collision_mask_martlet_fly))
95
                        instance_create_depth(obj_martlet_final_base.x, obj_martlet_final_base.y, -100, obj_fmartlet_collision_mask_martlet_fly);
96
                    if (image_alpha < 1)
97
                        image_alpha += 0.1;
98
                    else
99
                        depth = -1000;
100
                    vspeed -= 2;
101
                    hspeed += (other.martlet_fly_side * 2);
102
                    image_angle -= (other.martlet_fly_side * 2);
103
                    if (y < -180)
104
                    {
105
                        vspeed = 0;
106
                        other.scene++;
107
                    }
108
                }
109
            }
110
            else
111
            {
112
                y = lerp(y, martlet_fly_y_target, 0.1);
113
            }
114
            x = lerp(x, 320, 0.1);
115
            image_angle = lerp(image_angle, 0, 0.1);
116
            if (abs(x - 320) < 1)
117
                x = 320;
118
        }
119
        break;
120
    case 8:
121
        cutscene_wait(0.5);
122
        break;
123
    case 9:
124
        instance_destroy(obj_fmartlet_collision_mask_martlet_fly);
125
        instance_destroy();
126
        with (obj_martlet_final_base)
127
        {
128
            martlet_sprites_reset = true;
129
            y = martlet_y_target;
130
            x = 320;
131
            depth = 10;
132
            hspeed = 0;
133
        }
134
        break;
135
}
136
if (can_attack == true)
137
{
138
    if (attack_variant == 0)
139
    {
140
        switch (attack_tick)
141
        {
142
            case 30:
143
                var attack_instance = instance_create_depth(battle_box.bbox_right + 40, battle_box.y, -100, obj_martlet_attack_splitting_feather);
144
                attack_instance.x_target_override = battle_box.bbox_left - 20;
145
                attack_instance.y_target_override = battle_box.y;
146
                break;
147
            case 44:
148
                var attack_instance = instance_create_depth(battle_box.bbox_right + 40, battle_box.bbox_top - 40, -100, obj_martlet_attack_splitting_feather);
149
                attack_instance.x_target_override = battle_box.x;
150
                attack_instance.y_target_override = battle_box.y;
151
                break;
152
            case 58:
153
                var attack_instance = instance_create_depth(battle_box.bbox_left - 40, battle_box.bbox_top - 40, -100, obj_martlet_attack_splitting_feather);
154
                attack_instance.x_target_override = heart.x;
155
                attack_instance.y_target_override = heart.y;
156
                break;
157
            case 72:
158
                var attack_instance = instance_create_depth(battle_box.bbox_left - 40, battle_box.bbox_top + 20, -100, obj_martlet_attack_splitting_feather);
159
                attack_instance.x_target_override = battle_box.bbox_right + 20;
160
                attack_instance.y_target_override = battle_box.y;
161
                attack_instance = instance_create_depth(battle_box.bbox_right + 40, battle_box.bbox_top + 20, -100, obj_martlet_attack_splitting_feather);
162
                attack_instance.x_target_override = battle_box.bbox_left - 20;
163
                attack_instance.y_target_override = battle_box.y;
164
                break;
165
            case 80:
166
                var sound_noloop = false;
167
                var i = battle_box.bbox_left + 12;
168
                while (i < (battle_box.bbox_right - 4))
169
                {
170
                    var feather = instance_create_depth(i, battle_box.bbox_top - 20, -100, obj_fmartlet_feather_straight);
171
                    feather.direction = 270;
172
                    if (sound_noloop == false)
173
                    {
174
                        feather.can_play_sound = true;
175
                        sound_noloop = true;
176
                    }
177
                    i += 14;
178
                }
179
                break;
180
            case 100:
181
            case 170:
182
                var feather = instance_create_depth(battle_box.bbox_left - 20, battle_box.y, -100, obj_fmartlet_feather_straight);
183
                feather.direction = point_direction(feather.x, feather.y, heart.x, heart.y);
184
                feather.can_play_sound = true;
185
                break;
186
            case 105:
187
            case 165:
188
                var feather = instance_create_depth(battle_box.bbox_left - 20, battle_box.bbox_top - 20, -100, obj_fmartlet_feather_straight);
189
                feather.direction = point_direction(feather.x, feather.y, heart.x, heart.y);
190
                feather.can_play_sound = true;
191
                break;
192
            case 110:
193
            case 160:
194
                var feather = instance_create_depth(battle_box.x, battle_box.bbox_top - 20, -100, obj_fmartlet_feather_straight);
195
                feather.direction = point_direction(feather.x, feather.y, heart.x, heart.y);
196
                feather.can_play_sound = true;
197
                break;
198
            case 115:
199
            case 155:
200
                var feather = instance_create_depth(battle_box.bbox_right + 20, battle_box.bbox_top - 20, -100, obj_fmartlet_feather_straight);
201
                feather.direction = point_direction(feather.x, feather.y, heart.x, heart.y);
202
                feather.can_play_sound = true;
203
                break;
204
            case 120:
205
            case 150:
206
                var feather = instance_create_depth(battle_box.bbox_right + 20, battle_box.y, -100, obj_fmartlet_feather_straight);
207
                feather.direction = point_direction(feather.x, feather.y, heart.x, heart.y);
208
                feather.can_play_sound = true;
209
                break;
210
            case 125:
211
            case 145:
212
                var feather = instance_create_depth(battle_box.bbox_right + 20, battle_box.bbox_bottom + 20, -100, obj_fmartlet_feather_straight);
213
                feather.direction = point_direction(feather.x, feather.y, heart.x, heart.y);
214
                feather.can_play_sound = true;
215
                break;
216
            case 130:
217
            case 140:
218
                var feather = instance_create_depth(battle_box.x, battle_box.bbox_bottom + 20, -100, obj_fmartlet_feather_straight);
219
                feather.direction = point_direction(feather.x, feather.y, heart.x, heart.y);
220
                feather.can_play_sound = true;
221
                break;
222
            case 135:
223
                var feather = instance_create_depth(battle_box.bbox_left - 20, battle_box.bbox_bottom + 20, -100, obj_fmartlet_feather_straight);
224
                feather.direction = point_direction(feather.x, feather.y, heart.x, heart.y);
225
                feather.can_play_sound = true;
226
                break;
227
            case 190:
228
                var attack_instance = instance_create_depth(obj_heart_battle_fighting_parent.x, obj_heart_battle_fighting_parent.y, -100, obj_martlet_attack_talon);
229
                attack_instance.attack_delay = 5;
230
                break;
231
            case 200:
232
                var attack_instance = instance_create_depth(obj_heart_battle_fighting_parent.x, obj_heart_battle_fighting_parent.y, -100, obj_martlet_attack_talon);
233
                attack_instance.image_xscale = -1;
234
                attack_instance.attack_delay = 10;
235
                break;
236
            case 215:
237
                var attack_instance = instance_create_depth(obj_heart_battle_fighting_parent.x, obj_heart_battle_fighting_parent.y, -100, obj_martlet_attack_talon);
238
                attack_instance.attack_delay = 15;
239
                break;
240
            case 240:
241
                with (obj_martlet_final_base)
242
                {
243
                    depth = -100;
244
                    image_alpha = 0;
245
                    sprite_index = spr_martlet_final_fly_in;
246
                    image_index = 0;
247
                    image_speed = 1;
248
                    x = martlet_fly_x_start;
249
                    y = martlet_fly_y_target + 90;
250
                    image_xscale = 0.5;
251
                    image_yscale = 0.5;
252
                }
253
                can_attack = false;
254
                scene = 5;
255
                exit;
256
                break;
257
            case 500:
258
                attack_tick = 99;
259
                break;
260
        }
261
    }
262
    else if (attack_variant == 1)
263
    {
264
        switch (attack_tick)
265
        {
266
            case 30:
267
                if (!instance_exists(obj_battle_enemy_attack_martlet_ff_2_final_checker))
268
                    instance_create_depth(320, 320, -100, obj_battle_enemy_attack_martlet_ff_2_final_checker);
269
                break;
270
            case 130:
271
            case 140:
272
            case 150:
273
            case 160:
274
            case 170:
275
                instance_create_depth(random_range(battle_box.bbox_left, battle_box.bbox_right), random_range(battle_box.bbox_top - 20, battle_box.bbox_top - 50), -100, obj_battle_enemy_attack_martlet_feather_fall_feather_final);
276
                break;
277
                break;
278
            case 210:
279
            case 240:
280
                var attack_instance = instance_create_depth(obj_heart_battle_fighting_parent.x, obj_heart_battle_fighting_parent.y, -100, obj_martlet_attack_talon);
281
                attack_instance.attack_delay = 3;
282
                break;
283
            case 225:
284
                var attack_instance = instance_create_depth(obj_heart_battle_fighting_parent.x, obj_heart_battle_fighting_parent.y, -100, obj_martlet_attack_talon);
285
                attack_instance.image_xscale = -1;
286
                attack_instance.attack_delay = 3;
287
                break;
288
            case 255:
289
                var attack_instance = instance_create_depth(obj_heart_battle_fighting_parent.x, obj_heart_battle_fighting_parent.y, -100, obj_martlet_attack_talon);
290
                attack_instance.attack_delay = 75;
291
                break;
292
            case 265:
293
                var sound_noloop = false;
294
                var i = battle_box.bbox_left + 12;
295
                while (i < (battle_box.bbox_right - 4))
296
                {
297
                    var feather = instance_create_depth(i, battle_box.bbox_top - 20, -100, obj_fmartlet_feather_straight);
298
                    feather.direction = 270;
299
                    if (sound_noloop == false)
300
                    {
301
                        feather.can_play_sound = true;
302
                        sound_noloop = true;
303
                    }
304
                    i += 14;
305
                }
306
                break;
307
            case 280:
308
                var sound_noloop = false;
309
                var i = battle_box.bbox_top + 12;
310
                while (i < battle_box.y)
311
                {
312
                    var feather = instance_create_depth(battle_box.bbox_left - 20, i, -100, obj_fmartlet_feather_straight);
313
                    feather.direction = 0;
314
                    if (sound_noloop == false)
315
                    {
316
                        feather.can_play_sound = true;
317
                        sound_noloop = true;
318
                    }
319
                    i += 11.666666666666666;
320
                }
321
                break;
322
            case 295:
323
                var sound_noloop = false;
324
                var i = battle_box.y;
325
                while (i < (battle_box.bbox_bottom - 4))
326
                {
327
                    var feather = instance_create_depth(battle_box.bbox_right + 20, i, -100, obj_fmartlet_feather_straight);
328
                    feather.direction = 180;
329
                    if (sound_noloop == false)
330
                    {
331
                        feather.can_play_sound = true;
332
                        sound_noloop = true;
333
                    }
334
                    i += 11.666666666666666;
335
                }
336
                break;
337
            case 360:
338
                with (obj_martlet_final_base)
339
                {
340
                    depth = -100;
341
                    image_alpha = 0;
342
                    sprite_index = spr_martlet_final_fly_in;
343
                    image_index = 0;
344
                    image_speed = 1;
345
                    x = martlet_fly_x_start;
346
                    y = martlet_fly_y_target + 90;
347
                    image_xscale = 0.5;
348
                    image_yscale = 0.5;
349
                }
350
                can_attack = false;
351
                scene = 5;
352
                exit;
353
                break;
354
        }
355
    }
356
    attack_tick += 1;
357
}