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 = 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 - 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
            var 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
            exit;
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
        {
70
            shoot_timer -= 1;
71
        }
72
        else if (obj_heart_battle_fighting_parent.x > 320)
73
        {
74
            with (obj_guardener_guy_a_flintlock)
75
            {
76
                audio_play_sound(snd_guardener_flintlock, 1, 0);
77
                sprite_index = spr_guardener_guy_b_flintlock_shoot;
78
                image_index = 0;
79
                instance_create_depth(x - 40, y - 30, obj_heart_battle_fighting_parent.depth - 1, obj_battle_enemy_attack_guardener_bullet);
80
            }
81
            shoot_timer = shoot_timer_max;
82
        }
83
        break;
84
    case 5:
85
        var adv = 2;
86
        with (obj_guardener_guy_a_flintlock)
87
        {
88
            var x_target = 720;
89
            x = lerp(x, x_target, 0.2);
90
            if (x > (x_target - 40))
91
                adv -= 1;
92
        }
93
        with (obj_guardener_guy_b_noarms)
94
        {
95
            var x_target = -40;
96
            x = lerp(x, x_target, 0.2);
97
            if (x < (x_target + 20))
98
                adv -= 1;
99
        }
100
        if (adv <= 0)
101
            cutscene_advance();
102
        break;
103
    case 6:
104
        obj_guardener_guy_a.active = true;
105
        obj_guardener_guy_b.active = true;
106
        instance_destroy();
107
        break;
108
}
109
if (instance_exists(obj_guardener_guy_b_shield))
110
{
111
    var current_ball = instance_find(obj_battle_enemy_attack_guardener_bullet, 0);
112
    if (instance_exists(obj_battle_enemy_attack_guardener_bullet))
113
        obj_guardener_guy_b_shield.y = lerp(obj_guardener_guy_b_shield.y, current_ball.y + 20, 0.4);
114
}
115
with (obj_guardener_guy_a_flintlock)
116
{
117
    if (image_index >= (image_number - 1))
118
    {
119
        switch (sprite_index)
120
        {
121
            case spr_guardener_guy_b_flintlock_reload:
122
                sprite_index = spr_guardener_guy_b_flintlock;
123
                image_index = 0;
124
                break;
125
            case spr_guardener_guy_b_flintlock_shoot:
126
                sprite_index = spr_guardener_guy_b_flintlock_reload;
127
                image_index = 0;
128
                break;
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
}