Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_rotationtile_tower_Step_0

(view raw script w/o annotations or w/e)
1
drawx = x;
2
drawy = y;
3
image_blend = merge_color(c_white, c_black, max(0, (y - 240) / 240));
4
if (init == 0)
5
{
6
    if (starter == 1)
7
        pattern = 4;
8
    else
9
        pattern = choose(0, 1, 2, 3);
10
    if (pattern == 0)
11
    {
12
        tiletype[0] = obj_marker;
13
        tiletype[1] = obj_marker;
14
        tiletype[2] = obj_marker;
15
        tiletype[3] = obj_marker;
16
        tiletype[4] = obj_holemouse_block_clockwise;
17
        tiletype[5] = obj_marker;
18
        tiletype[6] = obj_holemouse_block_counterclockwise;
19
        tiletype[7] = obj_holemouse_block_clockwise;
20
        rottype = 0;
21
        patidealy = 220 + (40 * choose(1, 2));
22
        puzSwitch = instance_create(x + 120, ((y + patidealy) - 220) + 40, obj_mice3_platSwitch);
23
        hole = instance_create(x + 40, y + 0, obj_holemouse_generator);
24
        staticTile[0] = instance_create(x + 0, y + 0, obj_holemouse_invis_clockwise);
25
        staticTile[1] = instance_create(x + 80, y + 0, obj_holemouse_invis_clockwise);
26
        staticTile[2] = instance_create(x + 0, y + 160, obj_holemouse_invis_clockwise);
27
        staticTile[3] = instance_create(x + 40, y + 160, obj_holemouse_invis_clockwise);
28
        staticTile[4] = instance_create(x + 80, y + 160, obj_holemouse_invis_clockwise);
29
    }
30
    if (pattern == 1)
31
    {
32
        tiletype[0] = obj_holemouse_block_clockwise;
33
        tiletype[1] = obj_holemouse_block_clockwise;
34
        tiletype[2] = obj_marker;
35
        tiletype[3] = obj_marker;
36
        tiletype[4] = obj_marker;
37
        tiletype[5] = obj_marker;
38
        rottype = 1;
39
        staticTile[0] = instance_create(x + 0, y + 0, obj_holemouse_invis_clockwise);
40
        staticTile[1] = instance_create(x + 80, y + 0, obj_holemouse_invis_clockwise);
41
        staticTile[2] = instance_create(x + 0, y + 160, obj_holemouse_invis_clockwise);
42
        staticTile[3] = instance_create(x + 40, y + 160, obj_holemouse_invis_clockwise);
43
        staticTile[4] = instance_create(x + 80, y + 160, obj_holemouse_invis_clockwise);
44
        hole = instance_create(x + 40, y + 0, obj_holemouse_generator);
45
        patidealy = 220 + (40 * choose(0, 1, 2));
46
        if (instance_exists(obj_masterPlatformController))
47
        {
48
            with (obj_masterPlatformController.noelle)
49
                idealy = other.patidealy;
50
        }
51
        puzSwitch = instance_create(x + 120, ((y + patidealy) - 220) + 40, obj_mice3_platSwitch);
52
    }
53
    if (pattern == 2)
54
    {
55
        tiletype[0] = obj_marker;
56
        tiletype[1] = obj_marker;
57
        tiletype[2] = obj_holemouse_block_counterclockwise;
58
        tiletype[3] = obj_marker;
59
        tiletype[4] = obj_marker;
60
        tiletype[5] = obj_marker;
61
        tiletype[6] = obj_holemouse_block_counterclockwise;
62
        tiletype[7] = obj_holemouse_block_clockwise;
63
        rottype = 0;
64
        patidealy = 220 + (40 * choose(1, 2));
65
        if (instance_exists(obj_masterPlatformController))
66
        {
67
            with (obj_masterPlatformController.noelle)
68
                idealy = other.patidealy;
69
        }
70
        puzSwitch = instance_create(x + 120, ((y + patidealy) - 220) + 40, obj_mice3_platSwitch);
71
        hole = instance_create(x + 0, y + 0, obj_holemouse_generator);
72
        staticTile[0] = instance_create(x + 40, y + 0, obj_holemouse_invis_counterclockwise);
73
        staticTile[1] = instance_create(x + 80, y + 0, obj_holemouse_invis_counterclockwise);
74
        staticTile[2] = instance_create(x + 0, y + 160, obj_holemouse_invis_clockwise);
75
        staticTile[3] = instance_create(x + 40, y + 160, obj_holemouse_invis_clockwise);
76
        staticTile[4] = instance_create(x + 80, y + 160, obj_holemouse_invis_clockwise);
77
    }
78
    if (pattern == 3)
79
    {
80
        tiletype[0] = obj_marker;
81
        tiletype[1] = obj_marker;
82
        tiletype[2] = obj_marker;
83
        tiletype[3] = obj_marker;
84
        tiletype[4] = obj_marker;
85
        tiletype[5] = obj_marker;
86
        tiletype[6] = obj_holemouse_block_counterclockwise;
87
        tiletype[7] = obj_holemouse_block_clockwise;
88
        rottype = 0;
89
        patidealy = 220 + (40 * choose(0, 2));
90
        if (instance_exists(obj_masterPlatformController))
91
        {
92
            with (obj_masterPlatformController.noelle)
93
                idealy = other.patidealy;
94
        }
95
        puzSwitch = instance_create(x + 120, ((y + patidealy) - 220) + 40, obj_mice3_platSwitch);
96
        hole = instance_create(x + 0, y + 0, obj_holemouse_generator);
97
        staticTile[0] = instance_create(x + 40, y + 0, obj_holemouse_invis_counterclockwise);
98
        staticTile[1] = instance_create(x + 80, y + 0, obj_holemouse_invis_counterclockwise);
99
        staticTile[2] = instance_create(x + 0, y + 160, obj_holemouse_invis_clockwise);
100
        staticTile[3] = instance_create(x + 40, y + 160, obj_holemouse_invis_clockwise);
101
        staticTile[4] = instance_create(x + 80, y + 160, obj_holemouse_invis_clockwise);
102
        staticTile[5] = instance_create(x + 40, y + 80, obj_holemouse_block_clockwise);
103
    }
104
    if (pattern == 4)
105
    {
106
        tiletype[0] = obj_marker;
107
        tiletype[1] = obj_marker;
108
        tiletype[2] = obj_marker;
109
        tiletype[3] = obj_marker;
110
        tiletype[4] = obj_marker;
111
        tiletype[5] = obj_holemouse_block_clockwise;
112
        tiletype[6] = obj_holemouse_block_clockwise;
113
        tiletype[7] = obj_marker;
114
        rottype = 0;
115
        patidealy = 260;
116
        if (instance_exists(obj_masterPlatformController))
117
        {
118
            with (obj_masterPlatformController.noelle)
119
                idealy = other.patidealy;
120
        }
121
        puzSwitch = instance_create(x + 120, ((y + patidealy) - 220) + 40, obj_mice3_platSwitch);
122
        hole = instance_create(x + 40, y + 0, obj_holemouse_generator);
123
        staticTile[0] = instance_create(x + 0, y + 0, obj_holemouse_invis_counterclockwise);
124
        staticTile[1] = instance_create(x + 80, y + 0, obj_holemouse_invis_counterclockwise);
125
        staticTile[2] = instance_create(x + 0, y + 160, obj_holemouse_invis_clockwise);
126
        staticTile[3] = instance_create(x + 40, y + 160, obj_holemouse_invis_clockwise);
127
        staticTile[4] = instance_create(x + 80, y + 160, obj_holemouse_invis_clockwise);
128
    }
129
    if (rottype == 0)
130
    {
131
        tilemax = 7;
132
        randomseed = floor(random(tilemax));
133
        for (i = 0; i <= tilemax; i++)
134
        {
135
            ishole[i] = 0;
136
            tile[i] = instance_create(x, y + 40, tiletype[i]);
137
            with (tile[i])
138
                
scr_mouse_tile_rotation_init
scr_mouse_tile_rotation_init

function
scr_mouse_tile_rotation_init()
{ __positionmax = 7; __positionmin = 0; __positionmove = 0; __currentposition = 0; __previousposition = 0; __nextposition = 0; __positionframes = 20; __move = 0; __positionspeed = 0; __moving = 0; __movetimer = 0; __movedx = 0; __movedy = 0; __con = 0; __positionx[0] = 0; __positionx[1] = 40; __positionx[2] = 80; __positionx[3] = 80; __positionx[4] = 80; __positionx[5] = 40; __positionx[6] = 0; __positionx[7] = 0; __positiony[0] = 0; __positiony[1] = 0; __positiony[2] = 0; __positiony[3] = 40; __positiony[4] = 80; __positiony[5] = 80; __positiony[6] = 80; __positiony[7] = 40; __init = 0; }
();
139
            randompos = i + randomseed;
140
            if (randompos > tilemax)
141
                randompos -= (tilemax + 1);
142
            tile[i].__currentposition = randompos;
143
        }
144
        tilemax++;
145
        tile[tilemax] = instance_create(x + 40, y, obj_marker);
146
        ishole[tilemax] = 1;
147
    }
148
    if (rottype == 1)
149
    {
150
        tilemax = 5;
151
        randomseed = floor(random(tilemax));
152
        for (i = 0; i <= tilemax; i++)
153
        {
154
            tile[i] = instance_create(x, y + 80, tiletype[i]);
155
            with (tile[i])
156
                
scr_mouse_tile_rotation_init
scr_mouse_tile_rotation_init

function
scr_mouse_tile_rotation_init()
{ __positionmax = 7; __positionmin = 0; __positionmove = 0; __currentposition = 0; __previousposition = 0; __nextposition = 0; __positionframes = 20; __move = 0; __positionspeed = 0; __moving = 0; __movetimer = 0; __movedx = 0; __movedy = 0; __con = 0; __positionx[0] = 0; __positionx[1] = 40; __positionx[2] = 80; __positionx[3] = 80; __positionx[4] = 80; __positionx[5] = 40; __positionx[6] = 0; __positionx[7] = 0; __positiony[0] = 0; __positiony[1] = 0; __positiony[2] = 0; __positiony[3] = 40; __positiony[4] = 80; __positiony[5] = 80; __positiony[6] = 80; __positiony[7] = 40; __init = 0; }
();
157
            randompos = i + randomseed;
158
            if (randompos > tilemax)
159
                randompos -= (tilemax + 1);
160
            tile[i].__currentposition = randompos;
161
            tile[i].__positionmax = 5;
162
            with (tile[i])
163
            {
164
                __positionx[0] = 0;
165
                __positiony[0] = 0;
166
                __positionx[1] = 40;
167
                __positiony[1] = 0;
168
                __positionx[2] = 80;
169
                __positiony[2] = 0;
170
                __positionx[3] = 80;
171
                __positiony[3] = 40;
172
                __positionx[4] = 40;
173
                __positiony[4] = 40;
174
                __positionx[5] = 0;
175
                __positiony[5] = 40;
176
            }
177
        }
178
        tilemax++;
179
        tile[tilemax] = instance_create(x + 40, y, obj_marker);
180
        ishole[tilemax] = 1;
181
    }
182
    with (obj_marker)
183
        visible = 0;
184
    visible = 1;
185
    init = 1;
186
}
187
for (i = 0; i <= tilemax; i++)
188
{
189
    if (ishole[i] == 0)
190
    {
191
        with (tile[i])
192
            
scr_mouse_tile_rotation_step
scr_mouse_tile_rotation_step

function
scr_mouse_tile_rotation_step()
{ if (__init == 0) { x += __positionx[__currentposition]; __movedx += __positionx[__currentposition]; y += __positiony[__currentposition]; __movedy += __positiony[__currentposition]; __nextposition = __currentposition; __init = 1; } if (__con == 0) { if (__move != 0) { __nextposition = __currentposition + __move; if (__nextposition < 0) __nextposition = __positionmax; if (__nextposition > __positionmax) __nextposition = 0; } if (__nextposition != __currentposition) { __curmovedx = __movedx; __curmovedy = __movedy; __nextmovedx = __positionx[__nextposition]; __nextmovedy = __positiony[__nextposition]; __movetimer = 0; __con = 1; } } if (__con == 1) { __movetimer++; x += ((__nextmovedx - __movedx) / __positionframes); y += ((__nextmovedy - __movedy) / __positionframes); if (__movetimer >= __positionframes) { __movetimer = 0; __con = 0; __movedx = __positionx[__nextposition]; __movedy = __positiony[__nextposition]; __currentposition = __nextposition; } } }
();
193
    }
194
}
195
if (phase == 0)
196
{
197
    if (freeze == 0)
198
    {
199
        timer++;
200
        if (x > rx || y > ry)
201
        {
202
            if (x > rx)
203
                x -= max(4, 20 - (timer / 2));
204
            else
205
                x = rx;
206
            if (y > (ry + 2))
207
                y = lerp(y, ry, 0.25);
208
            else
209
                y = ry;
210
        }
211
        else
212
        {
213
            timer = 0;
214
            phase = 1;
215
            x = rx;
216
            y = ry;
217
        }
218
    }
219
}
220
if (phase == 1)
221
{
222
}
223
if (phase == 2)
224
{
225
    if (x > lx)
226
    {
227
        x -= max(4, 10 - (timer / 2));
228
    }
229
    else
230
    {
231
        x = lx;
232
        phase = 3;
233
    }
234
}
235
if (phase == 3)
236
{
237
    if (freeze == 0)
238
        falltimer++;
239
    if (falltimer >= (fallthreshhold - 90))
240
        x = lx + random_range(-2, 2);
241
    if (falltimer >= fallthreshhold)
242
    {
243
        with (obj_masterPlatformController)
244
            failure = 1;
245
        phase = 3.5;
246
    }
247
}
248
if (keyboard_check_pressed(ord("F")))
249
    falltimer = fallthreshhold - 15;
