Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_board_antlion_Step_0

(view raw script w/o annotations or w/e)
1
if (init == 0)
2
{
3
    speed = minspeed;
4
    init = 1;
5
}
6
if (con == 0)
7
{
8
    image_alpha = 0;
9
    speed = lerp(speed, minspeed, 0.25);
10
    timer++;
11
    if (timer == 1)
12
        inactivetarg = irandom_range(50, 90);
13
    if (timer >= inactivetarg)
14
    {
15
        image_alpha = 1;
16
        image_index = 0;
17
        timer = 0;
18
        con = 0.5;
19
        var specialcheck = 0;
20
        with (object_index)
21
        {
22
            if (special == 1)
23
                specialcheck = 1;
24
        }
25
        if (global.flag[1227 got_antlion_photo] == 1)
26
            specialcheck = 1;
27
        if (!variable_instance_exists(id, "nospecialsanymore"))
28
            nospecialsanymore = 0;
29
        if (nospecialsanymore)
30
            specialcheck = 1;
31
        if (specialcheck == 0)
32
            special = choose(0, 0, 0, 1);
33
        if ((direction % 90) == 0)
34
        {
35
            debug_print("too still!");
36
            direction = 33 * choose(1, 2, 3, 4);
37
        }
38
    }
39
}
40
if (con == 0.5)
41
{
42
    timer++;
43
    if (timer == 2)
44
        image_index = 1;
45
    if (timer == 4)
46
        image_index = 2;
47
    if (timer == 6)
48
    {
49
        con = 1;
50
        image_index = 3;
51
    }
52
}
53
if (con == 1)
54
{
55
    speed = lerp(speed, maxspeed, 0.25);
56
    timer++;
57
    if (timer == 1)
58
    {
59
        activetarg = irandom_range(30, 60);
60
        if (special)
61
            activetarg = irandom_range(25, 40);
62
    }
63
    if ((timer % 4) == 0)
64
    {
65
        if (image_index == 5)
66
            image_index = 4;
67
        else
68
            image_index = 5;
69
    }
70
    if (timer >= activetarg)
71
    {
72
        timer = 0;
73
        con = 2;
74
        image_index = 3;
75
    }
76
}
77
if (con == 2)
78
{
79
    speed = lerp(speed, minspeed, 0.25);
80
    timer++;
81
    if (timer == 2)
82
        image_index = 2;
83
    if (timer == 4)
84
        image_index = 1;
85
    if (timer == 6)
86
        image_index = 0;
87
    if (timer == 8)
88
    {
89
        image_alpha = 0;
90
        timer = 0;
91
        con = 0;
92
        if (hide == 1)
93
            con = 40;
94
        special = 0;
95
    }
96
}
97
if (con == 99)
98
{
99
    timer++;
100
    if (timer == 10)
101
    {
102
        with (instance_create(x + 16, y + 16, obj_board_perfumefountainphotoeffect))
103
            depth = other.depth - 1000;
104
    }
105
    if (timer == 100)
106
    {
107
        speed = memspeed;
108
        con = 2;
109
        timer = 0;
110
    }
111
}
112
if (con == 50)
113
{
114
    timer++;
115
    if (timer == 0)
116
    {
117
        image_alpha = 1;
118
        snd_play_x(snd_board_splash, 0.7, 0.6);
119
    }
120
    if (timer == 2)
121
        image_index = 1;
122
    if (timer == 4)
123
        image_index = 2;
124
    if (timer == 6)
125
    {
126
        snd_play_x(snd_board_splash, 1, 1.2);
127
        con = 51;
128
        timer = 0;
129
        image_index = 3;
130
    }
131
}
132
if (con == 51)
133
{
134
    speed = 0;
135
    timer++;
136
    if ((timer % 4) == 0)
137
    {
138
        if (image_index == 5)
139
            image_index = 4;
140
        else
141
            image_index = 5;
142
    }
143
}
144
scr_depth_board
scr_depth_board

function
scr_depth_board()
{ depth = 1000000 - ((y * 10) + ((sprite_height - sprite_yoffset) * 10)); } function scr_board_depth() {
scr_depth_board();
}
();
145
if (con < 50)
146
{
147
    if (x < board_tilex(1))
148
    {
149
        hspeed = -hspeed;
150
        x = board_tilex(1);
151
    }
152
    if (x > board_tilex(10))
153
    {
154
        hspeed = -hspeed;
155
        x = board_tilex(10);
156
    }
157
    if (y > board_tiley(6))
158
    {
159
        vspeed = -vspeed;
160
        y = board_tiley(6);
161
    }
162
    if (y < board_tiley(2.25))
163
    {
164
        vspeed = -vspeed;
165
        y = board_tiley(2.25);
166
    }
167
    var dobounce = 0;
168
    if (dobounce)
169
    {
170
        if (image_alpha == 1)
171
        {
172
            var meet = instance_place(x + hspeed, y + vspeed, object_index);
173
            if (i_ex(meet))
174
            {
175
                if (meet.image_alpha == 1)
176
                {
177
                    hspeed = -hspeed;
178
                    vspeed = -vspeed;
179
                    meet.hspeed = -hspeed;
180
                    meet.vspeed = -vspeed;
181
                }
182
            }
183
        }
184
    }
185
}
186
if (obj_board_camera.shift != "none")
187
    instance_destroy();