Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_berdly_tornadomaker_Step_0

(view raw script w/o annotations or w/e)
1
if (global.turntimer < 1)
2
    instance_destroy();
3
if (difficulty != 3 && lerpintimer < 16)
4
{
5
    y = lerp(ystart - 200, ystart + 20, lerpintimer / 15);
6
    lerpintimer++;
7
}
8
if (difficulty == 3 && lerpintimer < 11)
9
{
10
    y = lerp(ystart - 200, ystart + 20, lerpintimer / 10);
11
    lerpintimer++;
12
}
13
if (con == 0)
14
{
15
    image_index = 0;
16
    timer++;
17
    remx = x;
18
    remy = y;
19
    timerthreshold = 15;
20
    if (difficulty == 3)
21
        timerthreshold = 10;
22
    if (timer >= timerthreshold)
23
    {
24
        timer = 0;
25
        con = 1;
26
    }
27
}
28
if (con == 1)
29
{
30
    x = remx + random_range(-2, 2);
31
    y = remy + random_range(-2, 2);
32
    image_index = 1;
33
    timer++;
34
    if (timer >= 15)
35
    {
36
        timer = 0;
37
        x = remx;
38
        y = remy;
39
        con = 2;
40
        image_index = 2;
41
    }
42
}
43
if (con == 2)
44
{
45
    con = 3;
46
    if (difficulty == 0)
47
    {
48
        for (i = 0; i < 3; i++)
49
        {
50
            tornadol = instance_create(x, (y - 20) + (i * 20), obj_berdly_tornadomaker_tornado);
51
            tornadol.maxhspeed = 6;
52
            tornadol.hspeed = -12;
53
            tornadol.howlong = 32 + (i * 8);
54
            tornadol.howfar = -1 + i;
55
            tornador = instance_create(x, (y - 20) + (i * 20), obj_berdly_tornadomaker_tornado);
56
            tornador.maxhspeed = -6;
57
            tornador.hspeed = 12;
58
            tornador.howlong = 32 + (i * 8);
59
            tornador.howfar = -1 + i;
60
        }
61
    }
62
    if (difficulty == 1 || difficulty == 3)
63
    {
64
        yorder[0] = 0;
65
        yorder[1] = 0;
66
        yorder[2] = 0;
67
        yorder[choose(0, 1, 2)] = 1;
68
        chosen = 0;
69
        while (chosen == 0)
70
        {
71
            nextyorder = choose(0, 1, 2);
72
            if (yorder[nextyorder] == 0)
73
            {
74
                yorder[nextyorder] = 2;
75
                chosen = 1;
76
            }
77
        }
78
        hvariance = random_range(-1, 1);
79
        for (i = 0; i < 3; i++)
80
        {
81
            tornadol = instance_create(x, (y - 20) + (i * 20), obj_berdly_tornadomaker_tornado);
82
            tornadol.maxhspeed = 6;
83
            tornadol.hspeed = -12 + hvariance;
84
            tornadol.howlong = 32 + (i * 8);
85
            tornadol.howfar = -1 + yorder[i];
86
            tornador = instance_create(x, (y - 20) + (i * 20), obj_berdly_tornadomaker_tornado);
87
            tornador.maxhspeed = -6;
88
            tornador.hspeed = 12 + hvariance;
89
            tornador.howlong = 32 + (i * 8);
90
            tornador.howfar = -1 + yorder[i];
91
        }
92
    }
93
    if (difficulty == 2)
94
    {
95
        yorder[0] = 0;
96
        yorder[1] = 0;
97
        yorder[2] = 0;
98
        yorder[choose(0, 1, 2)] = 1;
99
        chosen = 0;
100
        while (chosen == 0)
101
        {
102
            nextyorder = choose(0, 1, 2);
103
            if (yorder[nextyorder] == 0)
104
            {
105
                yorder[nextyorder] = 2;
106
                chosen = 1;
107
            }
108
        }
109
        for (i = 0; i < 3; i++)
110
        {
111
            hvariance = random(2) * choose(-1, 1);
112
            timevariance = random(4);
113
            tornadol = instance_create(x, (y - 20) + (i * 20), obj_berdly_tornadomaker_tornado);
114
            tornadol.maxhspeed = 6;
115
            tornadol.hspeed = -12 + hvariance;
116
            tornadol.howlong = 32 + (i * 8) + timevariance;
117
            tornadol.howfar = -1 + yorder[i];
118
            tornador = instance_create(x, (y - 20) + (i * 20), obj_berdly_tornadomaker_tornado);
119
            tornador.maxhspeed = -6;
120
            tornador.hspeed = 12 + hvariance;
121
            tornador.howlong = 32 + (i * 8) + timevariance;
122
            tornador.howfar = -1 + yorder[i];
123
        }
124
    }
125
}
126
if (con == 3)
127
{
128
    timer++;
129
    timerthreshold = 33;
130
    if (difficulty == 3)
131
        timerthreshold = 24;
132
    if (timer >= 2)
133
        image_index = 3;
134
    if (timer >= 4)
135
        image_index = 4;
136
    if (timer >= timerthreshold)
137
    {
138
        image_index = 0;
139
        timer = 0;
140
        con = 0;
141
    }
142
}