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