Undertale Yellow script viewer

← back to main script listing

gml_GlobalScript_box_collision

(view raw script w/o annotations or w/e)
1
function box_collision(argument0, argument1, argument2) //gml_Script_box_collision
2
{
3
    if (((bbox_right - bbox_left) * (bbox_bottom - bbox_top)) == 0)
4
        return -4;
5
    var _x = (bbox_right + 1 + bbox_left) * 0.5 + (argument0 - x)
6
    var _y = (bbox_bottom + 1 + bbox_top) * 0.5 + (argument1 - y)
7
    var _hw = (bbox_right + 1 - bbox_left) * 0.5
8
    var _hh = (bbox_bottom + 1 - bbox_top) * 0.5
9
    with (argument2)
10
    {
11
        if (id != other.id && ((bbox_right - bbox_left) * (bbox_bottom - bbox_top)) != 0 && (_hw + (bbox_right + 1 - bbox_left) * 0.5) > abs((bbox_right + 1 + bbox_left) * 0.5 - _x) && (_hh + (bbox_bottom + 1 - bbox_top) * 0.5) > abs((bbox_bottom + 1 + bbox_top) * 0.5 - _y))
12
            return id;
13
    }
14
    return -4;
15
}