Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_battle_enemy_attack_axis_beams_Step_0

(view raw script w/o annotations or w/e)
1
if live_call()
2
    return global.live_result;
3
switch attack_beam_stage
4
{
5
    case 0:
6
        attack_beam_width_current += attack_beam_width_inc
7
        if (attack_beam_width_current >= attack_beam_width)
8
        {
9
            attack_beam_width_current = attack_beam_width
10
            attack_beam_stage = 1
11
            attack_beam_draw_color = make_colour_rgb(230, 50, 50)
12
            screenshake = true
13
        }
14
        attack_beam_draw_alpha = attack_beam_width_current / attack_beam_width * 0.5
15
        break
16
    case 1:
17
        if (attack_beam_grow == true)
18
        {
19
            if (attack_beam_width_current < (attack_beam_width + attack_beam_width_fluctuation))
20
                attack_beam_width_current += 2
21
        }
22
        if (attack_beam_grow == false)
23
        {
24
            if (attack_beam_width_current > (attack_beam_width - attack_beam_width_fluctuation))
25
                attack_beam_width_current -= 2
26
            else
27
                attack_beam_grow = true
28
        }
29
        if (attack_beam_timer > 0)
30
            attack_beam_timer -= 1
31
        else
32
            attack_beam_stage = 2
33
        break
34
    case 2:
35
        if (attack_beam_width_current > 0)
36
            attack_beam_width_current -= 7
37
        else
38
            instance_destroy()
39
        break
40
}
41
42
if (attack_beam_stage == 0)
43
    return;
44
var y_original = 0
45
var y_max = room_height
46
var x_original = 0
47
var x_max = room_width
48
if (obj_heart_battle_fighting_parent.vulnerable == true && (point_in_rectangle(obj_heart_battle_fighting_parent.x, obj_heart_battle_fighting_parent.y, (x - attack_beam_width_current / 2), y_original, (x + attack_beam_width_current / 2), y_max) || point_in_rectangle(obj_heart_battle_fighting_parent.x, obj_heart_battle_fighting_parent.y, x_original, (y - attack_beam_width_current / 2), x_max, (y + attack_beam_width_current / 2))))
49
{
50
    var damage = global.enemy_attack_stat - global.player_armor_defense - global.player_armor_modifier_defense - global.player_defense + 10
51
    if (damage < 1)
52
        damage = 1
53
    global.current_hp_self -= damage
54
    audio_play_sound(snd_hurt, 1, 0)
55
    with (obj_heart_battle_fighting_parent)
56
    {
57
        vulnerable = false
58
        global.hit_self = true
59
       alarm[0]
60
    }
61
}