1 |
if (init == 0) |
2 |
{ |
3 |
if (caralert) |
4 |
shottimer = 20; |
5 |
lborder += ((fleetsize - 1) * 20); |
6 |
rborder -= ((fleetsize - 1) * 20); |
7 |
if (fleetspeed == 1) |
8 |
{ |
9 |
moveinterval = 1; |
10 |
timer = 1; |
11 |
movedirection = sign(movedirection) * 6; |
12 |
} |
13 |
shottimer -= 10; |
14 |
if (!caralert) |
15 |
moveinterval = sqr(fleetspeed) * 2; |
16 |
else |
17 |
moveinterval = 4; |
18 |
init = 1; |
19 |
boys[0].image_alpha = 1; |
20 |
boys[0].damage = damage; |
21 |
boys[0].target = target; |
22 |
boys[0].grazepoints = grazepoints; |
23 |
if (fleetsize == 2) |
24 |
{ |
25 |
boys[0].x += 16; |
26 |
boys[1] = scr_childbulletscr_childbulletfunction scr_childbullet()
{
var __child = instance_create(argument[0], argument[1], argument[2]);
var __parent = (argument_count == 4) ? argument[3] : id;
if (__parent.damage != -1)
__child.damage = __parent.damage;
if (__parent.grazepoints != -1)
__child.grazepoints = __parent.grazepoints;
if (__parent.timepoints != -1)
__child.timepoints = __parent.timepoints;
if (__parent.inv != -1)
__child.inv = __parent.inv;
if (__parent.target != -1)
__child.target = __parent.target;
if (__parent.grazed != -1)
__child.grazed = __parent.grazed;
if (__parent.grazetimer != -1)
__child.grazetimer = __parent.grazetimer;
__child.element = __parent.element;
return __child;
} (x - 16, y, obj_viro_invader); |
27 |
boys[1].target = targetB; |
28 |
boys[1].grazepoints = grazepoints; |
29 |
} |
30 |
else if (fleetsize == 3) |
31 |
{ |
32 |
boys[0].x += 32; |
33 |
boys[1] = scr_childbulletscr_childbulletfunction scr_childbullet()
{
var __child = instance_create(argument[0], argument[1], argument[2]);
var __parent = (argument_count == 4) ? argument[3] : id;
if (__parent.damage != -1)
__child.damage = __parent.damage;
if (__parent.grazepoints != -1)
__child.grazepoints = __parent.grazepoints;
if (__parent.timepoints != -1)
__child.timepoints = __parent.timepoints;
if (__parent.inv != -1)
__child.inv = __parent.inv;
if (__parent.target != -1)
__child.target = __parent.target;
if (__parent.grazed != -1)
__child.grazed = __parent.grazed;
if (__parent.grazetimer != -1)
__child.grazetimer = __parent.grazetimer;
__child.element = __parent.element;
return __child;
} (x, y, obj_viro_invader); |
34 |
boys[2] = scr_childbulletscr_childbulletfunction scr_childbullet()
{
var __child = instance_create(argument[0], argument[1], argument[2]);
var __parent = (argument_count == 4) ? argument[3] : id;
if (__parent.damage != -1)
__child.damage = __parent.damage;
if (__parent.grazepoints != -1)
__child.grazepoints = __parent.grazepoints;
if (__parent.timepoints != -1)
__child.timepoints = __parent.timepoints;
if (__parent.inv != -1)
__child.inv = __parent.inv;
if (__parent.target != -1)
__child.target = __parent.target;
if (__parent.grazed != -1)
__child.grazed = __parent.grazed;
if (__parent.grazetimer != -1)
__child.grazetimer = __parent.grazetimer;
__child.element = __parent.element;
return __child;
} (x - 32, y, obj_viro_invader); |
35 |
boys[1].target = targetB; |
36 |
boys[1].grazepoints = grazepoints; |
37 |
boys[2].grazepoints = grazepoints; |
38 |
} |
39 |
firingspeed = 1; |
40 |
if (fleetsize > 1) |
41 |
firingspeed = (fleetsize == 3) ? 2.3 : 1.6; |
42 |
for (i = 0; i < fleetsize; i++) |
43 |
{ |
44 |
boys[i].caralert = caralert; |
45 |
boys[i].firingspeed = firingspeed; |
46 |
boys[i].bigshot = bigshot; |
47 |
} |
48 |
var loopdir = choose(-1, 1); |
49 |
shotqueue[0] = irandom(fleetsize - 1); |
50 |
for (i = 1; i < fleetsize; i++) |
51 |
{ |
52 |
shotqueue[i] = shotqueue[i + loopdir]; |
53 |
if (shotqueue[i] < 0) |
54 |
shotqueue[i] = fleetsize + shotqueue[i]; |
55 |
else if (shotqueue[i] >= fleetsize) |
56 |
shotqueue[i] = shotqueue[i] - fleetsize; |
57 |
} |
58 |
} |
59 |
timer++; |
60 |
if (timer >= moveinterval) |
61 |
{ |
62 |
nextx = x + movedirection; |
63 |
if ((nextx > rborder && movedirection > 0) || (nextx < lborder && movedirection < 0)) |
64 |
{ |
65 |
y += 20; |
66 |
movedirection *= -1; |
67 |
if (shottimer < 10 && !caralert) |
68 |
shottimer = 10; |
69 |
} |
70 |
else |
71 |
{ |
72 |
x = nextx; |
73 |
} |
74 |
if (fleetspeed > 1) |
75 |
timer = 0; |
76 |
} |
77 |
var force_shot = false; |
78 |
var force_target = 0; |
79 |
var temp_move = movedirection; |
80 |
if (shottimer < ((fleetsize == 1) ? 12 : 16) && bigshot) |
81 |
{ |
82 |
for (mv = 0; mv < fleetsize; mv++) |
83 |
{ |
84 |
if (i_ex(boys[mv])) |
85 |
{ |
86 |
if (abs((boys[mv].x + ((temp_move / moveinterval) * 16)) - obj_heart.x) < 4) |
87 |
{ |
88 |
force_shot = true; |
89 |
force_target = mv; |
90 |
break; |
91 |
} |
92 |
} |
93 |
temp_move *= -1; |
94 |
} |
95 |
} |
96 |
if ((shottimer <= 0 && y < (obj_growtangle.y + 50)) || force_shot) |
97 |
{ |
98 |
var shootingboy = irandom(fleetsize - 1); |
99 |
if (force_shot) |
100 |
shootingboy = force_target; |
101 |
if (i_ex(boys[shootingboy])) |
102 |
{ |
103 |
boys[shootingboy].shotready = 1; |
104 |
boys[shootingboy].target = choose(target, targetB); |
105 |
ratio = 1; |
106 |
if (fleetsize > 1) |
107 |
ratio = (fleetsize == 2) ? 1.6 : 2.3; |
108 |
if (fleetsize == 1 || caralert) |
109 |
shottimer = irandom(20) + 20; |
110 |
else |
111 |
shottimer = irandom(30) + 40; |
112 |
} |
113 |
} |
114 |
else |
115 |
{ |
116 |
shottimer -= fleetsize; |
117 |
} |
118 |
reverse = fleetsize > 1 && movedirection < 0; |
119 |
for (i = 0; i < fleetsize; i++) |
120 |
{ |
121 |
if (fleetsize == 1 && timer >= moveinterval) |
122 |
{ |
123 |
if (!i_ex(boys[i])) |
124 |
continue; |
125 |
boys[i].x = x; |
126 |
boys[i].image_index = 1 - boys[i].image_index; |
127 |
} |
128 |
else if ((timer + ((i + 1) * 2)) == moveinterval) |
129 |
{ |
130 |
target = reverse ? (fleetsize - i - 1) : i; |
131 |
if (!i_ex(boys[target])) |
132 |
continue; |
133 |
boys[target].x += movedirection; |
134 |
boys[i].image_index = 1 - boys[i].image_index; |
135 |
} |
136 |
if (!i_ex(boys[i])) |
137 |
continue; |
138 |
boys[i].y = y; |
139 |
} |