1 |
if (state == 0) |
2 |
{ |
3 |
if (timer >= (animConst * 2.5)) |
4 |
timer += 0.25; |
5 |
else |
6 |
timer += (1.5 * animSpeed); |
7 |
if (timer >= (animConst * 3)) |
8 |
timer = animConst * 3; |
9 |
} |
10 |
else if (state == 1) |
11 |
{ |
12 |
timer += (8 * animSpeed); |
13 |
if (timer >= (animConst * 5)) |
14 |
timer = animConst * 5; |
15 |
} |
16 |
else if (state == 2) |
17 |
{ |
18 |
if (timer >= (animConst * 5)) |
19 |
timer -= 1.5; |
20 |
else |
21 |
timer = animConst * 5; |
22 |
} |
23 |
else if (state == 4) |
24 |
{ |
25 |
if (timer >= (animConst * 2.5)) |
26 |
timer += (0.25 * animSpeed); |
27 |
else |
28 |
timer += (1.5 * animSpeed); |
29 |
if (timer >= (animConst * 3)) |
30 |
timer = animConst * 3; |
31 |
} |
32 |
var tailsprite = sprite[2]; |
33 |
draw_sprite_ext(tailsprite, 0, x + xOffset[2], y + yOffset[2], 2, 2, -sin(timer / 6) * 10, c_white, 1); |
34 |
var handSprite = (attacktimer < 20) ? spr_tm_hand_l : sprite[3]; |
35 |
var handdir = point_direction(xOffset[1], yOffset[1], xOffset[3], yOffset[3]); |
36 |
var handlength = point_distance(xOffset[1], yOffset[1], xOffset[3], yOffset[3]); |
37 |
var handx = xOffset[1] + lengthdir_x(handlength, (handdir - 45) + (sin(timer / 6) * 50)); |
38 |
var handy = yOffset[1] + lengthdir_y(handlength, (handdir - 45) + (sin(timer / 6) * 30)); |
39 |
var rot1 = (state == 0) ? -45 : 0; |
40 |
var rot2 = (state == 0) ? 45 : 90; |
41 |
var whipimage = 0; |
42 |
if (state == 0) |
43 |
{ |
44 |
handSprite = spr_tm_whip_ready; |
45 |
if (timer >= (animConst * 2.5)) |
46 |
whipimage = 4; |
47 |
else if (timer >= (animConst * 2)) |
48 |
whipimage = 2; |
49 |
} |
50 |
if (state == 1) |
51 |
{ |
52 |
if (timer < (animConst * 5)) |
53 |
{ |
54 |
handx = xOffset[1] + lengthdir_x(handlength, (handdir - 45) + (sin((animConst * 5) / 6) * 50)); |
55 |
handy = yOffset[1] + lengthdir_y(handlength, (handdir - 45) + (sin((animConst * 5) / 6) * 30)); |
56 |
} |
57 |
if (timer < (animConst * 4)) |
58 |
handSprite = spr_tm_whip_smear; |
59 |
draw_sprite_ext(handSprite, 0, x + handx + (cos((animConst * 5) / 6) * 2), y + handy + (sin((animConst * 5) / 6) * 2), 2, 2, point_direction(x + handx + (cos((animConst * 5) / 6) * 2), y + handy + (sin((animConst * 5) / 6) * 2), targetx, targety) - 90, c_white, 1); |
60 |
} |
61 |
else if (state != 2 && !(state == 3 && attacktimer > 55)) |
62 |
{ |
63 |
draw_sprite_ext(handSprite, whipimage, x + handx + (cos(timer / 6) * 2), y + handy + (sin(timer / 6) * 2), 2, 2, rot1 + (sin((timer - 2) / 6) * rot2), c_white, 1); |
64 |
} |
65 |
var whipSprite = sprite[4]; |
66 |
draw_sprite_ext(whipSprite, 0, x + xOffset[4] + (sin(timer / 6) * 2), y + yOffset[4] + (sin(timer / 6) * 2), 2, 2, 0, c_white, 1); |
67 |
var legSprite = sprite[5]; |
68 |
draw_sprite_ext(legSprite, 0, x + xOffset[5] + (sin(timer / 6) * 0), y + yOffset[5], 2, 2, 0, c_white, 1); |
69 |
var bodySprite = sprite[1]; |
70 |
draw_sprite_ext(bodySprite, 0, x + xOffset[1], y + yOffset[1] + (sin(timer / 6) * 2), 2, 2, 0, c_white, 1); |
71 |
var headSprite = sprite[0]; |
72 |
draw_sprite_ext(headSprite, 0, x + xOffset[0], y + yOffset[0] + (sin(timer / 6) * 3), 2, 2, sin(timer / 6) * 10, c_white, 1); |
73 |
if (!quizmode && attacktimer >= 5 && attacktimer <= 20 && global.turntimer > 30) |
74 |
{ |
75 |
whipball.warnoffset = ((attackoffset % 90) == 0) ? 0 : 3; |
76 |
whipball.warning = attacktimer - 4; |
77 |
} |
78 |
if (attacktimer > 20) |
79 |
{ |
80 |
whipball.warning = 0; |
81 |
handx = x + handx + (cos(timer / 6) * 2); |
82 |
handy = y + handy + (sin(timer / 6) * 2); |
83 |
} |
84 |
if (attacktimer > 20 && attacktimer < 30) |
85 |
{ |
86 |
whipball.dodraw = 1; |
87 |
var invlerp = scr_inverselerp(15, 30, attacktimer); |
88 |
var xlerp = lerp(handx, targetx, invlerp); |
89 |
var ylerp = lerp(handy, targety, invlerp); |
90 |
var linkdir = point_direction(handx, handy, targetx, targety); |
91 |
whipball.origx = handx; |
92 |
whipball.origy = handy; |
93 |
for (i = 1; i < 6; i++) |
94 |
draw_sprite_ext(spr_whitepixel, 0, lerp(handx, xlerp, i / 12), lerp(handy, ylerp, i / 12), 12, 2, linkdir, c_white, 1); |
95 |
whipball.x = xlerp; |
96 |
whipball.y = ylerp; |
97 |
whipball.image_angle = attackoffset + (invlerp * 720); |
98 |
} |
99 |
if (attacktimer >= 30 && attacktimer <= 55) |
100 |
{ |
101 |
whipball.dodraw = 1; |
102 |
var linkdir = point_direction(handx, handy, targetx, targety); |
103 |
whipball.origx = handx; |
104 |
whipball.origy = handy; |
105 |
for (i = 1; i < 6; i++) |
106 |
draw_sprite_ext(spr_whitepixel, 0, lerp(handx, targetx, i / 12), lerp(handy, targety, i / 12), 12, 2, linkdir, c_white, 1); |
107 |
if (state == 2) |
108 |
draw_sprite_ext(handSprite, 0, handx, handy, 2, 2, point_direction(handx, handy, targetx, targety) - 90, c_white, 1); |
109 |
whipball.x = targetx; |
110 |
whipball.y = targety; |
111 |
whipball.image_angle = attackoffset - 45; |
112 |
} |
113 |
if (attacktimer > 55) |
114 |
{ |
115 |
var invlerp = scr_inverselerp(65, 55, attacktimer); |
116 |
var xlerp = lerp(handx, targetx, invlerp); |
117 |
var ylerp = lerp(handy, targety, invlerp); |
118 |
whipball.origx = handx; |
119 |
whipball.origy = handy; |
120 |
var linkdir = point_direction(handx, handy, targetx, targety); |
121 |
for (i = 1; i < 6; i++) |
122 |
draw_sprite_ext(spr_whitepixel, 0, lerp(handx, xlerp, i / 12), lerp(handy, ylerp, i / 12), 12, 2, linkdir, c_white, 1); |
123 |
if (state == 2 || state == 3) |
124 |
draw_sprite_ext(handSprite, 0, handx, handy, 2, 2, point_direction(handx, handy, targetx, targety) - 90, c_white, 1); |
125 |
whipball.x = xlerp; |
126 |
whipball.y = ylerp; |
127 |
whipball.image_angle = attackoffset + (invlerp * 720); |
128 |
} |