Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_lever_Step_0

(view raw script w/o annotations or w/e)
1
if (obj_puzzle1.done == true || (!instance_exists(obj_pl)))
2
    return;
3
if keyboard_multicheck_pressed(0)
4
{
5
    if (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; } }
() == true)
6
    {
7
        var xx = obj_pl.x + 64 * cos(degtorad(obj_pl.direction))
8
        var yy = obj_pl.y - 64 * sin(degtorad(obj_pl.direction))
9
        if collision_line_first(obj_pl.x, obj_pl.y, xx, yy, id, false, false)
10
        {
11
            if (obj_puzzle1.turn == 0)
12
            {
13
                if (row == 3)
14
                {
15
                    audio_play_sound(snd_switch, 1, 0)
16
                    image_index = 1
17
                    obj_puzzle1.turn = 1
18
                }
19
                else
20
                    audio_play_sound(snd_fail, 1, 0)
21
            }
22
            else if (obj_puzzle1.turn == 1)
23
            {
24
                if (row == 1)
25
                {
26
                    if (image_index == 0)
27
                    {
28
                        audio_play_sound(snd_switch, 1, 0)
29
                        image_index = 1
30
                        obj_puzzle1.turn = 2
31
                    }
32
                }
33
                else
34
                {
35
                    audio_play_sound(snd_fail, 1, 0)
36
                    obj_puzzle1.turn = 0
37
                    obj_lever.image_index = 0
38
                    obj_spikes.image_index = 0
39
                }
40
            }
41
            else if (obj_puzzle1.turn == 2)
42
            {
43
                if (row == 2)
44
                {
45
                    if (image_index == 0)
46
                    {
47
                        audio_play_sound(snd_switch, 1, 0)
48
                        image_index = 1
49
                        obj_puzzle1.turn = 3
50
                    }
51
                }
52
                else
53
                {
54
                    audio_play_sound(snd_fail, 1, 0)
55
                    obj_puzzle1.turn = 0
56
                    obj_lever.image_index = 0
57
                    obj_spikes.image_index = 0
58
                }
59
            }
60
        }
61
    }
62
}
63
if (image_index == 1)
64
{
65
    if (row == 1)
66
    {
67
        with (obj_spikes)
68
        {
69
            if (row == 1)
70
                image_index = 1
71
        }
72
    }
73
    if (row == 2)
74
    {
75
        with (obj_spikes)
76
        {
77
            if (row == 2)
78
                image_index = 1
79
        }
80
    }
81
    if (row == 3)
82
    {
83
        with (obj_spikes)
84
        {
85
            if (row == 3)
86
                image_index = 1
87
        }
88
    }
89
}
90
else if (image_index == 0)
91
{
92
    if (row == 1)
93
    {
94
        with (obj_spikes)
95
        {
96
            if (row == 1)
97
                image_index = 0
98
        }
99
    }
100
    if (row == 2)
101
    {
102
        with (obj_spikes)
103
        {
104
            if (row == 2)
105
                image_index = 0
106
        }
107
    }
108
    if (row == 3)
109
    {
110
        with (obj_spikes)
111
        {
112
            if (row == 3)
113
                image_index = 0
114
        }
115
    }
116
}