Undertale script viewer

← back to main script listing

gml_Object_obj_mainchara_Step_0

(view raw script w/o annotations or w/e)
1
if (global.facing == 0)
2
    sprite_index = dsprite;
3
if (global.facing == 1)
4
    sprite_index = rsprite;
5
if (global.facing == 2)
6
    sprite_index = usprite;
7
if (global.facing == 3)
8
    sprite_index = lsprite;
9
if (collision_point(bbox_left - 3, bbox_top - 3, obj_solidparent, 0, 1) == -4)
10
    crumpet = 1;
11
else
12
    crumpet = 2;
13
strumpet = bbox_top;
14
trumpet = bbox_left;
15
if (global.inbattle == 1)
16
{
17
    if (global.flag[15 in_battle] == 0)
18
    {
19
        instance_create(0, 0, obj_musfadein);
20
        caster_resume(global.currentsong);
21
    }
22
    room_persistent = false;
23
    global.inbattle = 0;
24
    if (global.specialbattle == 0)
25
        global.interact = 0;
26
    depth = 100;
27
    if (global.flag[200 kills_area_pointer] != 0)
28
    {
29
        if (global.flag[201 kills] != global.kills)
30
            global.flag[global.flag[200 kills_area_pointer]] += global.kills - global.flag[201 kills];
31
    }
32
}
33
if (obj_time.left)
34
{
35
    if (movement == 1)
36
    {
37
        turned = 1;
38
        if (xprevious == (x + 3))
39
            x -= 2;
40
        else
41
            x -= 3;
42
        if (moving != 1)
43
            image_index = 1;
44
        moving = 1;
45
        if (global.debug == 1)
46
        {
47
            if (keyboard_check(vk_backspace))
48
                x -= 5;
49
        }
50
        image_speed = 0.2;
51
        if (obj_time.up && global.facing == 2)
52
            turned = 0;
53
        if (obj_time.down && global.facing == 0)
54
            turned = 0;
55
        if (turned == 1)
56
            global.facing = 3;
57
    }
58
}
59
if (obj_time.up)
60
{
61
    if (movement == 1)
62
    {
63
        turned = 1;
64
        y -= 3;
65
        if (global.debug == 1)
66
        {
67
            if (keyboard_check(vk_backspace))
68
                y -= 5;
69
        }
70
        if (moving != 1)
71
            image_index = 1;
72
        moving = 1;
73
        image_speed = 0.2;
74
        if (obj_time.right && global.facing == 1)
75
            turned = 0;
76
        if (obj_time.left && global.facing == 3)
77
            turned = 0;
78
        if (turned == 1)
79
            global.facing = 2;
80
    }
81
}
82
if (obj_time.right)
83
{
84
    if (movement == 1)
85
    {
86
        if (obj_time.left == 0)
87
        {
88
            turned = 1;
89
            if (xprevious == (x - 3))
90
                x += 2;
91
            else
92
                x += 3;
93
            if (global.debug == 1)
94
            {
95
                if (keyboard_check(vk_backspace))
96
                    x += 5;
97
            }
98
            moving = 1;
99
            image_speed = 0.2;
100
            if (moving != 1)
101
                image_index = 1;
102
            if (obj_time.up && global.facing == 2)
103
                turned = 0;
104
            if (obj_time.down && global.facing == 0)
105
                turned = 0;
106
            if (turned == 1)
107
                global.facing = 1;
108
        }
109
    }
110
}
111
if (obj_time.down)
112
{
113
    if (movement == 1)
114
    {
115
        if (obj_time.up == 0)
116
        {
117
            turned = 1;
118
            y += 3;
119
            if (global.debug == 1)
120
            {
121
                if (keyboard_check(vk_backspace))
122
                    y += 5;
123
            }
124
            if (moving != 1)
125
                image_index = 1;
126
            moving = 1;
127
            image_speed = 0.2;
128
            if (obj_time.right && global.facing == 1)
129
                turned = 0;
130
            if (obj_time.left && global.facing == 3)
131
                turned = 0;
132
            if (turned == 1)
133
                global.facing = 0;
134
        }
135
    }
136
}
137
if (control_check_pressed(0))
138
    event_user(0);
139
if (control_check_pressed(2))
140
    event_user(2);
141
with (collision_rectangle(bbox_left, bbox_top, bbox_right, bbox_bottom, obj_doorparent, 0, 0))
142
    event_user(9);
143
if (instance_exists(obj_battler) == 0)
144
{
145
    scr_depth
scr_depth

depth = 50000 - ((y * 10) + (sprite_height * 10));
();
146
    if (global.flag[85 have_umbrella] == 1 && dsprite == spr_maincharad_umbrella)
147
        depth = 50000 - ((y * 10) + 300);
148
}