Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_battle_enemy_attack_guardener_attack_10_Step_0

(view raw script w/o annotations or w/e)
1
if live_call()
2
    return global.live_result;
3
var box = obj_dialogue_box_battle_transformation_any
4
switch scene
5
{
6
    case 0:
7
        if (obj_guardener_guy_a.active == false && obj_guardener_guy_a.is_on_target && obj_guardener_guy_b.is_on_target)
8
        {
9
            var robot_b = instance_create(-40, (box.y - 40), obj_guardener_guy_b_noarms)
10
            var hands_b = instance_create_depth(robot_b.x, robot_b.y, (robot_b.depth - 1), obj_guardener_guy_bow)
11
            hands_b.robot_parent = robot_b
12
            var robot_a = instance_create((room_width + 40), box.y, obj_guardener_guy_a_flintlock)
13
            cutscene_advance()
14
        }
15
        obj_guardener_guy_a.active = false
16
        obj_guardener_guy_b.active = false
17
        break
18
    case 1:
19
        var arm = instance_create_depth((box.bbox_left + 40), (box.bbox_bottom + 5), (obj_heart_battle_fighting_parent.depth - 1), obj_battle_enemy_attack_guardener_arm_half)
20
        arm.launch_dir = "up"
21
        arm.image_angle = 180
22
        arm.arm_return = 0
23
        var arm2 = instance_create_depth((box.bbox_right - 40), (box.bbox_top - 5), (obj_heart_battle_fighting_parent.depth - 1), obj_battle_enemy_attack_guardener_arm_half)
24
        arm2.launch_dir = "down"
25
        arm2.image_angle = 0
26
        arm2.arm_return = 0
27
        cutscene_advance()
28
        break
29
    case 2:
30
        cutscene_wait(1)
31
        break
32
    case 3:
33
        var adv = 2
34
        with (obj_guardener_guy_a_flintlock)
35
        {
36
            var x_target = box.bbox_right + 80
37
            x = lerp(x, x_target, 0.2)
38
            y = lerp(y, box.y, 0.2)
39
            if (abs(x - x_target) < 1)
40
                adv -= 1
41
        }
42
        with (obj_guardener_guy_b_noarms)
43
        {
44
            x_target = box.bbox_left - 40
45
            x = lerp(x, x_target, 0.2)
46
            y = lerp(y, box.y, 0.2)
47
            if (abs(x - x_target) < 1)
48
                adv -= 1
49
        }
50
        if (adv <= 0)
51
            cutscene_advance()
52
        break
53
    case 4:
54
        if cutscene_wait(7)
55
        {
56
            obj_guardener_guy_bow.can_shoot = false
57
            return;
58
        }
59
        obj_guardener_guy_bow.can_shoot = true
60
        var lerp_amount_new = 0.1
61
        if (obj_guardener_guy_a_flintlock.sprite_index != spr_guardener_guy_b_flintlock_shoot)
62
        {
63
            lerp_amount_new = 0.01
64
            lerp_amount = lerp_amount_new
65
        }
66
        lerp_amount = 0.1
67
        obj_guardener_guy_a_flintlock.y = lerp(obj_guardener_guy_a_flintlock.y, (obj_heart_battle_fighting_red.y + 30), lerp_amount)
68
        if (shoot_timer > 0)
69
            shoot_timer -= 1
70
        else if (obj_heart_battle_fighting_parent.x > 320)
71
        {
72
            with (obj_guardener_guy_a_flintlock)
73
            {
74
                audio_play_sound(snd_guardener_flintlock, 1, 0)
75
                sprite_index = spr_guardener_guy_b_flintlock_shoot
76
                image_index = 0
77
                instance_create_depth((x - 40), (y - 30), (obj_heart_battle_fighting_parent.depth - 1), obj_battle_enemy_attack_guardener_bullet)
78
            }
79
            shoot_timer = shoot_timer_max
80
        }
81
        break
82
    case 5:
83
        adv = 2
84
        with (obj_guardener_guy_a_flintlock)
85
        {
86
            x_target = 720
87
            x = lerp(x, x_target, 0.2)
88
            if (x > (x_target - 40))
89
                adv -= 1
90
        }
91
        with (obj_guardener_guy_b_noarms)
92
        {
93
            x_target = -40
94
            x = lerp(x, x_target, 0.2)
95
            if (x < (x_target + 20))
96
                adv -= 1
97
        }
98
        if (adv <= 0)
99
            cutscene_advance()
100
        break
101
    case 6:
102
        obj_guardener_guy_a.active = true
103
        obj_guardener_guy_b.active = true
104
        instance_destroy()
105
        break
106
}
107
108
if instance_exists(obj_guardener_guy_b_shield)
109
{
110
    var current_ball = instance_find(obj_battle_enemy_attack_guardener_bullet, 0)
111
    if instance_exists(obj_battle_enemy_attack_guardener_bullet)
112
        obj_guardener_guy_b_shield.y = lerp(obj_guardener_guy_b_shield.y, (current_ball.y + 20), 0.4)
113
}
114
with (obj_guardener_guy_a_flintlock)
115
{
116
    if (image_index >= (image_number - 1))
117
    {
118
        switch sprite_index
119
        {
120
            case spr_guardener_guy_b_flintlock_reload:
121
                sprite_index = spr_guardener_guy_b_flintlock
122
                image_index = 0
123
                break
124
            case 3628:
125
                sprite_index = spr_guardener_guy_b_flintlock_reload
126
                image_index = 0
127
                break
128
        }
129
130
    }
131
}
132
with (obj_battle_enemy_attack_guardener_bullet)
133
{
134
    if place_meeting(x, y, obj_battle_enemy_attack_guardener_arm_half)
135
    {
136
        var max_shards = 3
137
        var shard_spread = 45
138
        for (var i = 0; i < max_shards; i++)
139
        {
140
            var shard = instance_create_depth(x, y, (obj_heart_battle_fighting_parent.depth - 1), obj_battle_enemy_attack_guardener_bullet_shard)
141
            shard.speed = 4
142
            shard.direction = -45 + i * shard_spread
143
        }
144
        instance_destroy()
145
    }
146
}