Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_battle_enemy_attack_martlet_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
        }
13
        attack_beam_draw_alpha = attack_beam_width_current / attack_beam_width * 0.5
14
        break
15
    case 1:
16
        if (attack_beam_grow == true)
17
        {
18
            if (attack_beam_width_current < (attack_beam_width + attack_beam_width_fluctuation))
19
                attack_beam_width_current += 2
20
        }
21
        if (attack_beam_grow == false)
22
        {
23
            if (attack_beam_width_current > (attack_beam_width - attack_beam_width_fluctuation))
24
                attack_beam_width_current -= 2
25
            else
26
                attack_beam_grow = true
27
        }
28
        if (attack_beam_timer > 0)
29
            attack_beam_timer -= 1
30
        else
31
            attack_beam_stage = 2
32
        break
33
    case 2:
34
        if (attack_beam_width_current > 0)
35
            attack_beam_width_current -= 7
36
        else
37
            instance_destroy()
38
        break
39
}
40
41
if (attack_beam_stage == 0)
42
    return;
43
var y_original = 0
44
var y_max = room_height
45
var x_original = 0
46
var x_max = room_width
47
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))))
48
{
49
    var damage = global.enemy_attack_stat - global.player_armor_defense - global.player_armor_modifier_defense - global.player_defense + 10
50
    if (damage < 1)
51
        damage = 1
52
    global.current_hp_self -= damage
53
    audio_play_sound(snd_hurt, 1, 0)
54
    with (obj_heart_battle_fighting_parent)
55
    {
56
        vulnerable = false
57
        global.hit_self = true
58
       alarm[0]
59
    }
60
}