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 = obj_dialogue_box_battle_transformation_any
2
var soul = obj_heart_battle_fighting_parent
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
            return;
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 = obj_heart_battle_fighting_parent
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
                attack_state += 1
79
        }
80
        break
81
    case 5:
82
        if ((!instance_exists(obj_attack_ed_grab_hand_hurtbox_return)) || obj_attack_ed_grab_hand_hurtbox_return.spawner != id)
83
        {
84
            var new_hitbox = instance_create(x, y, obj_attack_ed_grab_hand_hurtbox_return)
85
            new_hitbox.spawner = id
86
        }
87
        if (image_speed == 0)
88
            image_speed = 0.5
89
        if (image_index >= (image_number - 1) && sprite_index != spr_attack_ed_hand)
90
        {
91
            sprite_index = spr_attack_ed_hand
92
            image_speed = (1/3)
93
        }
94
        if (speed > -8)
95
            speed -= 2
96
        if ((image_xscale == 1 && x >= (battle_box.bbox_right + 60)) || (image_xscale == -1 && x <= (battle_box.bbox_left - 60)))
97
        {
98
            _attack_timer = room_speed * 2
99
            attack_state = 2
100
            attack_number += 1
101
            speed = 0
102
        }
103
        break
104
    case 6:
105
        if (speed > -11)
106
            speed -= 3
107
        _anim_ready = false
108
        if ((image_xscale == 1 && x >= (battle_box.x + 20)) || (image_xscale == -1 && x <= (battle_box.x - 20)))
109
        {
110
            speed = 0
111
            attack_state += 1
112
        }
113
        break
114
    case 7:
115
        if (vspeed > -8)
116
            vspeed -= 2
117
        if (y <= (battle_box.y - 20))
118
            attack_state += 1
119
        break
120
    case 8:
121
        if (vspeed < 24)
122
            vspeed += 6
123
        if (y >= (battle_box.bbox_bottom - 20))
124
        {
125
            y = battle_box.bbox_bottom - 20
126
            attack_state += 1
127
            vspeed = 0
128
        }
129
        break
130
    case 9:
131
        if (image_speed == 0)
132
        {
133
            audio_play_sound(snd_rock_break, 1, 0)
134
            scr_screenshake_battle
scr_screenshake_battle

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