Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_battle_enemy_attack_guardener_attack_11_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, 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_throwing_hands)
11
            hands_b.robot_parent = robot_b
12
            hands_b.bombs = true
13
            var robot_a = instance_create((room_width + 40), box.y, obj_guardener_guy_a_noarms)
14
            var hands_a = instance_create_depth(robot_a.x, robot_a.y, (robot_a.depth - 1), obj_guardener_guy_throwing_hands)
15
            hands_a.robot_parent = robot_a
16
            hands_a.image_xscale = -1
17
            hands_a.throw_delay += (hands_a.image_number - 0.5)
18
            hands_a.bombs = true
19
            cutscene_advance()
20
        }
21
        obj_guardener_guy_a.active = false
22
        obj_guardener_guy_b.active = false
23
        break
24
    case 1:
25
        var adv = 2
26
        with (obj_guardener_guy_a_noarms)
27
        {
28
            var x_target = box.bbox_right + 40
29
            x = lerp(x, x_target, 0.2)
30
            y = lerp(y, box.y, 0.2)
31
            if (((abs(x + y)) - (abs(x_target + box.y))) < 1)
32
                adv -= 1
33
        }
34
        with (obj_guardener_guy_b_noarms)
35
        {
36
            x_target = box.bbox_left - 40
37
            x = lerp(x, x_target, 0.2)
38
            y = lerp(y, box.y, 0.2)
39
            if (((abs(x + y)) - (abs(x_target + box.y))) < 1)
40
                adv -= 1
41
        }
42
        if (adv <= 0)
43
            cutscene_advance()
44
        break
45
    case 2:
46
        break
47
    case 3:
48
        adv = 2
49
        with (obj_guardener_guy_a_noarms)
50
        {
51
            x_target = 720
52
            x = lerp(x, x_target, 0.2)
53
            if (x > (x_target - 40))
54
                adv -= 1
55
        }
56
        with (obj_guardener_guy_b_noarms)
57
        {
58
            x_target = -40
59
            x = lerp(x, x_target, 0.2)
60
            if (x < (x_target + 20))
61
                adv -= 1
62
        }
63
        if (adv <= 0)
64
            cutscene_advance()
65
        break
66
    case 4:
67
        obj_guardener_guy_a.active = true
68
        obj_guardener_guy_b.active = true
69
        instance_destroy()
70
        break
71
}
72
73
if instance_exists(obj_guardener_guy_b_shield)
74
{
75
    var current_ball = instance_find(obj_battle_enemy_attack_guardener_bullet, 0)
76
    if instance_exists(obj_battle_enemy_attack_guardener_bullet)
77
        obj_guardener_guy_b_shield.y = lerp(obj_guardener_guy_b_shield.y, (current_ball.y + 20), 0.4)
78
}
79
with (obj_guardener_guy_a_flintlock)
80
{
81
    if (image_index >= (image_number - 1))
82
    {
83
        switch sprite_index
84
        {
85
            case spr_guardener_guy_b_flintlock_reload:
86
                sprite_index = spr_guardener_guy_b_flintlock
87
                image_index = 0
88
                break
89
            case 3628:
90
                sprite_index = spr_guardener_guy_b_flintlock_reload
91
                image_index = 0
92
                break
93
        }
94
95
    }
96
}
97
with (obj_battle_enemy_attack_guardener_bullet)
98
{
99
    if (x < (obj_guardener_guy_b_shield.x + 40))
100
    {
101
        var max_shards = 3
102
        var shard_spread = 45
103
        for (var i = 0; i < max_shards; i++)
104
        {
105
            var shard = instance_create_depth(x, y, (obj_heart_battle_fighting_parent.depth - 1), obj_battle_enemy_attack_guardener_bullet_shard)
106
            shard.speed = 4
107
            shard.direction = -45 + i * shard_spread
108
        }
109
        audio_play_sound(snd_guardener_flintlock_shield, 1, 0)
110
        instance_destroy()
111
    }
112
}