Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_rotationTile_track1_Step_0

(view raw script w/o annotations or w/e)
1
if (init == 0)
2
{
3
    tiletype[0] = obj_marker;
4
    tiletype[1] = obj_holemouse_block_counterclockwise;
5
    tiletype[2] = obj_marker;
6
    tiletype[3] = obj_marker;
7
    tiletype[4] = obj_marker;
8
    tiletype[5] = obj_holemouse_block_counterclockwise;
9
    tiletype[6] = obj_marker;
10
    tiletype[7] = obj_marker;
11
    tiletype[8] = obj_holemouse_block_counterclockwise;
12
    tiletype[9] = obj_marker;
13
    rottype = 0;
14
    hole = instance_create(x + 40, y + 0, obj_marker);
15
    tilemax = 9;
16
    randomseed = floor(random(tilemax));
17
    for (i = 0; i <= tilemax; i++)
18
    {
19
        tile[i] = instance_create(x, y, tiletype[i]);
20
        with (tile[i])
21
            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; }
();
22
        randompos = i + randomseed;
23
        if (randompos > tilemax)
24
            randompos -= (tilemax + 1);
25
        tile[i].__currentposition = randompos;
26
        tile[i].__positionmax = 9;
27
        with (tile[i])
28
        {
29
            __positionx[0] = 0;
30
            __positiony[0] = 0;
31
            __positionx[1] = 40;
32
            __positiony[1] = 0;
33
            __positionx[2] = 80;
34
            __positiony[2] = 0;
35
            __positionx[3] = 80;
36
            __positiony[3] = 40;
37
            __positionx[4] = 80;
38
            __positiony[4] = 80;
39
            __positionx[5] = 80;
40
            __positiony[5] = 120;
41
            __positionx[6] = 40;
42
            __positiony[6] = 120;
43
            __positionx[7] = 0;
44
            __positiony[7] = 120;
45
            __positionx[8] = 0;
46
            __positiony[8] = 80;
47
            __positionx[9] = 0;
48
            __positiony[9] = 40;
49
        }
50
    }
51
    tilemax++;
52
    tile[tilemax] = instance_create(x + 40, y, obj_marker);
53
    ishole[tilemax] = 1;
54
    with (obj_marker)
55
        visible = 0;
56
    visible = 1;
57
    init = 1;
58
}
59
for (i = 0; i <= tilemax; i++)
60
{
61
    if (ishole[i] == 0)
62
    {
63
        with (tile[i])
64
            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; } } }
();
65
    }
66
}
67
if (phase == 0)
68
    phase = 1;
69
if (phase == 1)
70
{
71
}
72
if (phase == 2)
73
{
74
    if (x > lx)
75
    {
76
        x -= max(4, 10 - (timer / 2));
77
    }
78
    else
79
    {
80
        x = lx;
81
        phase = 3;
82
    }
83
}
84
if (phase == 3)
85
{
86
    if (instance_exists(obj_noelle_scared))
87
    {
88
        if (obj_noelle_scared.waiting == true)
89
            falltimer++;
90
    }
91
}
92
for (i = 0; i <= tilemax; i++)
93
{
94
    if (ishole[i] == 0)
95
    {
96
        if (i_ex(tile[i]))
97
            tile[i].__move = move;
98
        if (i_ex(tile[i]))
99
        {
100
            with (tile[i])
101
                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; } } }
();
102
        }
103
        if (i_ex(tile[i]))
104
            tilecon = tile[i].__con;
105
    }
106
}
107
if (i_ex(tile[0]))
108
{
109
    if (tile[0].__con == 0)
110
        moving = false;
111
    else
112
        moving = true;
113
}