Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_battle_enemy_attack_axis_laser_hand_Step_0

(view raw script w/o annotations or w/e)
1
if live_call()
2
    return global.live_result;
3
var battle_box = obj_dialogue_box_battle_transformation_any
4
direction = point_direction(x, y, battle_box.x, battle_box.y)
5
image_angle = direction
6
switch scene
7
{
8
    case 0:
9
        if (image_alpha < 0.99)
10
            image_alpha = lerp(image_alpha, 1, 0.25)
11
        else
12
        {
13
            cutscene_advance()
14
            image_alpha = 1
15
            audio_play_sound(snd_kamehamehacharge, 1, 0)
16
        }
17
        break
18
    case 1:
19
        x = xstart + (random_range(-2, 2))
20
        y = ystart + (random_range(-2, 2))
21
        if cutscene_wait(1)
22
        {
23
            image_index = 1
24
            laser_active = true
25
            audio_play_sound(snd_axis_geno_laser_drill, 1, 1)
26
        }
27
        break
28
    case 2:
29
        move_dir -= move_dir_inc
30
        move_dir_inc = lerp(move_dir_inc, move_dir_inc_max, 0.25)
31
        if (move_dir_switch == false)
32
        {
33
            if (move_dir_switch_timer > 0)
34
                move_dir_switch_timer -= 1
35
            else
36
            {
37
                instance_create_depth(x, (y - 50), (depth - 1), obj_attack_warning_exclamation_mark)
38
                move_dir_switch = true
39
            }
40
        }
41
        else if (!instance_exists(obj_attack_warning_exclamation_mark))
42
        {
43
            move_dir_inc_max *= -1
44
            move_dir_switch_timer = move_dir_switch_timer_max * (random_range(0.5, 1.5))
45
            move_dir_switch = false
46
        }
47
        x = battle_box.x + (lengthdir_x(move_dist, move_dir))
48
        y = battle_box.y + (lengthdir_y(move_dist, move_dir))
49
        break
50
}
51
52
if (laser_active == true)
53
{
54
    laser_x1 = x
55
    laser_x2 = x + (lengthdir_x(laser_length, direction))
56
    laser_y1 = y
57
    laser_y2 = y + (lengthdir_y(laser_length, direction))
58
    if (abs(angle_difference((direction - 180), obj_battle_enemy_attack_axis_shield.direction)) < 45)
59
    {
60
        laser_blocked = true
61
        laser_length = point_distance(x, y, (obj_battle_enemy_attack_axis_shield.x + (lengthdir_x(20, obj_battle_enemy_attack_axis_shield.direction))), (obj_battle_enemy_attack_axis_shield.y + (lengthdir_y(20, obj_battle_enemy_attack_axis_shield.direction))))
62
        obj_battlebox_controller_axis.axis_trash_meter = clamp((obj_battlebox_controller_axis.axis_trash_meter + 0.25), 0, 100)
63
        with (obj_battle_enemy_attack_axis_shield)
64
            shield_offset = shield_offset_min
65
    }
66
    else
67
    {
68
        if (obj_heart_battle_fighting_parent.vulnerable == true)
69
        {
70
            var damage = global.enemy_attack_stat - global.player_armor_defense - global.player_armor_modifier_defense - global.player_defense + 10
71
            if (damage < 1)
72
                damage = 1
73
            audio_play_sound(snd_hurt, 1, 0)
74
            global.current_hp_self -= damage
75
            with (obj_heart_battle_fighting_parent)
76
            {
77
                vulnerable = false
78
                global.hit_self = true
79
               alarm[0]
80
            }
81
        }
82
        laser_blocked = false
83
        laser_length = 900
84
    }
85
}
86
if (impact_frame_current < (impact_frame_max + 1))
87
    impact_frame_current += impact_frame_speed
88
else
89
    impact_frame_current = 0
90
if (laser_frame_current < (laser_frame_max + 1))
91
    laser_frame_current += laser_frame_speed
92
else
93
    laser_frame_current = 0
94
if instance_exists(obj_attack_warning_exclamation_mark)
95
{
96
    obj_attack_warning_exclamation_mark.x = x
97
    obj_attack_warning_exclamation_mark.y = y - 50
98
}