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