Deltarune (Chapter 5) script viewer

← back to main script listing

gml_GlobalScript_scr_collision_failsafe

(view raw script w/o annotations or w/e)
1
function 
scr_collision_failsafe
scr_collision_failsafe

function
scr_collision_failsafe()
{ var _check = instance_place(x, y, obj_plat_block); if (_check != -4) { if (x > _check.bbox_right) x = _check.bbox_right + abs(x - bbox_left); if (x < _check.bbox_left) x = _check.bbox_left - abs(x - bbox_right); if (y > _check.bbox_bottom) y = _check.bbox_bottom + abs(y - bbox_top); if (y < _check.bbox_top) y = _check.bbox_top - abs(y - bbox_bottom); } }
()
2
{
3
    var _check = instance_place(x, y, obj_plat_block);
4
    if (_check != -4)
5
    {
6
        if (x > _check.bbox_right)
7
            x = _check.bbox_right + abs(x - bbox_left);
8
        if (x < _check.bbox_left)
9
            x = _check.bbox_left - abs(x - bbox_right);
10
        if (y > _check.bbox_bottom)
11
            y = _check.bbox_bottom + abs(y - bbox_top);
12
        if (y < _check.bbox_top)
13
            y = _check.bbox_top - abs(y - bbox_bottom);
14
    }
15
}