Deltarune script viewer

← back to main script listing

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