Deltarune (Chapter 1) script viewer

← back to main script listing

gml_Object_obj_npc_facing_Create_0

(view raw script w/o annotations or w/e)
1
dtsprite = spr_toriel_dt;
2
rtsprite = spr_toriel_rt;
3
ltsprite = spr_toriel_lt;
4
utsprite = spr_toriel_ut;
5
myinteract = 0;
6
facing = 0;
7
dfacing = 0;
8
image_speed = 0;
9
talked = 0;
10
ourcase = 0;
11
if (global.darkzone == 1)
12
{
13
    image_xscale = 2;
14
    image_yscale = 2;
15
}
16
normalanim = 1;
17
remanimspeed = 0;
18
depthbonus = 0;
19
depthcancel = 0;
20
if (room == room_alphysclass)
21
{
22
    facing = 2;
23
    dfacing = 2;
24
    ourcase = 1;
25
    if (y < 172)
26
    {
27
        dtsprite = spr_noelle_dt;
28
        rtsprite = spr_noelle_ut_r;
29
        utsprite = spr_noelle_ut;
30
        ltsprite = spr_noelle_ut_l;
31
        if (x > 120)
32
        {
33
            utsprite = spr_berdly_ut;
34
            rtsprite = spr_berdly_ut_r;
35
            ltsprite = spr_berdly_ut_l;
36
            dtsprite = spr_berdly_ut;
37
        }
38
    }
39
    if (y > 172)
40
    {
41
        dtsprite = spr_catti_ut;
42
        utsprite = spr_catti_ut;
43
        rtsprite = spr_catti_ut;
44
        ltsprite = spr_catti_ut;
45
        if (x > 120)
46
        {
47
            dtsprite = spr_mkid_ut;
48
            rtsprite = spr_mkid_ut_r;
49
            ltsprite = spr_mkid_ut_l;
50
            utsprite = spr_mkid_ut;
51
        }
52
    }
53
    if (y > 212)
54
    {
55
        dtsprite = spr_jockington_ut;
56
        utsprite = spr_jockington_ut;
57
        rtsprite = spr_jockington_rt;
58
        ltsprite = spr_jockington_lt;
59
        if (x > 120)
60
        {
61
            utsprite = spr_snowy_ut;
62
            ltsprite = spr_snowy_ut_l;
63
            rtsprite = spr_snowy_ut_r;
64
            dtsprite = spr_snowy_ut;
65
        }
66
    }
67
    if (y < 100)
68
    {
69
        facing = 0;
70
        dfacing = 0;
71
        dtsprite = spr_alphysd;
72
        ltsprite = spr_alphysl;
73
        rtsprite = spr_alphysr;
74
        utsprite = spr_alphysu;
75
    }
76
}
77
if (room == room_field2)
78
{
79
    facing = 0;
80
    dfacing = 0;
81
    dtsprite = spr_lancer_dt;
82
    utsprite = spr_lancer_dt;
83
    rtsprite = spr_lancer_rt;
84
    ltsprite = spr_lancer_lt;
85
    if (room == room_field2)
86
    {
87
        if (global.plot >= 35)
88
            instance_destroy();
89
    }
90
}
91
if (room == room_forest_maze_deadend)
92
{
93
    facing = 0;
94
    dfacing = 0;
95
    if (global.plot < 95)
96
        global.plot = 95;
97
    global.flag[293 lancer_deadend] += 1;
98
    dtsprite = spr_lancer_dt;
99
    utsprite = spr_lancer_dt;
100
    rtsprite = spr_lancer_rt;
101
    ltsprite = spr_lancer_lt;
102
    if (global.plot >= 120)
103
        instance_destroy();
104
}
105
if (room == room_forest_maze_deadend2)
106
{
107
    facing = 2;
108
    dfacing = 2;
109
    global.flag[294 susie_deadend] += 1;
110
    dtsprite = spr_susied_dark;
111
    utsprite = spr_susieu_dark;
112
    rtsprite = spr_susier_dark;
113
    ltsprite = spr_susiel_dark;
114
    if (global.plot >= 120)
115
        instance_destroy();
116
}
117
if (room == room_field_boxpuzzle)
118
{
119
    type = 0;
120
    if (x < (room_width / 2))
121
    {
122
        sprite_index = spr_ralseid;
123
        dtsprite = spr_ralseid;
124
        utsprite = spr_ralseiu;
125
        rtsprite = spr_ralseir;
126
        ltsprite = spr_ralseil;
127
        y += sprite_height;
128
    }
129
    else
130
    {
131
        type = 1;
132
        sprite_index = spr_susied;
133
        dtsprite = spr_susied_dark;
134
        utsprite = spr_susieu_dark;
135
        rtsprite = spr_susier_dark;
136
        ltsprite = spr_susiel_dark;
137
        y += sprite_height;
138
    }
139
}
140
if (room == room_cc_kingbattle)
141
{
142
    if (global.plot < 240)
143
        instance_destroy();
144
    sprite_index = spr_ralseid;
145
    dtsprite = spr_ralseid;
146
    utsprite = spr_ralseiu;
147
    rtsprite = spr_ralseir;
148
    ltsprite = spr_ralseil;
149
    y += sprite_height;
150
}
151
if (room == room_cc_throneroom)
152
{
153
    if (global.plot < 240)
154
        instance_destroy();
155
    sprite_index = spr_lancer_dt;
156
    dtsprite = spr_lancer_dt;
157
    utsprite = spr_lancer_ut;
158
    rtsprite = spr_lancer_rt;
159
    ltsprite = spr_lancer_lt;
160
    y += sprite_height;
161
    depthbonus = -250;
162
}
163
if (room == room_forest_area1)
164
{
165
    sprite_index = spr_susier_dark;
166
    rtsprite = spr_susier_dark;
167
    dtsprite = spr_susied_dark;
168
    utsprite = spr_susieu_dark;
169
    ltsprite = spr_susiel_dark;
170
    facing = 1;
171
    dfacing = 1;
172
    if (x >= 1160)
173
    {
174
        facing = 3;
175
        dfacing = 3;
176
        sprite_index = spr_lancer_lt;
177
        dtsprite = spr_lancer_dt;
178
        utsprite = spr_lancer_dt;
179
        rtsprite = spr_lancer_rt;
180
        ltsprite = spr_lancer_lt;
181
    }
182
    if (global.plot > 70)
183
        instance_destroy();
184
}
185
if (room == room_forest_area3)
186
{
187
    if (x >= 600)
188
    {
189
        facing = 2;
190
        dfacing = 2;
191
        sprite_index = spr_lancer_ut;
192
        dtsprite = spr_lancer_dt;
193
        utsprite = spr_lancer_ut;
194
        rtsprite = spr_lancer_rt;
195
        ltsprite = spr_lancer_lt;
196
    }
197
    else
198
    {
199
        facing = 2;
200
        dfacing = 2;
201
        sprite_index = spr_susieut_dark;
202
        dtsprite = spr_susiedt_dark;
203
        utsprite = spr_susieut_dark;
204
        rtsprite = spr_susiert_dark;
205
        ltsprite = spr_susielt_dark;
206
    }
207
}
208
if (room == room_library)
209
{
210
    if (x < 120)
211
    {
212
        facing = 1;
213
        dfacing = 1;
214
        dtsprite = spr_berdly_library_r;
215
        utsprite = spr_berdly_library_u;
216
        rtsprite = spr_berdly_library_r;
217
        ltsprite = spr_berdly_library_u;
218
        depthcancel = 1;
219
        depth = 4000;
220
    }
221
    if (x > 150)
222
    {
223
        facing = 1;
224
        dfacing = 1;
225
        dtsprite = spr_jockington_ut;
226
        utsprite = spr_jockington_ut;
227
        rtsprite = spr_jockington_rt;
228
        ltsprite = spr_jockington_lt;
229
    }
230
    if (x > 220)
231
    {
232
        facing = 3;
233
        dfacing = 3;
234
        dtsprite = spr_tem_sit_l;
235
        rtsprite = spr_tem_sit_r;
236
        utsprite = spr_tem_sit;
237
        ltsprite = spr_tem_sit_l;
238
    }
239
}
240
if (room == room_flowershop_1f)
241
{
242
    facing = 0;
243
    dfacing = 0;
244
    dtsprite = spr_asgored;
245
    utsprite = spr_asgoreu;
246
    rtsprite = spr_asgorer;
247
    ltsprite = spr_asgorel;
248
}
249
if (room == room_flowershop_2f)
250
{
251
    facing = 2;
252
    dfacing = 2;
253
    dtsprite = spr_asgored;
254
    utsprite = spr_asgoreu;
255
    rtsprite = spr_asgorer;
256
    ltsprite = spr_asgorel;
257
}
258
if (room == room_alphysalley)
259
{
260
    facing = 3;
261
    dfacing = 3;
262
    dtsprite = spr_alphysd;
263
    utsprite = spr_alphysu;
264
    rtsprite = spr_alphysr;
265
    ltsprite = spr_alphysl;
266
}
267
if (room == room_town_south)
268
{
269
    facing = 0;
270
    dfacing = 0;
271
    dtsprite = spr_undyne_dt;
272
    utsprite = spr_undyne_ut;
273
    rtsprite = spr_undyne_rt;
274
    ltsprite = spr_undyne_lt;
275
}
276
if (room == room_town_mid)
277
{
278
    facing = 0;
279
    dfacing = 0;
280
    dtsprite = spr_sans_d;
281
    ltsprite = spr_sans_l;
282
    utsprite = spr_sans_u;
283
    rtsprite = spr_sans_r;
284
}
285
if (room == room_town_north)
286
{
287
    facing = 3;
288
    dfacing = 3;
289
    dtsprite = spr_noelle_dt;
290
    ltsprite = spr_noelle_lt;
291
    utsprite = spr_noelle_ut;
292
    rtsprite = spr_noelle_rt;
293
    if (global.flag[255 talk_rudy_ch1] < 1)
294
        instance_destroy();
295
}
296
scr_npcdir
scr_npcdir

function
scr_npcdir()
{ if (facing == 0) sprite_index = dtsprite; if (facing == 1) sprite_index = rtsprite; if (facing == 2) sprite_index = utsprite; if (facing == 3) sprite_index = ltsprite; }
();
297
y -= sprite_height;
298
if (depthcancel == 0)
299
    
scr_depth
scr_depth

function
scr_depth()
{ depth = 100000 - ((y * 10) + (sprite_height * 10)); }
();
300
depth += depthbonus;