Undertale Yellow script viewer

← back to main script listing

gml_GlobalScript_scr_interact

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

function scr_interact() //gml_Script_scr_interact { if (distance_to_object(obj_pl) < 20 && obj_pl.state == gml_Script_scr_normal_state) { var pl_dir = obj_pl.direction var pl_x = 0 var pl_y = 0 var check_distance_x = 0 var check_distance_y = 0 switch pl_dir { case 0: pl_x = obj_pl.bbox_right pl_y = obj_pl.bbox_top + 1 check_distance_x = 20 break case 180: pl_x = obj_pl.bbox_left pl_y = obj_pl.bbox_top + 1 check_distance_x = -20 break case 90: pl_x = obj_pl.x pl_y = obj_pl.bbox_top check_distance_y = -20 break case 270: pl_x = obj_pl.x pl_y = obj_pl.bbox_bottom check_distance_y = 20 break } if collision_line_first(pl_x, pl_y, (pl_x + check_distance_x), (pl_y + check_distance_y), id, false, false) return true; } }
() //gml_Script_scr_interact
2
{
3
    if (distance_to_object(obj_pl) < 20 && obj_pl.state == gml_Script_scr_normal_state)
4
    {
5
        var pl_dir = obj_pl.direction
6
        var pl_x = 0
7
        var pl_y = 0
8
        var check_distance_x = 0
9
        var check_distance_y = 0
10
        switch pl_dir
11
        {
12
            case 0:
13
                pl_x = obj_pl.bbox_right
14
                pl_y = obj_pl.bbox_top + 1
15
                check_distance_x = 20
16
                break
17
            case 180:
18
                pl_x = obj_pl.bbox_left
19
                pl_y = obj_pl.bbox_top + 1
20
                check_distance_x = -20
21
                break
22
            case 90:
23
                pl_x = obj_pl.x
24
                pl_y = obj_pl.bbox_top
25
                check_distance_y = -20
26
                break
27
            case 270:
28
                pl_x = obj_pl.x
29
                pl_y = obj_pl.bbox_bottom
30
                check_distance_y = 20
31
                break
32
        }
33
34
        if collision_line_first(pl_x, pl_y, (pl_x + check_distance_x), (pl_y + check_distance_y), id, false, false)
35
            return true;
36
    }
37
}