1 |
if (init == 0) |
2 |
{ |
3 |
whipball.quizmode = quizmode; |
4 |
whipball.damage = damage; |
5 |
whipball.target = target; |
6 |
init = 1; |
7 |
depth = global.monsterinstance[creator].depth; |
8 |
if (quizmode) |
9 |
state = -1; |
10 |
} |
11 |
if (quizloop && state == -1) |
12 |
{ |
13 |
quizloop = false; |
14 |
state = 0; |
15 |
} |
16 |
if (state == -1) |
17 |
{ |
18 |
if (lastState != -1) |
19 |
{ |
20 |
timer = 0; |
21 |
attacktimer = 0; |
22 |
visible = 0; |
23 |
global.monsterinstance[creator].visible = 1; |
24 |
lastState = -1; |
25 |
} |
26 |
exit; |
27 |
} |
28 |
if (lastState == -1 && state != -1) |
29 |
{ |
30 |
visible = 1; |
31 |
global.monsterinstance[creator].visible = 0; |
32 |
lastState = state; |
33 |
} |
34 |
truetimer++; |
35 |
attacktimer += animSpeed; |
36 |
if (state == 0 && attacktimer >= 20) |
37 |
attacktimer = 19; |
38 |
if (attacktimer == 5) |
39 |
{ |
40 |
if (!quizmode) |
41 |
{ |
42 |
targetx = obj_heart.x + 8; |
43 |
targety = obj_heart.y + 8; |
44 |
} |
45 |
whipball.origx = targetx; |
46 |
whipball.origy = targety; |
47 |
attackoffset += 45; |
48 |
} |
49 |
if (state == 2 && lastState == 1) |
50 |
{ |
51 |
lastState = 2; |
52 |
attacktimer = 35; |
53 |
} |
54 |
if (attacktimer >= 35 && (attacktimer % 5) < 1 && attacktimer <= 45) |
55 |
{ |
56 |
var rotation = attackoffset; |
57 |
if (difficulty == 1) |
58 |
rotation += (((attacktimer / 5) - 7) * 15 * ((attackoffset == 45) ? -1 : 1)); |
59 |
var balldirection = 0; |
60 |
if (rotateCracker) |
61 |
{ |
62 |
var handx = x + xOffset[1]; |
63 |
var handy = y + yOffset[1]; |
64 |
balldirection = point_direction(targetx, targety, handx, handy); |
65 |
} |
66 |
if (!quizmode) |
67 |
{ |
68 |
var loop = (difficulty == 1) ? 8 : 4; |
69 |
for (i = 0; i < loop; i++) |
70 |
{ |
71 |
var d = instance_create(targetx, targety, obj_regularbullet); |
72 |
d.speed = 0.1; |
73 |
d.friction = -0.5; |
74 |
d.sprite_index = spr_virovirokun_invaderbullet; |
75 |
d.timepoints = 0; |
76 |
d.direction = rotation + (((difficulty == 1) ? 45 : 90) * i) + balldirection; |
77 |
d.image_angle = d.direction + 90; |
78 |
} |
79 |
} |
80 |
} |
81 |
if (state != lastState) |
82 |
{ |
83 |
if (state == 1 && lastState == 2) |
84 |
{ |
85 |
attacktimer = 34; |
86 |
timer = animConst * 5; |
87 |
} |
88 |
if (state == 3) |
89 |
attacktimer = 56; |
90 |
lastState = state; |
91 |
} |
92 |
if (state == 3 && attacktimer >= 59) |
93 |
{ |
94 |
timer = animConst; |
95 |
state = 4; |
96 |
lastState = 4; |
97 |
} |
98 |
if (state == 4 && attacktimer >= 65) |
99 |
{ |
100 |
whipball.dodraw = 0; |
101 |
if (!quizmode) |
102 |
{ |
103 |
targetx = obj_heart.x + 8; |
104 |
targety = obj_heart.y + 8; |
105 |
} |
106 |
whipball.origx = targetx; |
107 |
whipball.origy = targety; |
108 |
if (quizmode && !quizloop) |
109 |
{ |
110 |
state = -1; |
111 |
} |
112 |
else |
113 |
{ |
114 |
if (quizloop) |
115 |
quizloop = false; |
116 |
state = 0; |
117 |
lastState = 0; |
118 |
} |
119 |
attacktimer = 5; |
120 |
attackoffset += 45; |
121 |
} |