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 = obj_dialogue_box_battle_transformation_any
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() //gml_Script_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 = obj_dialogue_box_battle_transformation_any 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() //gml_Script_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 = obj_dialogue_box_battle_transformation_any 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
                y = lerp(y, martlet_fly_y_target, 0.1)
112
            x = lerp(x, 320, 0.1)
113
            image_angle = lerp(image_angle, 0, 0.1)
114
            if (abs(x - 320) < 1)
115
                x = 320
116
        }
117
        break
118
    case 8:
119
        cutscene_wait(0.5)
120
        break
121
    case 9:
122
        instance_destroy(obj_fmartlet_collision_mask_martlet_fly)
123
        instance_destroy()
124
        with (obj_martlet_final_base)
125
        {
126
            martlet_sprites_reset = true
127
            y = martlet_y_target
128
            x = 320
129
            depth = 10
130
            hspeed = 0
131
        }
132
        break
133
}
134
135
if (can_attack == true)
136
{
137
    if (attack_variant == 0)
138
    {
139
        switch attack_tick
140
        {
141
            case 30:
142
                var attack_instance = instance_create_depth((battle_box.bbox_right + 40), battle_box.y, -100, obj_martlet_attack_splitting_feather)
143
                attack_instance.x_target_override = battle_box.bbox_left - 20
144
                attack_instance.y_target_override = battle_box.y
145
                break
146
            case 44:
147
                attack_instance = instance_create_depth((battle_box.bbox_right + 40), (battle_box.bbox_top - 40), -100, obj_martlet_attack_splitting_feather)
148
                attack_instance.x_target_override = battle_box.x
149
                attack_instance.y_target_override = battle_box.y
150
                break
151
            case 58:
152
                attack_instance = instance_create_depth((battle_box.bbox_left - 40), (battle_box.bbox_top - 40), -100, obj_martlet_attack_splitting_feather)
153
                attack_instance.x_target_override = heart.x
154
                attack_instance.y_target_override = heart.y
155
                break
156
            case 72:
157
                attack_instance = instance_create_depth((battle_box.bbox_left - 40), (battle_box.bbox_top + 20), -100, obj_martlet_attack_splitting_feather)
158
                attack_instance.x_target_override = battle_box.bbox_right + 20
159
                attack_instance.y_target_override = battle_box.y
160
                attack_instance = instance_create_depth((battle_box.bbox_right + 40), (battle_box.bbox_top + 20), -100, obj_martlet_attack_splitting_feather)
161
                attack_instance.x_target_override = battle_box.bbox_left - 20
162
                attack_instance.y_target_override = battle_box.y
163
                break
164
            case 80:
165
                var sound_noloop = false
166
                for (var i = battle_box.bbox_left + 12; i < (battle_box.bbox_right - 4); i += 14)
167
                {
168
                    var feather = instance_create_depth(i, (battle_box.bbox_top - 20), -100, obj_fmartlet_feather_straight)
169
                    feather.direction = 270
170
                    if (sound_noloop == false)
171
                    {
172
                        feather.can_play_sound = true
173
                        sound_noloop = true
174
                    }
175
                }
176
                break
177
            case 100:
178
            case 170:
179
                feather = instance_create_depth((battle_box.bbox_left - 20), battle_box.y, -100, obj_fmartlet_feather_straight)
180
                feather.direction = point_direction(feather.x, feather.y, heart.x, heart.y)
181
                feather.can_play_sound = true
182
                break
183
            case 105:
184
            case 165:
185
                feather = instance_create_depth((battle_box.bbox_left - 20), (battle_box.bbox_top - 20), -100, obj_fmartlet_feather_straight)
186
                feather.direction = point_direction(feather.x, feather.y, heart.x, heart.y)
187
                feather.can_play_sound = true
188
                break
189
            case 110:
190
            case 160:
191
                feather = instance_create_depth(battle_box.x, (battle_box.bbox_top - 20), -100, obj_fmartlet_feather_straight)
192
                feather.direction = point_direction(feather.x, feather.y, heart.x, heart.y)
193
                feather.can_play_sound = true
194
                break
195
            case 115:
196
            case 155:
197
                feather = instance_create_depth((battle_box.bbox_right + 20), (battle_box.bbox_top - 20), -100, obj_fmartlet_feather_straight)
198
                feather.direction = point_direction(feather.x, feather.y, heart.x, heart.y)
199
                feather.can_play_sound = true
200
                break
201
            case 120:
202
            case 150:
203
                feather = instance_create_depth((battle_box.bbox_right + 20), battle_box.y, -100, obj_fmartlet_feather_straight)
204
                feather.direction = point_direction(feather.x, feather.y, heart.x, heart.y)
205
                feather.can_play_sound = true
206
                break
207
            case 125:
208
            case 145:
209
                feather = instance_create_depth((battle_box.bbox_right + 20), (battle_box.bbox_bottom + 20), -100, obj_fmartlet_feather_straight)
210
                feather.direction = point_direction(feather.x, feather.y, heart.x, heart.y)
211
                feather.can_play_sound = true
212
                break
213
            case 130:
214
            case 140:
215
                feather = instance_create_depth(battle_box.x, (battle_box.bbox_bottom + 20), -100, obj_fmartlet_feather_straight)
216
                feather.direction = point_direction(feather.x, feather.y, heart.x, heart.y)
217
                feather.can_play_sound = true
218
                break
219
            case 135:
220
                feather = instance_create_depth((battle_box.bbox_left - 20), (battle_box.bbox_bottom + 20), -100, obj_fmartlet_feather_straight)
221
                feather.direction = point_direction(feather.x, feather.y, heart.x, heart.y)
222
                feather.can_play_sound = true
223
                break
224
            case 190:
225
                attack_instance = instance_create_depth(obj_heart_battle_fighting_parent.x, obj_heart_battle_fighting_parent.y, -100, obj_martlet_attack_talon)
226
                attack_instance.attack_delay = 5
227
                break
228
            case 200:
229
                attack_instance = instance_create_depth(obj_heart_battle_fighting_parent.x, obj_heart_battle_fighting_parent.y, -100, obj_martlet_attack_talon)
230
                attack_instance.image_xscale = -1
231
                attack_instance.attack_delay = 10
232
                break
233
            case 215:
234
                attack_instance = instance_create_depth(obj_heart_battle_fighting_parent.x, obj_heart_battle_fighting_parent.y, -100, obj_martlet_attack_talon)
235
                attack_instance.attack_delay = 15
236
                break
237
            case 240:
238
                with (obj_martlet_final_base)
239
                {
240
                    depth = -100
241
                    image_alpha = 0
242
                    sprite_index = spr_martlet_final_fly_in
243
                    image_index = 0
244
                    image_speed = 1
245
                    x = martlet_fly_x_start
246
                    y = martlet_fly_y_target + 90
247
                    image_xscale = 0.5
248
                    image_yscale = 0.5
249
                }
250
                can_attack = false
251
                scene = 5
252
                return;
253
            case 500:
254
                attack_tick = 99
255
                break
256
        }
257
258
    }
259
    else if (attack_variant == 1)
260
    {
261
        switch attack_tick
262
        {
263
            case 30:
264
                if (!instance_exists(obj_battle_enemy_attack_martlet_ff_2_final_checker))
265
                    instance_create_depth(320, 320, -100, obj_battle_enemy_attack_martlet_ff_2_final_checker)
266
                break
267
            case 130:
268
            case 140:
269
            case 150:
270
            case 160:
271
            case 170:
272
                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)
273
                break
274
            case 210:
275
            case 240:
276
                attack_instance = instance_create_depth(obj_heart_battle_fighting_parent.x, obj_heart_battle_fighting_parent.y, -100, obj_martlet_attack_talon)
277
                attack_instance.attack_delay = 3
278
                break
279
            case 225:
280
                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.image_xscale = -1
282
                attack_instance.attack_delay = 3
283
                break
284
            case 255:
285
                attack_instance = instance_create_depth(obj_heart_battle_fighting_parent.x, obj_heart_battle_fighting_parent.y, -100, obj_martlet_attack_talon)
286
                attack_instance.attack_delay = 75
287
                break
288
            case 265:
289
                sound_noloop = false
290
                for (i = battle_box.bbox_left + 12; i < (battle_box.bbox_right - 4); i += 14)
291
                {
292
                    feather = instance_create_depth(i, (battle_box.bbox_top - 20), -100, obj_fmartlet_feather_straight)
293
                    feather.direction = 270
294
                    if (sound_noloop == false)
295
                    {
296
                        feather.can_play_sound = true
297
                        sound_noloop = true
298
                    }
299
                }
300
                break
301
            case 280:
302
                sound_noloop = false
303
                for (i = battle_box.bbox_top + 12; i < battle_box.y; i += 11.666666666666666)
304
                {
305
                    feather = instance_create_depth((battle_box.bbox_left - 20), i, -100, obj_fmartlet_feather_straight)
306
                    feather.direction = 0
307
                    if (sound_noloop == false)
308
                    {
309
                        feather.can_play_sound = true
310
                        sound_noloop = true
311
                    }
312
                }
313
                break
314
            case 295:
315
                sound_noloop = false
316
                for (i = battle_box.y; i < (battle_box.bbox_bottom - 4); i += 11.666666666666666)
317
                {
318
                    feather = instance_create_depth((battle_box.bbox_right + 20), i, -100, obj_fmartlet_feather_straight)
319
                    feather.direction = 180
320
                    if (sound_noloop == false)
321
                    {
322
                        feather.can_play_sound = true
323
                        sound_noloop = true
324
                    }
325
                }
326
                break
327
            case 360:
328
                with (obj_martlet_final_base)
329
                {
330
                    depth = -100
331
                    image_alpha = 0
332
                    sprite_index = spr_martlet_final_fly_in
333
                    image_index = 0
334
                    image_speed = 1
335
                    x = martlet_fly_x_start
336
                    y = martlet_fly_y_target + 90
337
                    image_xscale = 0.5
338
                    image_yscale = 0.5
339
                }
340
                can_attack = false
341
                scene = 5
342
                return;
343
        }
344
345
    }
346
    attack_tick += 1
347
}