Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_rouxls_enemy_old_copy_Draw_0

(view raw script w/o annotations or w/e)
1
if (state == 3)
2
{
3
    
scr_enemyhurt_tired_after_damage
scr_enemyhurt_tired_after_damage

function
scr_enemyhurt_tired_after_damage(arg0)
{ if (global.monsterhp[myself] <= (global.monstermaxhp[myself] * arg0))
scr_monster_make_tired(myself);
}
(0.5);
4
    
scr_enemy_drawhurt_generic
scr_enemy_drawhurt_generic

function
scr_enemy_drawhurt_generic()
{ hurttimer -= 1; if (hurttimer < 0) { state = 0; } else { if (global.monster[myself] == 0)
scr_defeatrun();
hurtshake += 1; if (hurtshake > 1) { if (shakex > 0) shakex -= 1; if (shakex < 0) shakex += 1; shakex = -shakex; hurtshake = 0; } draw_sprite_ext(hurtsprite, 0, x + shakex + hurtspriteoffx, y + hurtspriteoffy, 2, 2, 0, image_blend, 1); } }
();
5
}
6
fixy = 0;
7
if (global.flag[221 thrash_machine_body] == 2)
8
    fixy = 10;
9
if (global.flag[221 thrash_machine_body] == 3)
10
    fixy = 26;
11
thrash.xx = x + 34;
12
thrash.yy = y + 108;
13
if (state == 0)
14
{
15
    fsiner += 1;
16
    if (saberanim)
17
    {
18
        if (thissprite != sabersprite)
19
        {
20
            siner = 0;
21
            thissprite = sabersprite;
22
        }
23
        else if (siner < 3)
24
        {
25
            siner++;
26
        }
27
    }
28
    else
29
    {
30
        siner += 0.16666666666666666;
31
        thissprite = idlesprite;
32
        if (global.mercymod[myself] >= global.mercymax[myself])
33
            thissprite = sparedsprite;
34
    }
35
    var xpos = (thrashcon == 0) ? x : remx;
36
    if (thrashcon > 2 && thrashcon != 6)
37
        draw_monster_body_part(thissprite, siner, xpos, y + floatheight);
38
    else
39
        draw_monster_body_part(thissprite, siner, xpos, y + (thrash.s * thrash.walkc) + fixy);
40
}
41
if (becomeflash == 0)
42
    flash = 0;
43
becomeflash = 0;
44
if (
scr_debug
scr_debug

function
scr_debug()
{ return 0; }
())
45
{
46
    global.flag[220 thrash_machine_head] = 3;
47
    global.flag[221 thrash_machine_body] = 0;
48
    global.flag[222 thrash_machine_shoe] = 3;
49
}
50
var turretbody = thrash.part[0] == 2;
51
thrash.s = 3;
52
var puddx = remx + (turretbody ? 18 : 34);
53
var puddy = remy + 173 + ((thrash.s * thrash.walkc) / 4);
54
puddle.x = puddx;
55
puddle.y = remy + 173 + ((thrash.s * cos((thrash.wsiner + thrash.wsinerrate) / 3)) / 4);
56
if (thrashcon < 2 || thrashcon > 5)
57
    draw_sprite_ext(spr_rouxls_puddle, turretbody ? 3 : 1, puddx, puddy, 2, 2, 0, c_lime, 1);
