Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_martlet_attack_glass_Step_2

(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_yellow_final
4
var battle_box = obj_dialogue_box_battle_transformation_any
5
var right_boundary = battle_box.bbox_right - 4
6
var left_boundary = battle_box.bbox_left + 4
7
var top_boundary = battle_box.bbox_top + 4
8
var bottom_boundary = battle_box.bbox_bottom - 4
9
if place_meeting(x, y, soul)
10
{
11
    if soul.is_dashing
12
        instance_destroy()
13
    else
14
    {
15
        var soul_bbox_right = soul.x + 8
16
        var soul_bbox_left = soul.x - 8
17
        var soul_bbox_top = soul.y - 8
18
        var soul_bbox_bottom = soul.y + 8
19
        if (vspeed != 0)
20
        {
21
            if (soul.x <= bbox_right && soul.x >= bbox_left)
22
            {
23
                while ((soul.y + vspeed) > y && soul.bbox_top < bbox_bottom)
24
                    soul.y += 1
25
                while ((soul.y + vspeed) < y && soul.bbox_bottom > bbox_top)
26
                    soul.y -= 1
27
            }
28
        }
29
        else if (hspeed != 0)
30
        {
31
            if (soul.y >= bbox_top && soul.y <= bbox_bottom)
32
            {
33
                while ((soul.x + hspeed) > x && soul.bbox_left < bbox_right)
34
                    soul.x += 1
35
                while ((soul.x + hspeed) < x && soul.bbox_right > bbox_left)
36
                    soul.x -= 1
37
            }
38
        }
39
        if (soul.bbox_left < left_boundary || soul.bbox_right > right_boundary || soul.bbox_bottom > bottom_boundary || soul.bbox_top < top_boundary)
40
        {
41
            soul.x = clamp(soul.x, (left_boundary + 8), (right_boundary - 8))
42
            soul.y = clamp(soul.y, (top_boundary + 8), (bottom_boundary - 8))
43
            instance_create_depth((soul.x - 6), (soul.y - 6), -100, obj_martlet_attack_glass_hurtbox)
44
            instance_destroy()
45
        }
46
    }
47
}