Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_battle_enemy_attack_mecha_frog_hand_Step_0

(view raw script w/o annotations or w/e)
1
if live_call()
2
    return global.live_result;
3
var soul = obj_heart_battle_fighting_red
4
switch state
5
{
6
    case "idle":
7
        sin_deg += sin_deg_inc
8
        if (sin_deg >= 360)
9
            sin_deg -= 1
10
        y = ystart + sin(degtorad(sin_deg)) * y_offset
11
        if (active == true)
12
        {
13
            timer -= 1
14
            if (timer <= 0)
15
            {
16
                if (attack_counter < 2)
17
                {
18
                    with (obj_battle_enemy_attack_mecha_frog_hand)
19
                        attack_counter += 1
20
                    self.state_switch("attack")
21
                }
22
                else
23
                {
24
                    self.state_switch("punch")
25
                    attack_counter = 0
26
                }
27
                active = false
28
            }
29
        }
30
        break
31
    case "attack":
32
        switch scene
33
        {
34
            case 0:
35
                x = lerp(x, (xstart - 10 * image_xscale), 0.15)
36
                y = lerp(y, (ystart - 20), 0.15)
37
                image_angle = lerp(image_angle, (30 * image_xscale), 0.25)
38
                cutscene_wait(0.5)
39
                break
40
            case 1:
41
                hspeed = 5 * image_xscale
42
                vspeed = 8
43
                if (bbox_bottom >= (battle_box.bbox_bottom - 4))
44
                {
45
                    hspeed = 0
46
                    vspeed = 0
47
                    scene++
48
                    audio_play_sound(snd_undertale_impact, 1, 0)
49
                    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 }
(6, 2)
50
                    var shockwave = instance_create_depth(x, (battle_box.bbox_bottom - 4), -100, obj_battle_enemy_attack_mecha_frog_shockwave)
51
                    shockwave.hspeed = image_xscale * shockwave_speed
52
                }
53
                break
54
            case 2:
55
                x = lerp(x, xstart, 0.2)
56
                y = lerp(y, ystart, 0.2)
57
                image_angle = lerp(image_angle, 0, 0.2)
58
                if (abs(image_angle - 0) < 0.1 && abs(x - xstart) < 0.1 && abs(y - ystart) < 0.1)
59
                    scene++
60
                break
61
            case 3:
62
                self.state_switch("idle")
63
                break
64
        }
65
66
        break
67
    case "punch":
68
        if (scene < 2)
69
        {
70
            if (sprite_index != spr_bigfrog_fist_2)
71
                sprite_index = spr_bigfrog_fist_2
72
            direction = point_direction(x, y, soul.x, soul.y)
73
            image_angle = direction
74
            if (image_xscale == -1)
75
                image_angle -= 180
76
        }
77
        x_target = battle_box.x - 200 * image_xscale
78
        y_target = battle_box.bbox_top
79
        switch scene
80
        {
81
            case 0:
82
                x = lerp(x, x_target, 0.15)
83
                y = lerp(y, y_target, 0.15)
84
                sprite_index = spr_bigfrog_fist_2
85
                cutscene_wait(0.5)
86
                break
87
            case 1:
88
                x = x_target + (irandom_range(-2, 2))
89
                y = y_target + (irandom_range(-2, 2))
90
                if cutscene_wait(1)
91
                {
92
                    sprite_index = spr_bigfrog_fast_fist_real
93
                    image_speed = 0
94
                    speed = 20
95
                }
96
                break
97
            case 2:
98
                if ((image_xscale == 1 && bbox_right >= (battle_box.bbox_right - 4)) || (image_xscale == -1 && bbox_left <= (battle_box.bbox_left + 4)))
99
                {
100
                    image_speed = 1
101
                    audio_play_sound(snd_undertale_impact, 1, 0)
102
                    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 }
(6, 2)
103
                    speed = 0
104
                    scene++
105
                }
106
                break
107
            case 3:
108
                if (image_index >= (image_number - 1) && sprite_index != spr_bigfrog_fist_1)
109
                {
110
                    sprite_index = spr_bigfrog_fist_1
111
                    image_speed = 0
112
                    image_index = 0
113
                    image_angle = 0
114
                }
115
                x = lerp(x, xstart, 0.25)
116
                y = lerp(y, ystart, 0.25)
117
                if (abs(x - xstart) < 0.1 && abs(y - ystart) < 0.1)
118
                    scene++
119
                break
120
            case 4:
121
                self.state_switch("idle")
122
                break
123
        }
124
125
        break
126
}
127
128
function state_switch_gml_Object_obj_battle_enemy_attack_mecha_frog_hand_Step_0(argument0) //gml_Script_state_switch_gml_Object_obj_battle_enemy_attack_mecha_frog_hand_Step_0
129
{
130
    state = argument0
131
    scene = 0
132
    timer = timer_max
133
    if (argument0 == "idle")
134
    {
135
        with (obj_battle_enemy_attack_mecha_frog_creator)
136
            hand_reroll = true
137
        obj_battle_enemy_attack_mecha_frog_cockpit.hit_noloop = false
138
    }
139
}