58
puddle.image_index = turretbody ? 2 : 0;
59
if (thrashmode == 0)
60
{
61
}
62
if (thrashmode == 1)
63
{
64
    if (thrashcon == 0)
65
    {
66
        thrashtimer = 0;
67
        thrashcon = 1;
68
        var xoff = 0;
69
        if (turretbody)
70
        {
71
            xoff = 10;
72
            d = instance_create((puddle.x - 60) + xoff, puddle.y + 4, obj_rouxls_splasheffect);
73
            d.depth = depth - 1;
74
        }
75
        d = instance_create((puddle.x - 30) + xoff, puddle.y + 4, obj_rouxls_splasheffect);
76
        d.depth = depth - 1;
77
        d = instance_create(puddle.x + 30 + xoff, puddle.y + 4, obj_rouxls_splasheffect);
78
        d.depth = depth - 1;
79
        d = instance_create(puddle.x + xoff, puddle.y + 6, obj_rouxls_splasheffect);
80
        d.depth = depth - 2;
81
    }
82
    if (thrashcon == 1)
83
    {
84
        thrash.wsinerrate = 0;
85
        if (y < (remy - 10))
86
            thrash.drawfeet = 1;
87
        if (y >= 10)
88
        {
89
            thrash.wsiner += 1.6;
90
            y -= 4;
91
        }
92
        else
93
        {
94
            if (headattack)
95
                thrashtimer = arcsin(0.75) * 10;
96
            aimtime = irandom(15) + 15;
97
            thrashcon = 2;
98
            thrash.wsinerrate = 0;
99
        }
100
    }
101
    if (thrashcon == 2)
102
    {
103
        thrashtimer++;
104
        if ((thrashtimer % 8) == 0)
105
        {
106
            var ripple = instance_create(puddle.x, puddle.y, obj_rouxls_ripple);
107
            ripple.maxsize = clamp(1 - ((y - 90) / 45), 0.1, 2);
108
            ripple.image_speed = 0;
109
            ripple.image_index = turretbody ? 1 : 0;
110
            ripple.depth = puddle.depth - 1;
111
            submerged = 0;
112
        }
113
        if (thrashtimer <= aimtime || headattack)
114
            y = (headattack ? 40 : 10) - (sin(thrashtimer / (headattack ? 10 : 5)) * 40);
115
        if (headattack && y <= 10 && global.turntimer <= 40)
116
        {
117
            headattack = 0;
118
            thrashtimer = 0;
119
            thrashcon = 5;
120
        }
121
        else if (!headattack && thrashtimer >= (aimtime + 25))
122
        {
123
            thrashtimer = 0;
124
            thrashcon = 3;
125
            thrash.moving = 1;
126
            floatheight = (thrash.s * thrash.walkc) + fixy;
127
        }
128
        else if (!headattack && thrashtimer >= (aimtime + 10))
129
        {
130
            thrash.wsiner += 1.6 * (advancespeed / 4);
131
        }
132
    }
133
    if (thrashcon == 3)
134
    {
135
        if (x >= (camerax() + 200))
136
        {
137
            thrash.wsiner += 1.6 * (advancespeed / 8);
138
            x -= advancespeed;
139
        }
140
        else
141
        {
142
            thrashcon = 4;
143
        }
144
    }
145
    if (thrashcon == 4)
146
    {
147
        thrashtimer++;
148
        if (thrashtimer >= 15)
149
        {
150
            thrashcon = 5;
151
            thrashtimer = 0;
152
        }
153
    }
154
    if (thrashcon == 5)
155
    {
156
        if (x < (remx - 6))
157
        {
158
            x += returnspeed;
159
            thrash.wsiner -= 1.6 * (returnspeed / 6);
160
        }
161
        else
162
        {
163
            x = remx;
164
            thrashcon = 6;
165
            thrash.moving = 0;
166
        }
167
    }
168
    if (thrashcon == 6)
169
    {
170
        if (!submerged && y > (remy - 18))
171
        {
172
            var xoff = 0;
173
            if (turretbody)
174
            {
175
                xoff = 10;
176
                d = instance_create((puddle.x - 60) + xoff, puddle.y + 4, obj_rouxls_splasheffect);
177
                d.depth = depth - 1;
178
            }
179
            d = instance_create((puddle.x - 30) + xoff, puddle.y + 4, obj_rouxls_splasheffect);
180
            d.depth = depth - 1;
181
            d = instance_create(puddle.x + 30 + xoff, puddle.y + 4, obj_rouxls_splasheffect);
182
            d.depth = depth - 1;
183
            d = instance_create(puddle.x + xoff, puddle.y + 6, obj_rouxls_splasheffect);
184
            d.depth = depth - 2;
185
            submerged = 1;
186
        }
187
        if (y > (remy - 10))
188
            thrash.drawfeet = 0;
189
        if (y <= (remy - 4))
190
        {
191
            y += 4;
192
            thrash.wsiner -= 0.8;
193
        }
194
        else
195
        {
196
            y = remy;
197
            x = remx;
198
            thrashcon = 0;
199
            thrashmode = 0;
200
            thrash.wsinerrate = 0.8;
201
            advancespeed = 8;
202
            returnspeed = 6;
203
        }
204
    }
205
    if (thrashcon == 7)
206
    {
207
        if (thrashtimer == 50)
208
        {
209
            snd_play(snd_pombark);
210
            thrash.a = 1;
211
        }
212
        if (thrashtimer < 75)
213
        {
214
            thrashtimer++;
215
            thrash.wsiner -= 0.8;
216
        }
217
        else
218
        {
219
            x = remx;
220
            thrashcon = 6;
221
            thrash.moving = 0;
222
            returnease = 0;
223
            thrashtimer = 0;
224
        }
225
    }
226
}
227
if (
scr_debug
scr_debug

function
scr_debug()
{ return 0; }
())
228
{
229
    draw_set_color(c_white);
230
    if (global.mnfight == 7)
231
        draw_text(x - 200, y, "");
232
    if (instance_exists(obj_battletester))
233
    {
234
        var debugstring = "";
235
        if (thrash.dbselect == 1)
236
            debugstring += "";
237
        
scr_debug_print_persistent
scr_debug_print_persistent

function
scr_debug_print_persistent(arg0)
{ }
(debugstring);
238
    }
239
    if (keyboard_check_pressed(ord("B")))
240
        thrashmode++;
241
    if (thrashmode >= 2)
242
        thrashmode = 0;
243
    if (thrashmode == 0)
244
        thrash.drawfeet = thrash.dbselect;
245
}