Undertale script viewer

← back to main script listing

gml_Object_obj_mainchara_fake_Other_10

(view raw script w/o annotations or w/e)
1
if (global.interact == 0)
2
{
3
    if (global.facing == 1)
4
    {
5
        if (collision_rectangle(x + (sprite_width / 2), y + 19, x + sprite_width + 15, y + sprite_height, obj_interactable, 0, 1))
6
        {
7
            interactedobject = collision_rectangle(x + (sprite_width / 2), y + (sprite_height / 2), x + sprite_width + 15, y + sprite_height, obj_interactable, 0, 1);
8
            if (interactedobject != -4)
9
            {
10
                with (interactedobject)
11
                    facing = 3;
12
                with (interactedobject)
13
                    myinteract = 1;
14
            }
15
        }
16
    }
17
    if (global.facing == 3)
18
    {
19
        if (collision_rectangle(x + (sprite_width / 2), y + 19, x - 15, y + sprite_height, obj_interactable, 0, 1))
20
        {
21
            interactedobject = collision_rectangle(x + (sprite_width / 2), y + 3 + (sprite_height / 2), x - 15, y + sprite_height + 3, obj_interactable, 0, 1);
22
            if (interactedobject != -4)
23
            {
24
                with (interactedobject)
25
                    facing = 1;
26
                with (interactedobject)
27
                    myinteract = 1;
28
            }
29
        }
30
    }
31
    if (global.facing == 0)
32
    {
33
        if (collision_rectangle(x + 4, y + 20, (x + sprite_width) - 4, y + sprite_height + 15, obj_interactable, 0, 1))
34
        {
35
            interactedobject = collision_rectangle(x + 4, y + 20, (x + sprite_width) - 4, y + sprite_height + 15, obj_interactable, 0, 1);
36
            if (interactedobject != -4)
37
            {
38
                with (interactedobject)
39
                    facing = 2;
40
                with (interactedobject)
41
                    myinteract = 1;
42
            }
43
        }
44
    }
45
    if (global.facing == 2)
46
    {
47
        if (collision_rectangle(x + 4, (y + sprite_height) - 5, (x + sprite_width) - 4, y + 5, obj_interactable, 0, 1))
48
        {
49
            interactedobject = collision_rectangle(x + 4, (y + sprite_height) - 5, (x + sprite_width) - 4, y + 8, obj_interactable, 0, 1);
50
            if (interactedobject != -4)
51
            {
52
                with (interactedobject)
53
                    facing = 0;
54
                with (interactedobject)
55
                    myinteract = 1;
56
            }
57
        }
58
    }
59
}