250
if (phase == 3.5)
251
{
252
    failure = 1;
253
    hole.closed = true;
254
    if (i_ex(obj_holemouse))
255
        snd_play(snd_mouse);
256
    if (i_ex(obj_holemouse))
257
    {
258
        with (obj_holemouse)
259
        {
260
            jumper = 
scr_afterimage
scr_afterimage

function
scr_afterimage()
{ afterimage = instance_create(x, y, obj_afterimage); afterimage.sprite_index = sprite_index; afterimage.image_index = image_index; afterimage.image_blend = image_blend; afterimage.image_speed = 0; afterimage.depth = depth; afterimage.image_xscale = image_xscale; afterimage.image_yscale = image_yscale; afterimage.image_angle = image_angle; return afterimage; }
();
261
            with (jumper)
262
                
scr_jump_to_point
scr_jump_to_point

function
scr_jump_to_point(arg0, arg1, arg2, arg3)
{ return
scr_jump_to_point_sprite(arg0, arg1, arg2, arg3, 0, 0);
}
(x + random_range(-40, 40), room_height + (sprite_height * 2), 20, 16);
263
            jumper.sprite_index = spr_holemouse_emerge;
264
            instance_destroy();
265
        }
266
    }
267
    phase = 4;
268
}
269
if (phase == 4)
270
{
271
    gravity = 1.5;
272
    hole.closed = true;
273
    if (failure == 1)
274
    {
275
        x = lx + random_range(-2, 2);
276
        if (y >= 600)
277
        {
278
            obj_masterPlatformController.makenewplatform = 1;
279
            instance_destroy();
280
        }
281
    }
282
    else
283
    {
284
        hspeed = -8;
285
        phase = 5;
286
    }
287
}
288
if (phase == 5)
289
{
290
    if (y >= 600)
291
        instance_destroy();
292
}
293
if (hole.mousecreate == 1 || instance_exists(obj_holemouse) || phase < 3 || failure == 1 || (instance_exists(obj_mouseTowerTrigger) && obj_mouseTowerTrigger.blocked == 1))
294
    move = 0;
