Undertale script viewer

← back to main script listing

gml_Object_obj_tileguy_Step_0

(view raw script w/o annotations or w/e)
1
if (moving == 1)
2
{
3
    x += 3;
4
    if (x >= (prevx + 18))
5
    {
6
        x = prevx + 20;
7
        event_user(1);
8
    }
9
}
10
if (moving == 2)
11
{
12
    y -= 3;
13
    if (y <= (prevy - 18))
14
    {
15
        y = prevy - 20;
16
        event_user(1);
17
    }
18
}
19
if (moving == 3)
20
{
21
    x -= 3;
22
    if (x <= (prevx - 18))
23
    {
24
        x = prevx - 20;
25
        event_user(1);
26
    }
27
}
28
if (moving == 4)
29
{
30
    y += 3;
31
    if (y >= (prevy + 18))
32
    {
33
        y = prevy + 20;
34
        event_user(1);
35
    }
36
}
37
if (moving == 0)
38
{
39
    if (!obj_time.left)
40
    {
41
        if (!obj_time.right)
42
        {
43
            if (!obj_time.down)
44
            {
45
                if (!obj_time.up)
46
                {
47
                    image_index = 0;
48
                    image_speed = 0;
49
                }
50
            }
51
        }
52
    }
53
}
54
if (moving == 1)
55
{
56
    sprite_index = spr_maincharar;
57
    image_speed = 0.334;
58
}
59
if (moving == 2)
60
{
61
    sprite_index = spr_maincharau;
62
    image_speed = 0.334;
63
}
64
if (moving == 3)
65
{
66
    sprite_index = spr_maincharal;
67
    image_speed = 0.334;
68
}
69
if (moving == 4)
70
{
71
    sprite_index = spr_maincharad;
72
    image_speed = 0.334;
73
}
74
if (obj_time.right)
75
{
76
    if (moving == 0)
77
    {
78
        if (image_index == 0)
79
            image_index = 1;
80
        sprite_index = spr_maincharar;
81
        checkx = x + 30;
82
        checky = y + 25;
83
        thistile = 0;
84
        event_user(0);
85
        nexttile = thistile;
86
        if (nexttile != 2)
87
        {
88
            moving = 1;
89
            prevx = x;
90
        }
91
    }
92
}
93
if (obj_time.up)
94
{
95
    if (moving == 0)
96
    {
97
        if (image_index == 0)
98
            image_index = 1;
99
        sprite_index = spr_maincharau;
100
        checkx = x + 10;
101
        checky = y + 5;
102
        thistile = 0;
103
        event_user(0);
104
        nexttile = thistile;
105
        if (nexttile != 2 && nexttile != 0)
106
        {
107
            moving = 2;
108
            prevy = y;
109
        }
110
    }
111
}
112
if (obj_time.left)
113
{
114
    if (moving == 0)
115
    {
116
        if (image_index == 0)
117
            image_index = 1;
118
        sprite_index = spr_maincharal;
119
        checkx = x - 10;
120
        checky = y + 25;
121
        thistile = 0;
122
        event_user(0);
123
        nexttile = thistile;
124
        if (nexttile != 2 && nexttile != 0)
125
        {
126
            moving = 3;
127
            prevx = x;
128
        }
129
    }
130
}
131
if (obj_time.down)
132
{
133
    if (moving == 0)
134
    {
135
        if (image_index == 0)
136
            image_index = 1;
137
        sprite_index = spr_maincharad;
138
        checkx = x + 10;
139
        checky = y + 45;
140
        thistile = 0;
141
        event_user(0);
142
        nexttile = thistile;
143
        if (nexttile != 2 && nexttile != 0)
144
        {
145
            moving = 4;
146
            prevy = y;
147
        }
148
    }
149
}
150
obj_mainchara.x = x;
151
obj_mainchara.y = y;