Undertale script viewer

← back to main script listing

gml_Object_obj_mainchara_Collision_822

(view raw script w/o annotations or w/e)
1
if (global.phasing == 0 && other.phase == 0)
2
{
3
    x = xprevious;
4
    y = yprevious;
5
    if (global.interact == 0)
6
    {
7
        if (obj_time.up)
8
        {
9
            if (collision_rectangle(x + 2, y + 15, x + 18, y + 19, obj_solidparent, 0, 1) > 0)
10
            {
11
                if (obj_time.left && collision_line(bbox_left - 3, bbox_top, bbox_left, bbox_top, obj_solidparent, false, true) < 0)
12
                {
13
                    x -= 3;
14
                    global.facing = 3;
15
                }
16
                if (obj_time.right && collision_line(bbox_right + 3, bbox_top, bbox_right, bbox_top, obj_solidparent, false, true) < 0)
17
                {
18
                    x += 3;
19
                    global.facing = 1;
20
                }
21
            }
22
            else
23
            {
24
                y -= 3;
25
                global.facing = 2;
26
            }
27
        }
28
        if (obj_time.down)
29
        {
30
            if (collision_rectangle(x + 2, y + 30, x + 18, y + 33, obj_solidparent, 0, 1) > 0)
31
            {
32
                if (obj_time.left && collision_line(bbox_left - 3, bbox_bottom, bbox_left, bbox_bottom, obj_solidparent, false, true) < 0)
33
                {
34
                    x -= 3;
35
                    global.facing = 3;
36
                }
37
                if (obj_time.right && collision_line(bbox_right + 3, bbox_bottom, bbox_right, bbox_bottom, obj_solidparent, false, true) < 0)
38
                {
39
                    x += 3;
40
                    global.facing = 1;
41
                }
42
            }
43
            else
44
            {
45
                y += 3;
46
                global.facing = 0;
47
            }
48
        }
49
    }
50
    moving = 0;
51
}