Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_attack_ed_grab_hand_solo_Step_0

(view raw script w/o annotations or w/e)
1
var battle_box = 3154;
2
var soul = 2979;
3
switch (attack_state)
4
{
5
    case 1:
6
        var x_target = 0;
7
        if (x > battle_box.x)
8
            x_target = battle_box.bbox_right + 30;
9
        else
10
            x_target = battle_box.bbox_left - 41;
11
        x = lerp(x, x_target, 0.3);
12
        if (abs(x - x_target) <= 1)
13
        {
14
            x = x_target;
15
            attack_state += 1;
16
            _attack_timer = room_speed * 0.5;
17
        }
18
        break;
19
    case 2:
20
        if (soul.moveable == false)
21
            exit;
22
        _attack_timer -= 1;
23
        if (_attack_timer <= 0)
24
        {
25
            attack_state += 1;
26
            instance_create(320, y, obj_attack_ed_grab_warning);
27
        }
28
        break;
29
    case 3:
30
        if (sprite_index != spr_attack_ed_hand_grab)
31
        {
32
            sprite_index = spr_attack_ed_hand_grab;
33
            image_index = 1;
34
            image_speed = 0.5;
35
        }
36
        if (image_index >= (image_number - 1))
37
        {
38
            attack_state += 1;
39
            _attack_caught_player = false;
40
            sprite_index = spr_attack_ed_hand_grab_2;
41
            image_index = 0;
42
            image_speed = 0;
43
        }
44
        break;
45
    case 4:
46
        if (speed < 15)
47
            speed += 3;
48
        soul = 2979;
49
        if (place_meeting(x, y, soul) && soul.moveable == true)
50
        {
51
            soul.image_alpha = 0;
52
            soul.moveable = false;
53
            soul.vulnerable = false;
54
            _attack_caught_player = true;
55
            if (sprite_index != spr_attack_ed_hand_grab_3)
56
            {
57
                sprite_index = spr_attack_ed_hand_grab_3;
58
                image_speed = 1/3;
59
                image_index = 0;
60
            }
61
        }
62
        var _anim_ready = false;
63
        if (sprite_index == spr_attack_ed_hand_grab_3 && image_index >= 6)
64
        {
65
            _anim_ready = true;
66
            image_speed = 0;
67
            image_index = 6;
68
        }
69
        if ((direction == 180 && x <= (battle_box.bbox_left - 30)) || (direction == 0 && x >= (battle_box.bbox_right + 30)))
70
        {
71
            speed = 0;
72
            if (_attack_caught_player == true)
73
            {
74
                if (_anim_ready == true)
75
                    attack_state += 2;
76
            }
77
            else
78
            {
79
                attack_state += 1;
80
            }
81
        }
82
        break;
83
    case 5:
84
        if (!instance_exists(obj_attack_ed_grab_hand_hurtbox_return) || obj_attack_ed_grab_hand_hurtbox_return.spawner != id)
85
        {
86
            var new_hitbox = instance_create(x, y, obj_attack_ed_grab_hand_hurtbox_return);
87
            new_hitbox.spawner = id;
88
        }
89
        if (image_speed == 0)
90
            image_speed = 0.5;
91
        if (image_index >= (image_number - 1) && sprite_index != spr_attack_ed_hand)
92
        {
93
            sprite_index = spr_attack_ed_hand;
94
            image_speed = 1/3;
95
        }
96
        if (speed > -8)
97
            speed -= 2;
98
        if ((image_xscale == 1 && x >= (battle_box.bbox_right + 60)) || (image_xscale == -1 && x <= (battle_box.bbox_left - 60)))
99
        {
100
            _attack_timer = room_speed * 2;
101
            attack_state = 2;
102
            attack_number += 1;
103
            speed = 0;
104
        }
105
        break;
106
    case 6:
107
        if (speed > -11)
108
            speed -= 3;
109
        var _anim_ready = false;
110
        if ((image_xscale == 1 && x >= (battle_box.x + 20)) || (image_xscale == -1 && x <= (battle_box.x - 20)))
111
        {
112
            speed = 0;
113
            attack_state += 1;
114
        }
115
        break;
116
    case 7:
117
        if (vspeed > -8)
118
            vspeed -= 2;
119
        if (y <= (battle_box.y - 20))
120
            attack_state += 1;
121
        break;
122
    case 8:
123
        if (vspeed < 24)
124
            vspeed += 6;
125
        if (y >= (battle_box.bbox_bottom - 20))
126
        {
127
            y = battle_box.bbox_bottom - 20;
128
            attack_state += 1;
129
            vspeed = 0;
130
        }
131
        break;
132
    case 9:
133
        if (image_speed == 0)
134
        {
135
            audio_play_sound(snd_rock_break, 1, 0);
136
            scr_screenshake_battle
scr_screenshake_battle

function scr_screenshake_battle() { instance_destroy(obj_screenshake_battle); var screenshake = instance_create(0, 0, obj_screenshake_battle); battle_screenshake_duration = argument[0]; battle_screenshake_intensity = argument[1]; battle_screenshake_dec = battle_screenshake_intensity / battle_screenshake_duration; }
(15, 3);
137
            image_speed = 0.75;
138
            soul.vulnerable = true;
139
            instance_create(x, y, obj_attack_ed_grab_hand_hurtbox);
140
        }
141
        with (soul)
142
        {
143
            image_alpha = 1;
144
            x = other.x - (15 * other.image_xscale);
145
            y = other.y + 5;
146
            if (vulnerable == false)
147
            {
148
                moveable = true;
149
                vulnerable = true;
150
            }
151
        }
152
        if (image_index >= (image_number - 1))
153
        {
154
            sprite_index = spr_attack_ed_hand;
155
            image_speed = 1/3;
156
            attack_state += 1;
157
        }
158
        break;
159
    case 10:
160
        var x_target = 0;
161
        if (image_xscale == 1)
162
        {
163
            direction = 180;
164
            x_target = battle_box.bbox_right + 30;
165
        }
166
        else
167
        {
168
            direction = 0;
169
            x_target = battle_box.bbox_left - 41;
170
        }
171
        var y_target = ystart;
172
        x = lerp(x, x_target, 0.3);
173
        y = lerp(y, y_target, 0.3);
174
        if (abs(x - x_target) <= 1 && abs(y - y_target) <= 1)
175
        {
176
            x = x_target;
177
            y = y_target;
178
            speed = 0;
179
            attack_state = 2;
180
            attack_number += 1;
181
            _attack_caught_player = false;
182
            with (obj_attack_ed_grab_hand_solo)
183
                _attack_timer = room_speed * 0.25;
184
        }
185
        break;
186
}
187
if (attack_number >= attack_number_max)
188
{
189
    if (soul.moveable == false)
190
        exit;
191
    with (obj_attack_ed_grab_controller)
192
        instance_destroy();
193
    with (obj_attack_ed_grab_moray_sword_controller)
194
        instance_destroy();
195
}