Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_battle_enemy_attack_jandroid_garbage_can_Step_0

(view raw script w/o annotations or w/e)
1
if live_call()
2
    return global.live_result;
3
if (image_alpha < 0.99)
4
    image_alpha = lerp(image_alpha, 1, 0.2)
5
switch scene
6
{
7
    case 0:
8
        if (x < 319)
9
            x = lerp(x, 320, 0.3)
10
        else
11
        {
12
            x = 320
13
            cutscene_advance()
14
        }
15
        break
16
    case 1:
17
        var charge_pos = ystart - 30
18
        if (y > (charge_pos + 0.01))
19
            y = lerp(y, charge_pos, 0.5)
20
        else
21
            cutscene_advance()
22
        var charge_percentage = (ystart - y) / (charge_pos - ystart)
23
        image_angle = -180 * charge_percentage
24
        break
25
    case 2:
26
        x = 320
27
        x += irandom_range(-2, 2)
28
        if (spawn_timer > 0)
29
            spawn_timer -= 1
30
        else
31
        {
32
            var new_trash = instance_create_depth((x - spawn_offset_x_max * 0.5 + spawn_number_current * spawn_offset_x_inc), (y + 15), (depth + 1), obj_battle_enemy_attack_jandroid_garbage)
33
            if (irandom(pseudo_random) == 0 && green_spawn_noloop == false)
34
            {
35
                var new_soap = instance_create_depth(new_trash.x, new_trash.y, (obj_heart_battle_fighting_parent.depth - 1), obj_battle_enemy_attack_jandroid_soap_collider)
36
                new_soap.white_id = new_trash
37
                new_trash.sprite_index = -4
38
                green_spawn_noloop = true
39
            }
40
            if ((spawn_number_current + spawn_number_current_dir) > spawn_number || (spawn_number_current + spawn_number_current_dir) < 0)
41
                spawn_number_current_dir *= -1
42
            spawn_number_current += spawn_number_current_dir
43
            spawn_timer = spawn_timer_max
44
            if (disc_count > 0)
45
            {
46
                disc_count--
47
                if (disc_count == 0)
48
                {
49
                    var disc = instance_create_depth(x, y, (depth + 1), obj_battle_enemy_attack_goosic_disk)
50
                    disc.alarm[0] = 999999999
51
                    disc.alarm[1] = 999999999
52
                    disc.image_alpha = 1
53
                    disc.scene = -1
54
                    disc.vsp = 10
55
                    disc.disc_yoffset = 60
56
                    disc_count = -1
57
                }
58
            }
59
        }
60
        break
61
    case 4:
62
        x = 320 + (irandom_range(-1, 1))
63
        charge_pos = ystart + 5
64
        if (y < (charge_pos - 0.05))
65
            y = lerp(y, charge_pos, 0.4)
66
        else
67
            scene++
68
        break
69
    case 5:
70
        x = 320
71
        cutscene_wait(0.25)
72
        break
73
    case 6:
74
        var box = obj_dialogue_box_battle_transformation_any
75
        new_trash = instance_create_depth((box.x - 120), (box.bbox_top - 30), (obj_heart_battle_fighting_parent.depth - 1), obj_battle_enemy_attack_jandroid_garbage_can)
76
        if (green_spawn_noloop == false)
77
        {
78
            new_soap = instance_create_depth(new_trash.x, new_trash.y, (obj_heart_battle_fighting_parent.depth - 2), obj_battle_enemy_attack_jandroid_soap_collider)
79
            new_soap.white_id = new_trash
80
            new_trash.sprite_index = -4
81
            green_spawn_noloop = true
82
        }
83
        cutscene_advance()
84
        break
85
    case 7:
86
        if (x < 439.9)
87
            x = lerp(x, 440, 0.3)
88
        else
89
        {
90
            x = 440
91
            instance_destroy()
92
        }
93
        image_alpha = (440 - x) / 120
94
        break
95
}
96
97
pseudo_random = clamp((pseudo_random - 1), 0, 999)