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 = 3154;
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
            var 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
        var adv = 2;
49
        with (obj_guardener_guy_a_noarms)
50
        {
51
            var 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
            var 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
if (instance_exists(obj_guardener_guy_b_shield))
73
{
74
    var current_ball = instance_find(obj_battle_enemy_attack_guardener_bullet, 0);
75
    if (instance_exists(obj_battle_enemy_attack_guardener_bullet))
76
        obj_guardener_guy_b_shield.y = lerp(obj_guardener_guy_b_shield.y, current_ball.y + 20, 0.4);
77
}
78
with (obj_guardener_guy_a_flintlock)
79
{
80
    if (image_index >= (image_number - 1))
81
    {
82
        switch (sprite_index)
83
        {
84
            case spr_guardener_guy_b_flintlock_reload:
85
                sprite_index = spr_guardener_guy_b_flintlock;
86
                image_index = 0;
87
                break;
88
            case spr_guardener_guy_b_flintlock_shoot:
89
                sprite_index = spr_guardener_guy_b_flintlock_reload;
90
                image_index = 0;
91
                break;
92
        }
93
    }
94
}
95
with (obj_battle_enemy_attack_guardener_bullet)
96
{
97
    if (x < (obj_guardener_guy_b_shield.x + 40))
98
    {
99
        var max_shards = 3;
100
        var shard_spread = 45;
101
        for (var i = 0; i < max_shards; i++)
102
        {
103
            var shard = instance_create_depth(x, y, obj_heart_battle_fighting_parent.depth - 1, obj_battle_enemy_attack_guardener_bullet_shard);
104
            shard.speed = 4;
105
            shard.direction = -45 + (i * shard_spread);
106
        }
107
        audio_play_sound(snd_guardener_flintlock_shield, 1, 0);
108
        instance_destroy();
109
    }
110
}