295
for (i = 0; i <= tilemax; i++)
296
{
297
    if (ishole[i] == 0)
298
    {
299
        if (i_ex(tile[i]))
300
            tile[i].__move = move;
301
        if (i_ex(tile[i]))
302
        {
303
            with (tile[i])
304
                
scr_mouse_tile_rotation_step
scr_mouse_tile_rotation_step

function
scr_mouse_tile_rotation_step()
{ if (__init == 0) { x += __positionx[__currentposition]; __movedx += __positionx[__currentposition]; y += __positiony[__currentposition]; __movedy += __positiony[__currentposition]; __nextposition = __currentposition; __init = 1; } if (__con == 0) { if (__move != 0) { __nextposition = __currentposition + __move; if (__nextposition < 0) __nextposition = __positionmax; if (__nextposition > __positionmax) __nextposition = 0; } if (__nextposition != __currentposition) { __curmovedx = __movedx; __curmovedy = __movedy; __nextmovedx = __positionx[__nextposition]; __nextmovedy = __positiony[__nextposition]; __movetimer = 0; __con = 1; } } if (__con == 1) { __movetimer++; x += ((__nextmovedx - __movedx) / __positionframes); y += ((__nextmovedy - __movedy) / __positionframes); if (__movetimer >= __positionframes) { __movetimer = 0; __con = 0; __movedx = __positionx[__nextposition]; __movedy = __positiony[__nextposition]; __currentposition = __nextposition; } } }
();
305
        }
306
        if (i_ex(tile[i]))
307
            tilecon = tile[i].__con;
308
    }
309
}
310
if (i_ex(tile[0]))
311
{
312
    if (tile[0].__con == 0)
313
        moving = false;
314
    else
315
        moving = true;
316
}