1 | using System; |
---|
2 | using System.Collections.Generic; |
---|
3 | using Jypeli; |
---|
4 | using Jypeli.Assets; |
---|
5 | using Jypeli.Controls; |
---|
6 | using Jypeli.Effects; |
---|
7 | using Jypeli.Widgets; |
---|
8 | |
---|
9 | class player : PhysicsObject |
---|
10 | { |
---|
11 | public IntMeter health = new IntMeter(100, 0, 100); |
---|
12 | |
---|
13 | public player(double width, double height) |
---|
14 | : base(width, height) |
---|
15 | { |
---|
16 | health.LowerLimit += delegate |
---|
17 | { |
---|
18 | this.Destroy(); |
---|
19 | }; |
---|
20 | IgnoresGravity = true; |
---|
21 | } |
---|
22 | } |
---|
23 | |
---|
24 | class droid : PhysicsObject |
---|
25 | { |
---|
26 | public DoubleMeter droid_level = new DoubleMeter(0, 0, 4); |
---|
27 | |
---|
28 | public droid(double width, double height) |
---|
29 | : base(width, height) |
---|
30 | { |
---|
31 | IgnoresGravity = true; |
---|
32 | } |
---|
33 | } |
---|
34 | |
---|
35 | class enemy : PhysicsObject |
---|
36 | { |
---|
37 | public IntMeter health = new IntMeter(100, 0, 100); |
---|
38 | public IntMeter ScoreValue = new IntMeter(100, 0, int.MaxValue); |
---|
39 | public bool canShoot = false; |
---|
40 | public double explosion_scale = 50; |
---|
41 | |
---|
42 | public enemy(double width, double height) |
---|
43 | : base(width, height) |
---|
44 | { |
---|
45 | health.LowerLimit += delegate { this.Destroy(); }; |
---|
46 | IgnoresGravity = true; |
---|
47 | } |
---|
48 | } |
---|
49 | class boss : PhysicsObject |
---|
50 | { |
---|
51 | public IntMeter health = new IntMeter(10000, 0, 10000); |
---|
52 | public IntMeter ScoreValue = new IntMeter(100, 0, int.MaxValue); |
---|
53 | public bool canShoot = false; |
---|
54 | public double explosion_scale = 100; |
---|
55 | |
---|
56 | public boss(double width, double height) |
---|
57 | : base(width, height) |
---|
58 | { |
---|
59 | health.LowerLimit += delegate { this.Destroy(); }; |
---|
60 | IgnoresGravity = true; |
---|
61 | } |
---|
62 | } |
---|
63 | |
---|
64 | class bullet : PhysicsObject |
---|
65 | { |
---|
66 | public int damage = 5; |
---|
67 | |
---|
68 | public bullet(double width, double height) |
---|
69 | : base(width, height) { } |
---|
70 | } |
---|
71 | class frontborder : PhysicsObject |
---|
72 | { |
---|
73 | |
---|
74 | public frontborder(double width, double height) |
---|
75 | : base(width, height) { IgnoresGravity = true; } |
---|
76 | } |
---|
77 | class backborder : PhysicsObject |
---|
78 | { |
---|
79 | |
---|
80 | public backborder(double width, double height) |
---|
81 | : base(width, height) { IgnoresGravity = true; } |
---|
82 | } |
---|
83 | class bulletdes : PhysicsObject |
---|
84 | { |
---|
85 | public bulletdes(double width, double height) |
---|
86 | : base(width, height) { IgnoresGravity = true; } |
---|
87 | } |
---|
88 | |
---|
89 | //Game |
---|
90 | public class Gradiant : PhysicsGame |
---|
91 | { |
---|
92 | //double fps = 50; |
---|
93 | |
---|
94 | player player; |
---|
95 | PhysicsObject playership; |
---|
96 | double player_speed = 425; |
---|
97 | Vector stagespeed = new Vector(-500,0); |
---|
98 | Vector cntr = new Vector(0, 0); |
---|
99 | |
---|
100 | string currentlevel = "level_01"; |
---|
101 | |
---|
102 | #region Images |
---|
103 | |
---|
104 | //Player |
---|
105 | Image player_ship_01 = LoadImage("player_ship_01"); |
---|
106 | Image player_ship_02 = LoadImage("player_ship_02"); |
---|
107 | Image hitbox = LoadImage("hitbox"); |
---|
108 | Image droid_image = LoadImage("droid"); |
---|
109 | //Bullets |
---|
110 | Image bullet_green_laser01 = LoadImage("bullet_green_laser01"); |
---|
111 | Image bullet_player01 = LoadImage("bullet_player"); |
---|
112 | Image bullet_player02 = LoadImage("bullet_player02"); |
---|
113 | Image bullet_player03 = LoadImage("bullet_player03"); |
---|
114 | Image bullet_player04 = LoadImage("bullet_player04"); |
---|
115 | Image bullet_player05 = LoadImage("bullet_player05"); |
---|
116 | Image bullet_droid = LoadImage("bullet_droid"); |
---|
117 | Image bullet_laser = LoadImage("bullet_laser"); |
---|
118 | Image bullet_enemy_01 = LoadImage("bullet_enemy_01"); |
---|
119 | Image bullet_enemy_02 = LoadImage("bullet_enemy_02"); |
---|
120 | Image bullet_enemy_03 = LoadImage("bullet_enemy_03"); |
---|
121 | Image bullet_enemy_04 = LoadImage("bullet_enemy_04"); |
---|
122 | Image bullet_enemy_05 = LoadImage("bullet_enemy_05"); |
---|
123 | Image bullet_enemy_06 = LoadImage("bullet_enemy_06"); |
---|
124 | Image bullet_enemy_07 = LoadImage("bullet_enemy_07"); |
---|
125 | Image bullet_enemy_08 = LoadImage("bullet_enemy_08"); |
---|
126 | Image bullet_enemy_09 = LoadImage("bullet_enemy_09"); |
---|
127 | Image bullet_enemy_10 = LoadImage("bullet_enemy_10"); |
---|
128 | //Enemies |
---|
129 | Image enemy_ship_01 = LoadImage("enemy_ship_01"); |
---|
130 | Image enemy_ship_01_red = LoadImage("enemy_ship_01_red"); |
---|
131 | Image enemy_ship_01_blue = LoadImage("enemy_ship_01_blue"); |
---|
132 | Image enemy_ship_01_blue_inverted = LoadImage("enemy_ship_01_blue_inverted"); |
---|
133 | Image enemy_ship_02 = LoadImage("enemy_ship_02"); |
---|
134 | Image enemy_ship_03 = LoadImage("enemy_ship_03"); |
---|
135 | Image enemy_ship_04 = LoadImage("enemy_ship_04"); |
---|
136 | Image enemy_ship_05 = LoadImage("enemy_ship_05"); |
---|
137 | Image enemy_ship_06 = LoadImage("enemy_ship_06"); |
---|
138 | //Bosses |
---|
139 | Image boss_ship_01 = LoadImage("boss_ship_01"); |
---|
140 | Image boss_ship_02 = LoadImage("boss_ship_02"); |
---|
141 | Image boss_ship_03 = LoadImage("boss_ship_03"); |
---|
142 | Image boss_ship_ajnator = LoadImage("ajnator"); |
---|
143 | //Powerups |
---|
144 | Image powerup_damage = LoadImage("powerup_damage"); |
---|
145 | Image powerup_spread = LoadImage("powerup_spread"); |
---|
146 | Image powerup_upgrade = LoadImage("powerup_upgrade"); |
---|
147 | //Borders |
---|
148 | Image border_top = LoadImage("border_bottom"); |
---|
149 | Image border_bottom = LoadImage("border_top"); |
---|
150 | //Backgrounds |
---|
151 | Image stage1_bg = LoadImage("stage1_bg"); |
---|
152 | Image stage2_bg = LoadImage("stage2_bg"); |
---|
153 | Image stage3_bg = LoadImage("stage3_bg"); |
---|
154 | |
---|
155 | Image stage_aj = LoadImage("stage_aj"); |
---|
156 | //Animations |
---|
157 | private Animation explosion_anim; |
---|
158 | private Animation droid_anim; |
---|
159 | private Animation droid2_anim; |
---|
160 | //GUI |
---|
161 | Image title = LoadImage("title_screen"); |
---|
162 | Image title_02 = LoadImage("title_screen_02"); |
---|
163 | Image press_start_img = LoadImage("Press_Start"); |
---|
164 | Image controls = LoadImage("controls"); |
---|
165 | Image stage_1_clear = LoadImage("stage_1_clear"); |
---|
166 | Image stage_1_start = LoadImage("stage_1_start"); |
---|
167 | Image stage_2_clear = LoadImage("stage_2_clear"); |
---|
168 | Image stage_2_start = LoadImage("stage_2_start"); |
---|
169 | Image stage_3_clear = LoadImage("stage_3_clear"); |
---|
170 | Image stage_3_start = LoadImage("stage_3_start"); |
---|
171 | Image bonus_stage_clear = LoadImage("bonus_stage_clear"); |
---|
172 | Image bonus_stage_start = LoadImage("bonus_stage_start"); |
---|
173 | Image damage_up = LoadImage("damage_up"); |
---|
174 | Image spread_up = LoadImage("spread_up"); |
---|
175 | Image upgrade = LoadImage("upgrade"); |
---|
176 | Image cursor_gui = LoadImage("cursor"); |
---|
177 | Image select_ship_gui = LoadImage("select_ship"); |
---|
178 | Image congratulations = LoadImage("congratulations"); |
---|
179 | |
---|
180 | //Misc |
---|
181 | Image gradient = LoadImage("gradient"); |
---|
182 | Image aj = LoadImage("aj-weed"); |
---|
183 | |
---|
184 | #endregion |
---|
185 | |
---|
186 | #region SFX |
---|
187 | |
---|
188 | SoundEffect hurtsfx = LoadSoundEffect("hurt"); |
---|
189 | SoundEffect hitsfx = LoadSoundEffect("hit"); |
---|
190 | SoundEffect shootsfx = LoadSoundEffect("shoot"); |
---|
191 | SoundEffect selectsfx = LoadSoundEffect("select1"); |
---|
192 | SoundEffect powerupsfx = LoadSoundEffect("powerup"); |
---|
193 | SoundEffect explosionsfx = LoadSoundEffect("explosion"); |
---|
194 | SoundEffect enemy_shootsfx = LoadSoundEffect("enemy_shoot"); |
---|
195 | |
---|
196 | #endregion |
---|
197 | |
---|
198 | //Weapon |
---|
199 | double wpn_shootRate = 0.1; |
---|
200 | IntMeter wpn_damageRatio = new IntMeter(1, 1, 10); |
---|
201 | DoubleMeter wpn_spread = new DoubleMeter(1,1,10); |
---|
202 | |
---|
203 | double drd_shootRate = 0.15; |
---|
204 | double drd_type = 0; |
---|
205 | DoubleMeter drd_level = new DoubleMeter(0, 0, 5); |
---|
206 | IntMeter drd_damageRatio = new IntMeter(1, 1, 20); |
---|
207 | |
---|
208 | //Collision ignore groups |
---|
209 | //2: player bullets/enemy bullets |
---|
210 | //3: enemies |
---|
211 | //4: powerups |
---|
212 | |
---|
213 | ProgressBar healthBar; |
---|
214 | Timer wpn_timer = new Timer(); |
---|
215 | |
---|
216 | GameObject control_gui; |
---|
217 | GameObject press_start; |
---|
218 | GameObject cursor; |
---|
219 | GameObject select_ship; |
---|
220 | |
---|
221 | GameObject black; |
---|
222 | |
---|
223 | GameObject stage_clear; |
---|
224 | |
---|
225 | GameObject bg; |
---|
226 | GameObject bg2; |
---|
227 | Timer cursor_blink; |
---|
228 | double cursorpos = 0; |
---|
229 | |
---|
230 | bool s001 = false; |
---|
231 | bool s002 = false; |
---|
232 | bool s003 = false; |
---|
233 | bool s004 = false; |
---|
234 | bool b001 = false; |
---|
235 | bool b002 = false; |
---|
236 | bool b003 = false; |
---|
237 | bool b004 = false; |
---|
238 | |
---|
239 | public override void Begin() |
---|
240 | { |
---|
241 | SoundEffect.MasterVolume = 0.8; |
---|
242 | //Load SFX |
---|
243 | hurtsfx.Play(); |
---|
244 | |
---|
245 | //Load Anim |
---|
246 | explosion_anim = LoadAnimation("explosionanim"); |
---|
247 | droid_anim = LoadAnimation("droidanim"); |
---|
248 | droid2_anim = LoadAnimation("droid2anim"); |
---|
249 | |
---|
250 | MediaPlayer.Play("Starmap"); |
---|
251 | MediaPlayer.IsRepeating = true; |
---|
252 | |
---|
253 | SetWindowSize(1280, 800, false); |
---|
254 | |
---|
255 | Level.Size = new Vector(Screen.Width,Screen.Height); |
---|
256 | SmoothTextures = false; |
---|
257 | |
---|
258 | GameObject titlescreen = new GameObject(1280, 801); |
---|
259 | titlescreen.Position = Screen.Center; |
---|
260 | titlescreen.Image = title_02; |
---|
261 | Add(titlescreen,-3); |
---|
262 | |
---|
263 | press_start = new GameObject(215, 59); |
---|
264 | press_start.Position = Screen.Center + new Vector(0, 90); |
---|
265 | press_start.Image = press_start_img; |
---|
266 | Add(press_start); |
---|
267 | |
---|
268 | control_gui = new GameObject(345, 247); |
---|
269 | control_gui.Position = Screen.Center + new Vector(66, -112); |
---|
270 | control_gui.Image = controls; |
---|
271 | Add(control_gui); |
---|
272 | |
---|
273 | Timer start = new Timer(); |
---|
274 | start.Interval = 0.6; |
---|
275 | start.Timeout += delegate |
---|
276 | { |
---|
277 | if (press_start.IsVisible) press_start.IsVisible = false; |
---|
278 | else press_start.IsVisible = true; |
---|
279 | }; |
---|
280 | start.Start(); |
---|
281 | |
---|
282 | Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, null); |
---|
283 | ControllerOne.Listen(Button.Back, ButtonState.Pressed, ConfirmExit, null); |
---|
284 | ControllerOne.Listen(Button.Start, ButtonState.Pressed, Select_ship, null); |
---|
285 | |
---|
286 | Keyboard.Listen(Key.D1 ,ButtonState.Pressed, cheat_skiptolvl1, null); |
---|
287 | Keyboard.Listen(Key.D2, ButtonState.Pressed, cheat_skiptolvl2, null); |
---|
288 | Keyboard.Listen(Key.D3, ButtonState.Pressed, cheat_skiptolvl3, null); |
---|
289 | |
---|
290 | } |
---|
291 | void Select_ship() |
---|
292 | { |
---|
293 | selectsfx.Play(); |
---|
294 | |
---|
295 | ClearControls(); |
---|
296 | Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, null); |
---|
297 | ControllerOne.Listen(Button.Back, ButtonState.Pressed, ConfirmExit, null); |
---|
298 | ControllerOne.ListenAnalog(AnalogControl.LeftStick, -0.1, movecursor, null); |
---|
299 | ControllerOne.Listen(Button.Start, ButtonState.Pressed, Start, null); |
---|
300 | ControllerOne.Listen(Button.A, ButtonState.Pressed, Start, null); |
---|
301 | |
---|
302 | control_gui.Destroy(); |
---|
303 | press_start.Destroy(); |
---|
304 | |
---|
305 | cursor = new GameObject(21, 19); |
---|
306 | cursor.Image = cursor_gui; |
---|
307 | cursor.Position = Screen.Center + new Vector(-232, 41); |
---|
308 | |
---|
309 | select_ship = new GameObject(426, 136); |
---|
310 | select_ship.Image = select_ship_gui; |
---|
311 | select_ship.Position = Screen.Center; |
---|
312 | |
---|
313 | Add(select_ship); |
---|
314 | Add(cursor); |
---|
315 | |
---|
316 | cursor_blink = new Timer(); |
---|
317 | cursor_blink.Interval = 0.5; |
---|
318 | cursor_blink.Timeout += delegate |
---|
319 | { |
---|
320 | if (cursor.IsVisible) cursor.IsVisible = false; |
---|
321 | else if (!cursor.IsVisible) cursor.IsVisible = true; |
---|
322 | if (cursor.IsDestroyed) cursor_blink.Stop(); |
---|
323 | }; |
---|
324 | cursor_blink.Start(); |
---|
325 | } |
---|
326 | void movecursor(AnalogState dir) |
---|
327 | { |
---|
328 | if (cursorpos!= 0 && dir.StateVector.Y >= 0.7) |
---|
329 | { |
---|
330 | cursorpos = 0; |
---|
331 | cursor.Position = Screen.Center + new Vector(-232, 41); |
---|
332 | cursor_blink.Start(); |
---|
333 | cursor.IsVisible = true; |
---|
334 | selectsfx.Play(); |
---|
335 | } |
---|
336 | else if (cursorpos!= 1 &&dir.StateVector.Y <= -0.7) |
---|
337 | { |
---|
338 | cursorpos = 1; |
---|
339 | cursor.Position = Screen.Center + new Vector(-232, -51); |
---|
340 | cursor_blink.Start(); |
---|
341 | cursor.IsVisible = true; |
---|
342 | selectsfx.Play(); |
---|
343 | } |
---|
344 | } |
---|
345 | |
---|
346 | void Start() |
---|
347 | { |
---|
348 | ClearControls(); |
---|
349 | |
---|
350 | selectsfx.Play(); |
---|
351 | MediaPlayer.Stop(); |
---|
352 | black = new GameObject(Screen.Width, Screen.Height); |
---|
353 | black.Position = cntr; |
---|
354 | black.Color = Color.Transparent; |
---|
355 | black.FadeColorTo(Color.Black, 0.5); |
---|
356 | Add(black, 2); |
---|
357 | |
---|
358 | Timer wait = new Timer(); |
---|
359 | wait.Interval = 1; |
---|
360 | wait.Timeout += delegate |
---|
361 | { |
---|
362 | ClearAll(); |
---|
363 | black = new GameObject(Screen.Width, Screen.Height); |
---|
364 | black.Color = Color.Black; |
---|
365 | Add(black, 2); |
---|
366 | MediaPlayer.Stop(); |
---|
367 | |
---|
368 | CreateLevel("level_01"); |
---|
369 | hide_player(); |
---|
370 | |
---|
371 | black.Position = cntr; |
---|
372 | |
---|
373 | GameObject stage_01_start = new GameObject(405, 39); |
---|
374 | stage_01_start.Position = cntr; |
---|
375 | stage_01_start.Image = stage_1_start; |
---|
376 | Add(stage_01_start, 3); |
---|
377 | |
---|
378 | double i = 0; |
---|
379 | Timer start = new Timer(); |
---|
380 | start.Interval = 0.1; |
---|
381 | start.Timeout += delegate |
---|
382 | { |
---|
383 | i++; |
---|
384 | if (i >= 15) stage_01_start.Destroy(); |
---|
385 | if (stage_01_start.IsVisible) stage_01_start.IsVisible = false; |
---|
386 | else stage_01_start.IsVisible = true; |
---|
387 | }; |
---|
388 | start.Start(15); |
---|
389 | Pause(); |
---|
390 | ControllerOne.Listen(Button.Start, ButtonState.Pressed, start_01, null); |
---|
391 | }; |
---|
392 | wait.Start(1); |
---|
393 | |
---|
394 | setwpn_timer(); |
---|
395 | } |
---|
396 | void start_01() |
---|
397 | { |
---|
398 | if (!s001) |
---|
399 | { |
---|
400 | black.FadeColorTo(Color.Transparent, 0.5); |
---|
401 | Timer.SingleShot(0.5, hide_player); |
---|
402 | Timer.SingleShot(0.5, AddHealthbar); |
---|
403 | |
---|
404 | s001 = true; |
---|
405 | Pause(); |
---|
406 | MediaPlayer.Play("Venom"); |
---|
407 | selectsfx.Play(); |
---|
408 | } |
---|
409 | } |
---|
410 | void start_02() |
---|
411 | { |
---|
412 | if (!s002) |
---|
413 | { |
---|
414 | black.FadeColorTo(Color.Transparent, 0.5); |
---|
415 | player.IsVisible = false; |
---|
416 | Timer.SingleShot(0.5, hide_player); |
---|
417 | Timer.SingleShot(0.5, AddHealthbar); |
---|
418 | |
---|
419 | s002 = true; |
---|
420 | Pause(); |
---|
421 | MediaPlayer.Play("Macbeth"); |
---|
422 | selectsfx.Play(); |
---|
423 | } |
---|
424 | } |
---|
425 | void start_03() |
---|
426 | { |
---|
427 | if (!s003) |
---|
428 | { |
---|
429 | black.FadeColorTo(Color.Transparent, 0.5); |
---|
430 | player.IsVisible = false; |
---|
431 | Timer.SingleShot(0.5, hide_player); |
---|
432 | Timer.SingleShot(0.5, AddHealthbar); |
---|
433 | |
---|
434 | s003 = true; |
---|
435 | Pause(); |
---|
436 | MediaPlayer.Play("Eladard"); |
---|
437 | MediaPlayer.IsRepeating = false; |
---|
438 | selectsfx.Play(); |
---|
439 | } |
---|
440 | } |
---|
441 | void start_04() |
---|
442 | { |
---|
443 | if (!s004) |
---|
444 | { |
---|
445 | black.FadeColorTo(Color.Transparent, 0.5); |
---|
446 | player.IsVisible = false; |
---|
447 | Timer.SingleShot(0.5, hide_player); |
---|
448 | Timer.SingleShot(0.5, AddHealthbar); |
---|
449 | |
---|
450 | s004 = true; |
---|
451 | Pause(); |
---|
452 | MediaPlayer.Stop(); |
---|
453 | selectsfx.Play(); |
---|
454 | } |
---|
455 | } |
---|
456 | void hide_player() |
---|
457 | { |
---|
458 | if (!player.IsVisible) player.IsVisible = true; |
---|
459 | else player.IsVisible = false; |
---|
460 | } |
---|
461 | |
---|
462 | #region Stage Creation |
---|
463 | |
---|
464 | void CreateLevel(string level) |
---|
465 | { |
---|
466 | Gravity = new Vector(1000, 0); |
---|
467 | |
---|
468 | TileMap lvl = TileMap.FromLevelAsset(level); |
---|
469 | lvl.SetTileMethod('x', border); |
---|
470 | lvl.SetTileMethod('y', bordertop); |
---|
471 | lvl.SetTileMethod('z', borderbottom); |
---|
472 | lvl.SetTileMethod('@', filler); |
---|
473 | lvl.SetTileMethod('%', frontBorder); |
---|
474 | lvl.SetTileMethod('&', backBorder); |
---|
475 | lvl.SetTileMethod('#', bulletdes); |
---|
476 | lvl.SetTileMethod('P', AddPlayer); |
---|
477 | lvl.SetTileMethod('1', enemy_ship_1); |
---|
478 | lvl.SetTileMethod('R', enemy_ship_1_red); |
---|
479 | lvl.SetTileMethod('B', enemy_ship_1_bottom); |
---|
480 | lvl.SetTileMethod('T', enemy_ship_1_top); |
---|
481 | lvl.SetTileMethod('2', enemy_ship_2); |
---|
482 | lvl.SetTileMethod('3', enemy_ship_3); |
---|
483 | lvl.SetTileMethod('4', enemy_ship_4_top); |
---|
484 | lvl.SetTileMethod('$', enemy_ship_4_bottom); |
---|
485 | lvl.SetTileMethod('5', enemy_ship_5); |
---|
486 | lvl.SetTileMethod('6', enemy_ship_6); |
---|
487 | lvl.SetTileMethod('G', boss_ship_1); |
---|
488 | lvl.SetTileMethod('H', boss_ship_2); |
---|
489 | lvl.SetTileMethod('F', boss_ship_3); |
---|
490 | lvl.SetTileMethod('A', boss_aj); |
---|
491 | lvl.Execute(35, 35); |
---|
492 | |
---|
493 | Level.Background.Color = Color.Black; |
---|
494 | |
---|
495 | bg = new GameObject(1280, 800); |
---|
496 | bg.Image = stage1_bg; |
---|
497 | |
---|
498 | bg2 = new GameObject(1280, 800); |
---|
499 | bg2.Image = stage1_bg; |
---|
500 | |
---|
501 | movebg(); |
---|
502 | movebg2(); |
---|
503 | |
---|
504 | if (currentlevel == "level_02") |
---|
505 | { |
---|
506 | bg.Image = stage2_bg; |
---|
507 | bg2.Image = stage2_bg; |
---|
508 | } |
---|
509 | else if (currentlevel == "level_03") |
---|
510 | { |
---|
511 | bg.Image = stage3_bg; |
---|
512 | bg2.Image = stage3_bg; |
---|
513 | } |
---|
514 | else if (currentlevel == "level_04") |
---|
515 | { |
---|
516 | bg.Image = stage_aj; |
---|
517 | bg2.Image = stage_aj; |
---|
518 | } |
---|
519 | |
---|
520 | Add(bg, -3); |
---|
521 | Add(bg2, -3); |
---|
522 | |
---|
523 | AddControls(); |
---|
524 | |
---|
525 | Camera.Position = player.Position; |
---|
526 | //Camera.ZoomFactor = 0.4; |
---|
527 | } |
---|
528 | void movebg() |
---|
529 | { |
---|
530 | bg.Position = cntr; |
---|
531 | bg.MoveTo(cntr - new Vector(1280, 0), 900, movebg); |
---|
532 | } |
---|
533 | void movebg2() |
---|
534 | { |
---|
535 | bg2.Position = cntr + new Vector(1280, 0); |
---|
536 | bg2.MoveTo(cntr, 900, movebg2); |
---|
537 | } |
---|
538 | |
---|
539 | void border(Vector position, double width, double height) |
---|
540 | { |
---|
541 | GameObject border2 = new GameObject(width, height); |
---|
542 | border2.Position = position; |
---|
543 | //border2.Restitution = 0; |
---|
544 | //border2.KineticFriction = 0; |
---|
545 | //border2.StaticFriction = 0; |
---|
546 | border2.Color = Color.White; |
---|
547 | border2.Tag = "border"; |
---|
548 | Add(border2, 1); |
---|
549 | } |
---|
550 | void filler(Vector position, double width, double height) |
---|
551 | { |
---|
552 | GameObject border2 = new GameObject(width, height); |
---|
553 | border2.Position = position; |
---|
554 | border2.Color = Color.Transparent; |
---|
555 | border2.Tag = "filler"; |
---|
556 | border2.MaximumLifetime = TimeSpan.FromSeconds(1); |
---|
557 | Add(border2, 1); |
---|
558 | } |
---|
559 | void bordertop(Vector position, double width, double height) |
---|
560 | { |
---|
561 | PhysicsObject border2 = PhysicsObject.CreateStaticObject(width, height); |
---|
562 | border2.Position = position; |
---|
563 | //border2.Restitution = 0; |
---|
564 | //border2.KineticFriction = 0; |
---|
565 | //border2.StaticFriction = 0; |
---|
566 | border2.Color = Color.Black; |
---|
567 | border2.Tag = "border"; |
---|
568 | border2.Image = border_top; |
---|
569 | Add(border2, 1); |
---|
570 | } |
---|
571 | void borderbottom(Vector position, double width, double height) |
---|
572 | { |
---|
573 | PhysicsObject border2 = PhysicsObject.CreateStaticObject(width * 1.5, height); |
---|
574 | border2.Position = position; |
---|
575 | border2.Restitution = 0; |
---|
576 | border2.KineticFriction = 0; |
---|
577 | border2.StaticFriction = 0; |
---|
578 | border2.Color = Color.Black; |
---|
579 | border2.Tag = "border"; |
---|
580 | border2.Image = border_bottom; |
---|
581 | Add(border2, 1); |
---|
582 | } |
---|
583 | void frontBorder(Vector position, double width, double height) |
---|
584 | { |
---|
585 | frontborder border = new frontborder(width, height); |
---|
586 | border.Position = position; |
---|
587 | border.Color = Color.White; |
---|
588 | border.Restitution = 0; |
---|
589 | border.Tag = "border"; |
---|
590 | border.IgnoresCollisionResponse = true; |
---|
591 | border.IgnoresPhysicsLogics = true; |
---|
592 | AddCollisionHandler<PhysicsObject, player>(border, frontBorderCollision); |
---|
593 | AddCollisionHandler<PhysicsObject, enemy>(border, frontBorderCollisionEnemy); |
---|
594 | Add(border); |
---|
595 | } |
---|
596 | void backBorder(Vector position, double width, double height) |
---|
597 | { |
---|
598 | backborder border = new backborder(width, height); |
---|
599 | border.Position = position; |
---|
600 | border.Color = Color.White; |
---|
601 | border.Restitution = 0; |
---|
602 | border.Tag = "border"; |
---|
603 | border.IgnoresCollisionResponse = true; |
---|
604 | border.IgnoresCollisionResponse = true; |
---|
605 | AddCollisionHandler<PhysicsObject, player>(border, backBorderCollision); |
---|
606 | //AddCollisionHandler<PhysicsObject, enemy>(border, backBorderCollisionEnemy); |
---|
607 | Add(border); |
---|
608 | } |
---|
609 | void bulletdes(Vector position, double width, double height) |
---|
610 | { |
---|
611 | bulletdes border = new bulletdes(width, height); |
---|
612 | border.Position = position; |
---|
613 | border.Color = Color.Black; |
---|
614 | border.Restitution = 0; |
---|
615 | border.Tag = "border"; |
---|
616 | border.IgnoresCollisionResponse = true; |
---|
617 | border.IgnoresPhysicsLogics = true; |
---|
618 | Add(border, 1); |
---|
619 | } |
---|
620 | void frontBorderCollision(PhysicsObject border, PhysicsObject target) |
---|
621 | { |
---|
622 | player.health.Value = player.health.Value - player.health.Value; |
---|
623 | hurtsfx.Play(); |
---|
624 | explosionsfx.Play(); |
---|
625 | explosion_animation2(target); |
---|
626 | playership.Destroy(); |
---|
627 | |
---|
628 | } |
---|
629 | void frontBorderCollisionEnemy(PhysicsObject border, enemy enemy) |
---|
630 | { |
---|
631 | enemy.canShoot = true; |
---|
632 | |
---|
633 | } |
---|
634 | void backBorderCollision(PhysicsObject border, PhysicsObject target) |
---|
635 | { |
---|
636 | player.health.Value = player.health.Value - player.health.Value; |
---|
637 | hurtsfx.Play(); |
---|
638 | explosionsfx.Play(); |
---|
639 | explosion_animation2(target); |
---|
640 | playership.Destroy(); |
---|
641 | } |
---|
642 | void backBorderCollisionEnemy(PhysicsObject border, enemy enemy) |
---|
643 | { |
---|
644 | enemy.Destroy(); |
---|
645 | } |
---|
646 | |
---|
647 | #endregion |
---|
648 | |
---|
649 | #region Player |
---|
650 | |
---|
651 | void AddPlayer(Vector pos, double width, double height) |
---|
652 | { |
---|
653 | cntr = pos; |
---|
654 | |
---|
655 | player = new player(7, 8); |
---|
656 | playership = new PhysicsObject(47, 46); |
---|
657 | |
---|
658 | player.Shape = Shape.Circle; |
---|
659 | player.Color = Color.Black; |
---|
660 | player.Restitution = 0; |
---|
661 | player.CanRotate = false; |
---|
662 | player.Mass = int.MaxValue; |
---|
663 | player.KineticFriction = 0; |
---|
664 | player.StaticFriction = 0; |
---|
665 | player.Image = hitbox; |
---|
666 | player.IgnoresGravity = true; |
---|
667 | player.Position = pos; |
---|
668 | player.Tag = "player1"; |
---|
669 | Add(player,2); |
---|
670 | |
---|
671 | if (cursorpos == 0) |
---|
672 | { |
---|
673 | playership.Image = player_ship_01; |
---|
674 | playership.Size = new Vector(37, 48); |
---|
675 | } |
---|
676 | else if (cursorpos == 1) playership.Image = player_ship_02; |
---|
677 | playership.IsVisible = true; |
---|
678 | playership.IgnoresCollisionResponse = true; |
---|
679 | playership.IgnoresPhysicsLogics = true; |
---|
680 | playership.Angle = Angle.FromDegrees(-90); |
---|
681 | playership.CanRotate = false; |
---|
682 | playership.Tag = "playership"; |
---|
683 | playership.Position = player.Position; |
---|
684 | |
---|
685 | FollowerBrain playershipbrain = new FollowerBrain(player); |
---|
686 | playershipbrain.Speed = 500; |
---|
687 | playershipbrain.DistanceFar = 5000; |
---|
688 | playershipbrain.DistanceClose = 0; |
---|
689 | playershipbrain.StopWhenTargetClose = true; |
---|
690 | playershipbrain.Active = true; |
---|
691 | playershipbrain.TurnWhileMoving = false; |
---|
692 | |
---|
693 | playership.Brain = playershipbrain; |
---|
694 | |
---|
695 | Add(playership, -1); |
---|
696 | drd_type = cursorpos; |
---|
697 | |
---|
698 | } |
---|
699 | void AddHealthbar() |
---|
700 | { |
---|
701 | healthBar = new ProgressBar(135, 10); |
---|
702 | healthBar.BorderColor = Color.Black; |
---|
703 | healthBar.Color = Color.Black; |
---|
704 | healthBar.BarColor = Color.Red; |
---|
705 | healthBar.BindTo(player.health); |
---|
706 | healthBar.Angle = Angle.RightAngle; |
---|
707 | healthBar.Position = new Vector(Screen.LeftSafe + 30, Screen.BottomSafe + 200); |
---|
708 | Add(healthBar); |
---|
709 | } |
---|
710 | void AddControls() |
---|
711 | |
---|
712 | { |
---|
713 | ControllerOne.Listen(Button.Back, ButtonState.Pressed, ConfirmExit, null); |
---|
714 | ControllerOne.ListenAnalog(AnalogControl.LeftStick, -0.1, move, null); |
---|
715 | |
---|
716 | ControllerOne.Listen(Button.B, ButtonState.Pressed, shoot, null); |
---|
717 | ControllerOne.Listen(Button.B, ButtonState.Released, stopShoot, null); |
---|
718 | |
---|
719 | Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, null); |
---|
720 | |
---|
721 | //cheat |
---|
722 | Keyboard.Listen(Key.U, ButtonState.Pressed, cheat_upgrade, null); |
---|
723 | Keyboard.Listen(Key.I, ButtonState.Pressed, cheat_damage, null); |
---|
724 | Keyboard.Listen(Key.O, ButtonState.Pressed, cheat_spread, null); |
---|
725 | Keyboard.Listen(Key.H, ButtonState.Pressed, cheat_fullhp, null); |
---|
726 | |
---|
727 | } |
---|
728 | void move(AnalogState speed) |
---|
729 | { |
---|
730 | player.Velocity = speed.StateVector * player_speed / (ControllerOne.LeftTriggerState+1); |
---|
731 | } |
---|
732 | |
---|
733 | void cheat_upgrade() |
---|
734 | { |
---|
735 | drd_level.Value++; |
---|
736 | |
---|
737 | if (drd_level.Value == 1) |
---|
738 | { |
---|
739 | if (drd_type == 0) droid(new Vector(-45, 0)); |
---|
740 | else if (drd_type == 1) droid(new Vector(40, 0)); |
---|
741 | } |
---|
742 | else if (drd_level.Value == 2) |
---|
743 | { |
---|
744 | if (drd_type == 0) |
---|
745 | { |
---|
746 | droid(new Vector(-45, 30)); |
---|
747 | droid(new Vector(-45, -30)); |
---|
748 | } |
---|
749 | else if (drd_type == 1) |
---|
750 | { |
---|
751 | droid(new Vector(-10, 35)); |
---|
752 | droid(new Vector(-10, -35)); |
---|
753 | } |
---|
754 | } |
---|
755 | else if (drd_level.Value == 3) |
---|
756 | { |
---|
757 | if (drd_type == 0) |
---|
758 | { |
---|
759 | droid(new Vector(-30, 30)); |
---|
760 | droid(new Vector(-30, -30)); |
---|
761 | droid(new Vector(-50, 0)); |
---|
762 | } |
---|
763 | else if (drd_type == 1) |
---|
764 | { |
---|
765 | droid(new Vector(40, 0)); |
---|
766 | droid(new Vector(-10, 35)); |
---|
767 | droid(new Vector(-10, -35)); |
---|
768 | } |
---|
769 | } |
---|
770 | else if (drd_level.Value == 4) |
---|
771 | { |
---|
772 | if (drd_type == 0) |
---|
773 | { |
---|
774 | droid(new Vector(-30, 50)); |
---|
775 | droid(new Vector(-30, -50)); |
---|
776 | droid(new Vector(-50, 30)); |
---|
777 | droid(new Vector(-50, -30)); |
---|
778 | } |
---|
779 | else if (drd_type == 1) |
---|
780 | { |
---|
781 | droid(new Vector(-30, 55)); |
---|
782 | droid(new Vector(-30, -55)); |
---|
783 | droid(new Vector(-10, 35)); |
---|
784 | droid(new Vector(-10, -35)); |
---|
785 | } |
---|
786 | } |
---|
787 | } |
---|
788 | void cheat_damage() |
---|
789 | { |
---|
790 | wpn_damageRatio.Value++; |
---|
791 | } |
---|
792 | void cheat_spread() |
---|
793 | { |
---|
794 | wpn_spread.Value++; |
---|
795 | } |
---|
796 | void cheat_fullhp() |
---|
797 | { |
---|
798 | player.health.MaxValue = 100000000; |
---|
799 | player.health.Value = 100000000; |
---|
800 | } |
---|
801 | void cheat_skiptolvl1() |
---|
802 | { |
---|
803 | selectsfx.Play(); |
---|
804 | |
---|
805 | ClearControls(); |
---|
806 | |
---|
807 | selectsfx.Play(); |
---|
808 | MediaPlayer.Stop(); |
---|
809 | black = new GameObject(Screen.Width, Screen.Height); |
---|
810 | black.Position = cntr; |
---|
811 | black.Color = Color.Transparent; |
---|
812 | black.FadeColorTo(Color.Black, 0.5); |
---|
813 | Add(black, 2); |
---|
814 | |
---|
815 | Timer wait = new Timer(); |
---|
816 | wait.Interval = 1; |
---|
817 | wait.Timeout += delegate |
---|
818 | { |
---|
819 | ClearAll(); |
---|
820 | black = new GameObject(Screen.Width, Screen.Height); |
---|
821 | black.Color = Color.Black; |
---|
822 | Add(black, 2); |
---|
823 | MediaPlayer.Stop(); |
---|
824 | |
---|
825 | currentlevel = "level_01"; |
---|
826 | CreateLevel("level_01"); |
---|
827 | hide_player(); |
---|
828 | |
---|
829 | black.Position = cntr; |
---|
830 | |
---|
831 | GameObject stage_01_start = new GameObject(405, 39); |
---|
832 | stage_01_start.Position = cntr; |
---|
833 | stage_01_start.Image = stage_1_start; |
---|
834 | Add(stage_01_start, 3); |
---|
835 | |
---|
836 | double i = 0; |
---|
837 | Timer start = new Timer(); |
---|
838 | start.Interval = 0.1; |
---|
839 | start.Timeout += delegate |
---|
840 | { |
---|
841 | i++; |
---|
842 | if (i >= 15) stage_01_start.Destroy(); |
---|
843 | if (stage_01_start.IsVisible) stage_01_start.IsVisible = false; |
---|
844 | else stage_01_start.IsVisible = true; |
---|
845 | }; |
---|
846 | start.Start(15); |
---|
847 | Pause(); |
---|
848 | ControllerOne.Listen(Button.Start, ButtonState.Pressed, start_01, null); |
---|
849 | }; |
---|
850 | wait.Start(1); |
---|
851 | |
---|
852 | setwpn_timer(); |
---|
853 | } |
---|
854 | void cheat_skiptolvl2() |
---|
855 | { |
---|
856 | selectsfx.Play(); |
---|
857 | |
---|
858 | ClearControls(); |
---|
859 | |
---|
860 | selectsfx.Play(); |
---|
861 | MediaPlayer.Stop(); |
---|
862 | black = new GameObject(Screen.Width, Screen.Height); |
---|
863 | black.Position = cntr; |
---|
864 | black.Color = Color.Transparent; |
---|
865 | black.FadeColorTo(Color.Black, 0.5); |
---|
866 | Add(black, 2); |
---|
867 | |
---|
868 | Timer wait = new Timer(); |
---|
869 | wait.Interval = 1; |
---|
870 | wait.Timeout += delegate |
---|
871 | { |
---|
872 | ClearAll(); |
---|
873 | black = new GameObject(Screen.Width, Screen.Height); |
---|
874 | black.Color = Color.Black; |
---|
875 | Add(black, 2); |
---|
876 | MediaPlayer.Stop(); |
---|
877 | |
---|
878 | currentlevel = "level_02"; |
---|
879 | CreateLevel("level_02"); |
---|
880 | hide_player(); |
---|
881 | |
---|
882 | black.Position = cntr; |
---|
883 | |
---|
884 | GameObject stage_01_start = new GameObject(405, 39); |
---|
885 | stage_01_start.Position = cntr; |
---|
886 | stage_01_start.Image = stage_2_start; |
---|
887 | Add(stage_01_start, 3); |
---|
888 | |
---|
889 | double i = 0; |
---|
890 | Timer start = new Timer(); |
---|
891 | start.Interval = 0.1; |
---|
892 | start.Timeout += delegate |
---|
893 | { |
---|
894 | i++; |
---|
895 | if (i >= 15) stage_01_start.Destroy(); |
---|
896 | if (stage_01_start.IsVisible) stage_01_start.IsVisible = false; |
---|
897 | else stage_01_start.IsVisible = true; |
---|
898 | }; |
---|
899 | start.Start(15); |
---|
900 | Pause(); |
---|
901 | ControllerOne.Listen(Button.Start, ButtonState.Pressed, start_02, null); |
---|
902 | }; |
---|
903 | wait.Start(1); |
---|
904 | |
---|
905 | setwpn_timer(); |
---|
906 | } |
---|
907 | void cheat_skiptolvl3() |
---|
908 | { |
---|
909 | selectsfx.Play(); |
---|
910 | |
---|
911 | ClearControls(); |
---|
912 | |
---|
913 | selectsfx.Play(); |
---|
914 | MediaPlayer.Stop(); |
---|
915 | black = new GameObject(Screen.Width, Screen.Height); |
---|
916 | black.Position = cntr; |
---|
917 | black.Color = Color.Transparent; |
---|
918 | black.FadeColorTo(Color.Black, 0.5); |
---|
919 | Add(black, 2); |
---|
920 | |
---|
921 | Timer wait = new Timer(); |
---|
922 | wait.Interval = 1; |
---|
923 | wait.Timeout += delegate |
---|
924 | { |
---|
925 | ClearAll(); |
---|
926 | black = new GameObject(Screen.Width, Screen.Height); |
---|
927 | black.Color = Color.Black; |
---|
928 | Add(black, 2); |
---|
929 | MediaPlayer.Stop(); |
---|
930 | |
---|
931 | currentlevel = "level_03"; |
---|
932 | CreateLevel("level_03"); |
---|
933 | hide_player(); |
---|
934 | |
---|
935 | black.Position = cntr; |
---|
936 | |
---|
937 | GameObject stage_01_start = new GameObject(405, 39); |
---|
938 | stage_01_start.Position = cntr; |
---|
939 | stage_01_start.Image = stage_3_start; |
---|
940 | Add(stage_01_start, 3); |
---|
941 | |
---|
942 | double i = 0; |
---|
943 | Timer start = new Timer(); |
---|
944 | start.Interval = 0.1; |
---|
945 | start.Timeout += delegate |
---|
946 | { |
---|
947 | i++; |
---|
948 | if (i >= 15) stage_01_start.Destroy(); |
---|
949 | if (stage_01_start.IsVisible) stage_01_start.IsVisible = false; |
---|
950 | else stage_01_start.IsVisible = true; |
---|
951 | }; |
---|
952 | start.Start(15); |
---|
953 | Pause(); |
---|
954 | ControllerOne.Listen(Button.Start, ButtonState.Pressed, start_03, null); |
---|
955 | }; |
---|
956 | wait.Start(1); |
---|
957 | |
---|
958 | setwpn_timer(); |
---|
959 | } |
---|
960 | #endregion |
---|
961 | |
---|
962 | #region Weapons |
---|
963 | |
---|
964 | void shoot() |
---|
965 | { |
---|
966 | //wpn_timer.Stop(); |
---|
967 | wpn_timer.Interval = wpn_shootRate; |
---|
968 | |
---|
969 | wpn_timer.Start(); |
---|
970 | } |
---|
971 | void setwpn_timer() |
---|
972 | { |
---|
973 | wpn_timer.Timeout += delegate |
---|
974 | { |
---|
975 | if (!player.IsDestroyed) |
---|
976 | { |
---|
977 | if (ControllerOne.GetButtonState(Button.B) == ButtonState.Down) |
---|
978 | { |
---|
979 | Weapon(); |
---|
980 | wpn_timer.Interval = wpn_shootRate; |
---|
981 | shootsfx.Play(); |
---|
982 | } |
---|
983 | }; |
---|
984 | }; |
---|
985 | } |
---|
986 | void stopShoot() |
---|
987 | { |
---|
988 | wpn_timer.Stop(); |
---|
989 | } |
---|
990 | void Weapon() |
---|
991 | { |
---|
992 | if (wpn_spread.Value == 1) |
---|
993 | { |
---|
994 | Projectile(player.Position + new Vector(10, 5), new Vector(1200, 0), new Vector(40, 12) ); |
---|
995 | Projectile(player.Position + new Vector(10, -5), new Vector(1200, 0), new Vector(40, 12) ); |
---|
996 | } |
---|
997 | else if (wpn_spread.Value == 2) |
---|
998 | { |
---|
999 | Projectile(player.Position + new Vector(10, 10), new Vector(1200, 0), new Vector(40, 12) ); |
---|
1000 | Projectile(player.Position + new Vector(10, -10), new Vector(1200, 0), new Vector(40, 12) ); |
---|
1001 | Projectile(player.Position + new Vector(10, 0), new Vector(1200, 0), new Vector(40, 12) ); |
---|
1002 | } |
---|
1003 | else if (wpn_spread.Value == 3) |
---|
1004 | { |
---|
1005 | Projectile(player.Position + new Vector(10, 5), new Vector(1200, 15), new Vector(40, 12) ); |
---|
1006 | Projectile(player.Position + new Vector(10, -5), new Vector(1200, -15), new Vector(40, 12) ); |
---|
1007 | Projectile(player.Position + new Vector(10, 10), new Vector(1200, 20), new Vector(40, 12) ); |
---|
1008 | Projectile(player.Position + new Vector(10, -10), new Vector(1200, -20), new Vector(40, 12) ); |
---|
1009 | } |
---|
1010 | else if (wpn_spread.Value == 4) |
---|
1011 | { |
---|
1012 | Projectile(player.Position + new Vector(10, 5), new Vector(1200, 25), new Vector(40, 12) ); |
---|
1013 | Projectile(player.Position + new Vector(10, -5), new Vector(1200, -25), new Vector(40, 12) ); |
---|
1014 | Projectile(player.Position + new Vector(10, 0), new Vector(1200, 0), new Vector(40, 12) ); |
---|
1015 | Projectile(player.Position + new Vector(10, 10), new Vector(1200, 50), new Vector(40, 12) ); |
---|
1016 | Projectile(player.Position + new Vector(10, -10), new Vector(1200, -50), new Vector(40, 12) ); |
---|
1017 | } |
---|
1018 | else if (wpn_spread.Value == 5) |
---|
1019 | { |
---|
1020 | Projectile(player.Position + new Vector(10, 0), new Vector(1200, 0), new Vector(40, 12) ); |
---|
1021 | Projectile(player.Position + new Vector(10, -0), new Vector(1200, 0), new Vector(40, 12) ); |
---|
1022 | |
---|
1023 | Projectile(player.Position + new Vector(10, 5), new Vector(1200, 50), new Vector(40, 12) ); |
---|
1024 | Projectile(player.Position + new Vector(10, -5), new Vector(1200, -50), new Vector(40, 12) ); |
---|
1025 | |
---|
1026 | Projectile(player.Position + new Vector(10, 10), new Vector(1200, 55), new Vector(40, 12) ); |
---|
1027 | Projectile(player.Position + new Vector(10, -10), new Vector(1200, -55), new Vector(40, 12) ); |
---|
1028 | } |
---|
1029 | else if (wpn_spread.Value == 6) |
---|
1030 | { |
---|
1031 | Projectile(player.Position + new Vector(10, 0), new Vector(1200, 25), new Vector(40, 12) ); |
---|
1032 | Projectile(player.Position + new Vector(10, -0), new Vector(1200, -25), new Vector(40, 12) ); |
---|
1033 | Projectile(player.Position + new Vector(10, 0), new Vector(1200, 0), new Vector(40, 12) ); |
---|
1034 | Projectile(player.Position + new Vector(10, 5), new Vector(1200, 50), new Vector(40, 12) ); |
---|
1035 | Projectile(player.Position + new Vector(10, -5), new Vector(1200, -50), new Vector(40, 12) ); |
---|
1036 | |
---|
1037 | Projectile(player.Position + new Vector(10, 10), new Vector(1200, 75), new Vector(40, 12) ); |
---|
1038 | Projectile(player.Position + new Vector(10, -10), new Vector(1200, -75), new Vector(40, 12) ); |
---|
1039 | } |
---|
1040 | else if (wpn_spread.Value == 7) |
---|
1041 | { |
---|
1042 | Projectile(player.Position + new Vector(10, 0), new Vector(1200, 15), new Vector(40, 12) ); |
---|
1043 | Projectile(player.Position + new Vector(10, -0), new Vector(1200, -15), new Vector(40, 12) ); |
---|
1044 | Projectile(player.Position + new Vector(10, 5), new Vector(1200, 15), new Vector(40, 12) ); |
---|
1045 | Projectile(player.Position + new Vector(10, -5), new Vector(1200, -15), new Vector(40, 12) ); |
---|
1046 | |
---|
1047 | Projectile(player.Position + new Vector(10, 0), new Vector(1200, 50), new Vector(40, 12) ); |
---|
1048 | Projectile(player.Position + new Vector(10, -0), new Vector(1200, -50), new Vector(40, 12) ); |
---|
1049 | |
---|
1050 | Projectile(player.Position + new Vector(10, 10), new Vector(1200, 50), new Vector(40, 12) ); |
---|
1051 | Projectile(player.Position + new Vector(10, -10), new Vector(1200, -50), new Vector(40, 12) ); |
---|
1052 | } |
---|
1053 | else if (wpn_spread.Value == 8) |
---|
1054 | { |
---|
1055 | Projectile(player.Position + new Vector(10, 0), new Vector(1200, 0), new Vector(40, 12) ); |
---|
1056 | Projectile(player.Position + new Vector(10, 0), new Vector(1200, 25), new Vector(40, 12) ); |
---|
1057 | Projectile(player.Position + new Vector(10, -0), new Vector(1200, -25), new Vector(40, 12) ); |
---|
1058 | Projectile(player.Position + new Vector(10, 5), new Vector(1200, 25), new Vector(40, 12) ); |
---|
1059 | Projectile(player.Position + new Vector(10, -5), new Vector(1200, -25), new Vector(40, 12) ); |
---|
1060 | |
---|
1061 | Projectile(player.Position + new Vector(10, 5), new Vector(1200, 50), new Vector(40, 12) ); |
---|
1062 | Projectile(player.Position + new Vector(10, -5), new Vector(1200, -50), new Vector(40, 12) ); |
---|
1063 | |
---|
1064 | Projectile(player.Position + new Vector(10, 10), new Vector(1200, 50), new Vector(40, 12) ); |
---|
1065 | Projectile(player.Position + new Vector(10, -10), new Vector(1200, -50), new Vector(40, 12) ); |
---|
1066 | } |
---|
1067 | else if (wpn_spread.Value == 9) |
---|
1068 | { |
---|
1069 | Projectile(player.Position + new Vector(10, 0), new Vector(1200, 15), new Vector(40, 12)); |
---|
1070 | Projectile(player.Position + new Vector(10, -0), new Vector(1200, -15), new Vector(40, 12)); |
---|
1071 | Projectile(player.Position + new Vector(10, 10), new Vector(1200, 15), new Vector(40, 12)); |
---|
1072 | Projectile(player.Position + new Vector(10, -10), new Vector(1200, -15), new Vector(40, 12)); |
---|
1073 | |
---|
1074 | Projectile(player.Position + new Vector(10, 0), new Vector(1200, 50), new Vector(40, 12)); |
---|
1075 | Projectile(player.Position + new Vector(10, -0), new Vector(1200, -50), new Vector(40, 12)); |
---|
1076 | |
---|
1077 | Projectile(player.Position + new Vector(10, 10), new Vector(1200, 50), new Vector(40, 12)); |
---|
1078 | Projectile(player.Position + new Vector(10, -10), new Vector(1200, -50), new Vector(40, 12)); |
---|
1079 | |
---|
1080 | Projectile(player.Position + new Vector(10, 0), new Vector(1200, 75), new Vector(40, 12)); |
---|
1081 | Projectile(player.Position + new Vector(10, -0), new Vector(1200, -75), new Vector(40, 12)); |
---|
1082 | } |
---|
1083 | else if (wpn_spread.Value == 10) |
---|
1084 | { |
---|
1085 | Projectile(player.Position + new Vector(10, 0), new Vector(1200, 25), new Vector(40, 12) ); |
---|
1086 | Projectile(player.Position + new Vector(10, -0), new Vector(1200, -25), new Vector(40, 12)); |
---|
1087 | Projectile(player.Position + new Vector(10, 0), new Vector(1200, 0), new Vector(40, 12)); |
---|
1088 | Projectile(player.Position + new Vector(10, 0), new Vector(1200, 50), new Vector(40, 12)); |
---|
1089 | Projectile(player.Position + new Vector(10, -0), new Vector(1200, -50), new Vector(40, 12) ); |
---|
1090 | |
---|
1091 | Projectile(player.Position + new Vector(10, 5), new Vector(1200, 75), new Vector(40, 12) ); |
---|
1092 | Projectile(player.Position + new Vector(10, -5), new Vector(1200, -75), new Vector(40, 12) ); |
---|
1093 | |
---|
1094 | Projectile(player.Position + new Vector(10, 10), new Vector(1200, 100), new Vector(40, 12) ); |
---|
1095 | Projectile(player.Position + new Vector(10, -10), new Vector(1200, -100), new Vector(40, 12) ); |
---|
1096 | |
---|
1097 | Projectile(player.Position + new Vector(10, 10), new Vector(1200, 125), new Vector(40, 12) ); |
---|
1098 | Projectile(player.Position + new Vector(10, -10), new Vector(1200, -125), new Vector(40, 12) ); |
---|
1099 | } |
---|
1100 | } |
---|
1101 | void Projectile(Vector pos, Vector vel, Vector size) |
---|
1102 | { |
---|
1103 | bullet projectile = new bullet(size.X, size.Y); |
---|
1104 | projectile.Shape = Shape.Diamond; |
---|
1105 | projectile.IgnoresGravity = true; |
---|
1106 | projectile.Position = pos; |
---|
1107 | projectile.Tag = "player_bullet"; |
---|
1108 | |
---|
1109 | if (wpn_damageRatio <= 2) projectile.Image = bullet_player01; |
---|
1110 | else if (wpn_damageRatio.Value <= 4) projectile.Image = bullet_player03; |
---|
1111 | else if (wpn_damageRatio.Value <= 6) projectile.Image = bullet_player04; |
---|
1112 | else if (wpn_damageRatio.Value <= 8) projectile.Image = bullet_player02; |
---|
1113 | else if (wpn_damageRatio.Value <= 10) projectile.Image = bullet_player05; |
---|
1114 | |
---|
1115 | projectile.damage = wpn_damageRatio.Value; |
---|
1116 | projectile.IgnoresCollisionResponse = true; |
---|
1117 | |
---|
1118 | projectile.CollisionIgnoreGroup = 2; |
---|
1119 | |
---|
1120 | AddCollisionHandler<bullet, frontborder>(projectile, destroy); |
---|
1121 | AddCollisionHandler<bullet, enemy>(projectile, damageEnemy); |
---|
1122 | |
---|
1123 | Add(projectile, 0); |
---|
1124 | projectile.Hit(vel/1.2); |
---|
1125 | projectile.Angle = projectile.Velocity.Angle; |
---|
1126 | } |
---|
1127 | |
---|
1128 | void droid(Vector pos) |
---|
1129 | { |
---|
1130 | droid drd = new droid(13,13); |
---|
1131 | drd.IgnoresCollisionResponse = true; |
---|
1132 | drd.CollisionIgnoreGroup = 2; |
---|
1133 | drd.Position = player.Position + pos; |
---|
1134 | drd.droid_level.Value = drd_level; |
---|
1135 | if (cursorpos == 0) drd.Animation = droid2_anim; |
---|
1136 | else if (cursorpos == 1) drd.Animation = droid_anim; |
---|
1137 | drd.Animation.Start(); |
---|
1138 | setdrd_shoot_timer(drd); |
---|
1139 | |
---|
1140 | Timer move = new Timer(); |
---|
1141 | move.Interval = 0.01; |
---|
1142 | move.Timeout += delegate |
---|
1143 | { |
---|
1144 | if (player.IsDestroyed) drd.Destroy(); |
---|
1145 | if (drd.IsDestroyed) move.Stop(); |
---|
1146 | |
---|
1147 | if (drd.Position != player.Position + pos) |
---|
1148 | { |
---|
1149 | drd.Position = player.Position + pos; |
---|
1150 | } |
---|
1151 | if (drd.droid_level.Value != drd_level.Value && drd_level.Value != 5) drd.Destroy(); |
---|
1152 | }; |
---|
1153 | move.Start(); |
---|
1154 | |
---|
1155 | Add(drd); |
---|
1156 | } |
---|
1157 | void setdrd_shoot_timer(droid drd) |
---|
1158 | { |
---|
1159 | Timer drdshoot = new Timer(); |
---|
1160 | drdshoot.Interval = drd_shootRate; |
---|
1161 | if (cursorpos == 0) |
---|
1162 | { |
---|
1163 | drdshoot.Timeout += delegate |
---|
1164 | { |
---|
1165 | if (drd.IsDestroyed) drdshoot.Stop(); |
---|
1166 | if (ControllerOne.GetButtonState(Button.B) == ButtonState.Down) |
---|
1167 | { |
---|
1168 | droidprojectile(drd.Position, new Vector(-400, RandomGen.NextDouble(100, 150)), new Vector(24, 13)); |
---|
1169 | droidprojectile(drd.Position, new Vector(-400, RandomGen.NextDouble(-150, -100)), new Vector(24, 13)); |
---|
1170 | } |
---|
1171 | }; |
---|
1172 | } |
---|
1173 | else if (cursorpos == 1) |
---|
1174 | { |
---|
1175 | drdshoot.Timeout += delegate |
---|
1176 | { |
---|
1177 | if (drd.IsDestroyed) drdshoot.Stop(); |
---|
1178 | if (ControllerOne.GetButtonState(Button.B) == ButtonState.Down) |
---|
1179 | { |
---|
1180 | if (drd.IsDestroyed) drdshoot.Stop(); |
---|
1181 | droidlaser(drd.Position + new Vector(37, 0), new Vector(1400, 0), new Vector(60, 5)); |
---|
1182 | } |
---|
1183 | }; |
---|
1184 | } |
---|
1185 | |
---|
1186 | drdshoot.Start(); |
---|
1187 | } |
---|
1188 | |
---|
1189 | void droidprojectile(Vector pos, Vector vel, Vector size) |
---|
1190 | { |
---|
1191 | bullet projectile = new bullet(size.X, size.Y/2); |
---|
1192 | projectile.Shape = Shape.Diamond; |
---|
1193 | projectile.IgnoresGravity = false; |
---|
1194 | projectile.Position = pos; |
---|
1195 | projectile.Tag = "player_bullet"; |
---|
1196 | projectile.Image = bullet_droid; |
---|
1197 | projectile.damage = drd_damageRatio.Value; |
---|
1198 | projectile.LinearDamping = 0.99; |
---|
1199 | |
---|
1200 | projectile.IgnoresCollisionResponse = true; |
---|
1201 | |
---|
1202 | projectile.CollisionIgnoreGroup = 2; |
---|
1203 | projectile.MaximumLifetime = TimeSpan.FromSeconds(3); |
---|
1204 | |
---|
1205 | AddCollisionHandler<bullet, frontborder>(projectile, destroy); |
---|
1206 | AddCollisionHandler<bullet, enemy>(projectile, damageEnemy); |
---|
1207 | |
---|
1208 | Add(projectile, -1); |
---|
1209 | projectile.Hit(vel); |
---|
1210 | projectile.Angle = projectile.Velocity.Angle; |
---|
1211 | |
---|
1212 | Timer angle = new Timer(); |
---|
1213 | angle.Interval = 0.05; |
---|
1214 | angle.Timeout += delegate |
---|
1215 | { |
---|
1216 | projectile.Angle = projectile.Velocity.Angle; |
---|
1217 | if (projectile.IsDestroyed) { angle.Stop(); }; |
---|
1218 | }; |
---|
1219 | angle.Start(); |
---|
1220 | } |
---|
1221 | void droidlaser(Vector pos, Vector vel, Vector size) |
---|
1222 | { |
---|
1223 | bullet projectile = new bullet(size.X, size.Y); |
---|
1224 | projectile.Shape = Shape.Rectangle; |
---|
1225 | projectile.IgnoresGravity = true; |
---|
1226 | projectile.Position = pos; |
---|
1227 | projectile.Tag = "player_bullet"; |
---|
1228 | projectile.Image = bullet_laser; |
---|
1229 | projectile.damage = drd_damageRatio.Value * 2; |
---|
1230 | |
---|
1231 | projectile.IgnoresCollisionResponse = true; |
---|
1232 | |
---|
1233 | projectile.CollisionIgnoreGroup = 2; |
---|
1234 | projectile.MaximumLifetime = TimeSpan.FromSeconds(1.2); |
---|
1235 | |
---|
1236 | AddCollisionHandler<bullet, frontborder>(projectile, destroy); |
---|
1237 | AddCollisionHandler<bullet, enemy>(projectile, damageEnemy); |
---|
1238 | |
---|
1239 | Add(projectile, -1); |
---|
1240 | projectile.Hit(vel); |
---|
1241 | |
---|
1242 | } |
---|
1243 | |
---|
1244 | #endregion |
---|
1245 | |
---|
1246 | #region Enemies |
---|
1247 | |
---|
1248 | void enemy_ship_1(Vector pos, double width, double height) |
---|
1249 | { |
---|
1250 | enemy enemyship = new enemy(70, 35); |
---|
1251 | enemyship.Shape = Shape.Circle; |
---|
1252 | enemyship.Color = Color.Black; |
---|
1253 | enemyship.Position = pos; |
---|
1254 | enemyship.IgnoresCollisionResponse = true; |
---|
1255 | enemyship.CollisionIgnoreGroup = 3; |
---|
1256 | enemyship.health.MaxValue = 10; |
---|
1257 | enemyship.Image = enemy_ship_01; |
---|
1258 | |
---|
1259 | Add(enemyship, -1); |
---|
1260 | enemyship.Hit(stagespeed); |
---|
1261 | AddCollisionHandler<enemy, player>(enemyship, damagePlayerEnemyShip); |
---|
1262 | AddCollisionHandler<enemy, frontborder>(enemyship, enemy_ship_1_frontborder); |
---|
1263 | } |
---|
1264 | void enemy_ship_1_frontborder(enemy enemyship, frontborder border) |
---|
1265 | { |
---|
1266 | enemyship.LifetimeLeft = TimeSpan.FromSeconds(3); |
---|
1267 | } |
---|
1268 | void enemy_ship_1_red(Vector pos, double width, double height) |
---|
1269 | { |
---|
1270 | enemy enemyship = new enemy(70, 35); |
---|
1271 | enemyship.Shape = Shape.Circle; |
---|
1272 | enemyship.Color = Color.Black; |
---|
1273 | enemyship.Position = pos; |
---|
1274 | enemyship.IgnoresCollisionResponse = true; |
---|
1275 | enemyship.health.MaxValue = 10; |
---|
1276 | enemyship.Image = enemy_ship_01_red; |
---|
1277 | enemyship.CollisionIgnoreGroup = 3; |
---|
1278 | |
---|
1279 | Add(enemyship, -1); |
---|
1280 | enemyship.Hit(stagespeed); |
---|
1281 | AddCollisionHandler<enemy, player>(enemyship, damagePlayerEnemyShip); |
---|
1282 | AddCollisionHandler<enemy, frontborder>(enemyship, enemy_ship_1_red_frontborder); |
---|
1283 | } |
---|
1284 | void enemy_ship_1_red_frontborder(enemy enemyship, frontborder border) |
---|
1285 | { |
---|
1286 | if (!enemyship.canShoot) |
---|
1287 | { |
---|
1288 | enemyship.Angle = Angle.FromDegrees(180); |
---|
1289 | enemyship.Velocity = -stagespeed; |
---|
1290 | enemyship.Position = new Vector(border.X-1400, enemyship.Position.Y); |
---|
1291 | enemyship.LifetimeLeft = TimeSpan.FromSeconds(3); |
---|
1292 | |
---|
1293 | enemyship.canShoot = true; |
---|
1294 | }; |
---|
1295 | } |
---|
1296 | void enemy_ship_1_bottom(Vector pos, double width, double height) |
---|
1297 | { |
---|
1298 | enemy enemyship = new enemy(35, 70); |
---|
1299 | enemyship.Shape = Shape.Circle; |
---|
1300 | enemyship.Color = Color.Black; |
---|
1301 | enemyship.Position = pos; |
---|
1302 | enemyship.IgnoresCollisionResponse = true; |
---|
1303 | enemyship.CollisionIgnoreGroup = 3; |
---|
1304 | enemyship.health.MaxValue = 10; |
---|
1305 | enemyship.Image = enemy_ship_01_blue; |
---|
1306 | enemyship.Angle = Angle.FromDegrees(90); |
---|
1307 | |
---|
1308 | Add(enemyship, -1); |
---|
1309 | enemyship.Hit(stagespeed); |
---|
1310 | AddCollisionHandler<enemy, player>(enemyship, damagePlayerEnemyShip); |
---|
1311 | AddCollisionHandler<PhysicsObject, frontborder>(enemyship, enemy_ship_1_bottom_frontborder); |
---|
1312 | } |
---|
1313 | void enemy_ship_1_bottom_frontborder(PhysicsObject enemyship, frontborder br) |
---|
1314 | { |
---|
1315 | enemyship.LifetimeLeft = TimeSpan.FromSeconds(3); |
---|
1316 | enemyship.Angle = Angle.FromDegrees(0); |
---|
1317 | enemyship.Velocity = new Vector(0, -stagespeed.X/1.7); |
---|
1318 | enemyship.Position = new Vector(cntr.X + enemyship.Y, -405); |
---|
1319 | } |
---|
1320 | void enemy_ship_1_top(Vector pos, double width, double height) |
---|
1321 | { |
---|
1322 | enemy enemyship = new enemy(35, 70); |
---|
1323 | enemyship.Shape = Shape.Circle; |
---|
1324 | enemyship.Color = Color.Black; |
---|
1325 | enemyship.Position = pos; |
---|
1326 | enemyship.IgnoresCollisionResponse = true; |
---|
1327 | enemyship.CollisionIgnoreGroup = 3; |
---|
1328 | enemyship.health.MaxValue = 10; |
---|
1329 | enemyship.Image = enemy_ship_01_blue_inverted; |
---|
1330 | enemyship.Angle = Angle.FromDegrees(90); |
---|
1331 | |
---|
1332 | Add(enemyship, -1); |
---|
1333 | enemyship.Hit(stagespeed); |
---|
1334 | AddCollisionHandler<enemy, player>(enemyship, damagePlayerEnemyShip); |
---|
1335 | AddCollisionHandler<PhysicsObject, frontborder>(enemyship, enemy_ship_1_top_frontborder); |
---|
1336 | } |
---|
1337 | void enemy_ship_1_top_frontborder(PhysicsObject enemysship, frontborder br) |
---|
1338 | { |
---|
1339 | enemysship.LifetimeLeft = TimeSpan.FromSeconds(3); |
---|
1340 | enemysship.Angle = Angle.FromDegrees(0); |
---|
1341 | enemysship.Velocity = new Vector(0, stagespeed.X / 1.75); |
---|
1342 | |
---|
1343 | enemysship.Position = new Vector(cntr.X + enemysship.Y, 405); |
---|
1344 | } |
---|
1345 | void enemy_ship_2(Vector pos, double widht, double height) |
---|
1346 | { |
---|
1347 | enemy enemyship = new enemy(70, 30); |
---|
1348 | enemyship.Shape = Shape.Circle; |
---|
1349 | enemyship.Color = Color.Black; |
---|
1350 | enemyship.Position = pos; |
---|
1351 | enemyship.IgnoresCollisionResponse = true; |
---|
1352 | enemyship.CollisionIgnoreGroup = 3; |
---|
1353 | enemyship.health.MaxValue = 45; |
---|
1354 | enemyship.Image = enemy_ship_02; |
---|
1355 | |
---|
1356 | Add(enemyship, -1); |
---|
1357 | enemyship.Hit(stagespeed); |
---|
1358 | AddCollisionHandler<enemy, player>(enemyship, damagePlayerEnemyShip); |
---|
1359 | AddCollisionHandler<enemy, frontborder>(enemyship, enemy_ship_2_start_shooting); |
---|
1360 | } |
---|
1361 | void enemy_ship_2_start_shooting(enemy enemyship, frontborder border) |
---|
1362 | { |
---|
1363 | if (!enemyship.canShoot) |
---|
1364 | { |
---|
1365 | enemyship.canShoot = true; |
---|
1366 | |
---|
1367 | enemyship.Velocity = enemyship.Velocity / 2; |
---|
1368 | |
---|
1369 | double angle = 0; |
---|
1370 | double i = 1; |
---|
1371 | double c = 0; |
---|
1372 | UnlimitedAngle angle2; |
---|
1373 | |
---|
1374 | Timer playsfx = new Timer(); |
---|
1375 | playsfx.Interval = 0.05; |
---|
1376 | playsfx.Timeout += delegate |
---|
1377 | { |
---|
1378 | enemy_shootsfx.Play(); |
---|
1379 | }; |
---|
1380 | |
---|
1381 | Timer shoot = new Timer(); |
---|
1382 | shoot.Interval = 0.01; |
---|
1383 | shoot.Timeout += delegate |
---|
1384 | { |
---|
1385 | if (c >= 200){ |
---|
1386 | shoot.Stop(); |
---|
1387 | playsfx.Stop(); |
---|
1388 | } |
---|
1389 | else if (c != 200) |
---|
1390 | { |
---|
1391 | if (!enemyship.IsDestroyed) |
---|
1392 | { |
---|
1393 | angle = angle + i; |
---|
1394 | i = i + 0.1; |
---|
1395 | c++; |
---|
1396 | angle2 = UnlimitedAngle.FromDegrees(angle); |
---|
1397 | enemy_shoot_2(enemyship.Position, |
---|
1398 | |
---|
1399 | angle2.GetVector() * 500 |
---|
1400 | ); |
---|
1401 | } |
---|
1402 | else |
---|
1403 | { |
---|
1404 | shoot.Stop(); |
---|
1405 | playsfx.Stop(); |
---|
1406 | } |
---|
1407 | }; |
---|
1408 | |
---|
1409 | }; |
---|
1410 | |
---|
1411 | Timer wait = new Timer(); |
---|
1412 | wait.Interval = 0.5; |
---|
1413 | wait.Timeout += delegate |
---|
1414 | { |
---|
1415 | if (!enemyship.IsDestroyed) |
---|
1416 | { |
---|
1417 | shoot.Start(); |
---|
1418 | playsfx.Start(); |
---|
1419 | } |
---|
1420 | else wait.Stop(); |
---|
1421 | }; |
---|
1422 | wait.Start(1); |
---|
1423 | } |
---|
1424 | } |
---|
1425 | void enemy_ship_3(Vector pos, double width, double height) |
---|
1426 | { |
---|
1427 | enemy enemyship = new enemy(71, 56); |
---|
1428 | enemyship.Shape = Shape.Circle; |
---|
1429 | enemyship.Position = pos; |
---|
1430 | enemyship.IgnoresCollisionResponse = true; |
---|
1431 | enemyship.CollisionIgnoreGroup = 3; |
---|
1432 | enemyship.health.MaxValue = 60; |
---|
1433 | enemyship.Image = enemy_ship_03; |
---|
1434 | enemyship.explosion_scale = 75; |
---|
1435 | |
---|
1436 | Add(enemyship,-1); |
---|
1437 | enemyship.Hit(stagespeed); |
---|
1438 | |
---|
1439 | AddCollisionHandler<enemy, frontborder>(enemyship, enemy_ship_3_start_shooting); |
---|
1440 | AddCollisionHandler<enemy, player>(enemyship,damagePlayerEnemyShip2); |
---|
1441 | } |
---|
1442 | void enemy_ship_3_start_shooting(enemy enemyship, frontborder border) |
---|
1443 | { |
---|
1444 | if (!enemyship.canShoot) |
---|
1445 | { |
---|
1446 | enemyship.canShoot = true; |
---|
1447 | enemyship.LifetimeLeft = TimeSpan.FromSeconds(60); |
---|
1448 | enemyship.Velocity = enemyship.Velocity / 3; |
---|
1449 | int i = 0; |
---|
1450 | int e = 0; |
---|
1451 | |
---|
1452 | Timer playsfx = new Timer(); |
---|
1453 | playsfx.Interval = 0.06; |
---|
1454 | playsfx.Timeout += delegate |
---|
1455 | { |
---|
1456 | enemy_shootsfx.Play(); |
---|
1457 | }; |
---|
1458 | |
---|
1459 | Timer wait = new Timer(); |
---|
1460 | |
---|
1461 | Timer enemy_shoot = new Timer(); |
---|
1462 | enemy_shoot.Interval = 0.02; |
---|
1463 | enemy_shoot.Timeout += delegate |
---|
1464 | { |
---|
1465 | if (e >= 4) |
---|
1466 | { |
---|
1467 | |
---|
1468 | enemy_shoot.Stop(); |
---|
1469 | playsfx.Stop(); |
---|
1470 | enemyship.Velocity = stagespeed / 3; |
---|
1471 | enemyship.LifetimeLeft = TimeSpan.FromSeconds(6); |
---|
1472 | }; |
---|
1473 | i++; |
---|
1474 | if (i == 50 && e != 4) |
---|
1475 | { |
---|
1476 | enemy_shoot.Stop(); |
---|
1477 | playsfx.Stop(); |
---|
1478 | wait.Start(1); |
---|
1479 | e++; |
---|
1480 | }; |
---|
1481 | if (enemyship.IsDestroyed) |
---|
1482 | { |
---|
1483 | enemy_shoot.Stop(); |
---|
1484 | playsfx.Stop(); |
---|
1485 | } |
---|
1486 | if (e != 4) |
---|
1487 | { |
---|
1488 | enemy_shoot_1(enemyship.Position + new Vector(RandomGen.NextDouble(-30, 30), RandomGen.NextDouble(-30, 30))); |
---|
1489 | } |
---|
1490 | }; |
---|
1491 | |
---|
1492 | wait.Interval = 0.5; |
---|
1493 | wait.Timeout += delegate |
---|
1494 | { |
---|
1495 | if (enemyship.IsDestroyed) wait.Stop(); |
---|
1496 | i = 0; |
---|
1497 | enemy_shoot.Start(50); |
---|
1498 | playsfx.Start(); |
---|
1499 | }; |
---|
1500 | |
---|
1501 | Timer enemy_start = new Timer(); |
---|
1502 | enemy_start.Interval = 3; |
---|
1503 | enemy_start.Timeout += delegate |
---|
1504 | { |
---|
1505 | if (!enemyship.IsDestroyed) |
---|
1506 | { |
---|
1507 | playsfx.Start(); |
---|
1508 | enemy_shoot.Start(50); |
---|
1509 | enemyship.Velocity = new Vector(0,0); |
---|
1510 | }; |
---|
1511 | }; |
---|
1512 | enemy_start.Start(1); |
---|
1513 | |
---|
1514 | }; |
---|
1515 | } |
---|
1516 | void enemy_ship_4_top(Vector pos, double width, double height) |
---|
1517 | { |
---|
1518 | enemy enemyship = new enemy(43, 33); |
---|
1519 | enemyship.Shape = Shape.Circle; |
---|
1520 | enemyship.Color = Color.Black; |
---|
1521 | enemyship.Position = pos; |
---|
1522 | enemyship.IgnoresCollisionResponse = true; |
---|
1523 | enemyship.CollisionIgnoreGroup = 3; |
---|
1524 | enemyship.health.MaxValue = 15; |
---|
1525 | enemyship.Image = enemy_ship_04; |
---|
1526 | |
---|
1527 | Add(enemyship, -1); |
---|
1528 | enemyship.Hit(stagespeed); |
---|
1529 | AddCollisionHandler<enemy, player>(enemyship, damagePlayerEnemyShip); |
---|
1530 | AddCollisionHandler<enemy, frontborder>(enemyship, enemy_ship_4_top_frontborder); |
---|
1531 | } |
---|
1532 | void enemy_ship_4_top_frontborder(enemy enemysship, frontborder br) |
---|
1533 | { |
---|
1534 | if (!enemysship.canShoot) |
---|
1535 | { |
---|
1536 | enemysship.canShoot = true; |
---|
1537 | |
---|
1538 | //enemysship.LifetimeLeft = TimeSpan.FromSeconds(3); |
---|
1539 | enemysship.Velocity = new Vector(0, stagespeed.X); |
---|
1540 | enemysship.Position = new Vector(cntr.X + enemysship.Y, 405); |
---|
1541 | |
---|
1542 | Timer chk = new Timer(); |
---|
1543 | chk.Interval = 0.01; |
---|
1544 | chk.Timeout += delegate |
---|
1545 | { |
---|
1546 | if (!enemysship.IsDestroyed) |
---|
1547 | { |
---|
1548 | if (enemysship.Y >= player.Y - 10 && enemysship.Y <= player.Y + 10) |
---|
1549 | { |
---|
1550 | enemysship.Velocity = stagespeed; |
---|
1551 | if ((player.X - enemysship.X) > 0) enemysship.Velocity = -stagespeed; |
---|
1552 | chk.Stop(); |
---|
1553 | enemysship.LifetimeLeft = TimeSpan.FromSeconds(3); |
---|
1554 | } |
---|
1555 | } |
---|
1556 | else if (enemysship.IsDestroyed) chk.Stop(); |
---|
1557 | }; |
---|
1558 | |
---|
1559 | chk.Start(); |
---|
1560 | }; |
---|
1561 | } |
---|
1562 | void enemy_ship_4_bottom(Vector pos, double width, double height) |
---|
1563 | { |
---|
1564 | enemy enemyship = new enemy(43, 33); |
---|
1565 | enemyship.Shape = Shape.Circle; |
---|
1566 | enemyship.Color = Color.Black; |
---|
1567 | enemyship.Position = pos; |
---|
1568 | enemyship.IgnoresCollisionResponse = true; |
---|
1569 | enemyship.CollisionIgnoreGroup = 3; |
---|
1570 | enemyship.health.MaxValue = 15; |
---|
1571 | enemyship.Image = enemy_ship_04; |
---|
1572 | |
---|
1573 | Add(enemyship, -1); |
---|
1574 | enemyship.Hit(stagespeed); |
---|
1575 | AddCollisionHandler<enemy, player>(enemyship, damagePlayerEnemyShip); |
---|
1576 | AddCollisionHandler<enemy, frontborder>(enemyship, enemy_ship_4_bottom_frontborder); |
---|
1577 | } |
---|
1578 | void enemy_ship_4_bottom_frontborder(enemy enemysship, frontborder br) |
---|
1579 | { |
---|
1580 | if (!enemysship.canShoot) |
---|
1581 | { |
---|
1582 | enemysship.canShoot = true; |
---|
1583 | enemysship.Velocity = new Vector(0, -stagespeed.X); |
---|
1584 | enemysship.Position = new Vector(cntr.X + enemysship.Y, -405); |
---|
1585 | |
---|
1586 | Timer chk = new Timer(); |
---|
1587 | chk.Interval = 0.01; |
---|
1588 | chk.Timeout += delegate |
---|
1589 | { |
---|
1590 | if (!enemysship.IsDestroyed) |
---|
1591 | { |
---|
1592 | if (enemysship.Y >= player.Y - 10 && enemysship.Y <= player.Y + 10) |
---|
1593 | { |
---|
1594 | enemysship.Velocity = stagespeed; |
---|
1595 | if ((player.X - enemysship.X) > 0) enemysship.Velocity = -stagespeed; |
---|
1596 | chk.Stop(); |
---|
1597 | enemysship.LifetimeLeft = TimeSpan.FromSeconds(3); |
---|
1598 | } |
---|
1599 | } |
---|
1600 | else if (enemysship.IsDestroyed) chk.Stop(); |
---|
1601 | }; |
---|
1602 | |
---|
1603 | chk.Start(); |
---|
1604 | }; |
---|
1605 | } |
---|
1606 | void enemy_ship_5(Vector pos, double width, double height) |
---|
1607 | { |
---|
1608 | enemy enemyship = new enemy(62, 49); |
---|
1609 | enemyship.Shape = Shape.Circle; |
---|
1610 | enemyship.Position = pos; |
---|
1611 | enemyship.IgnoresCollisionResponse = true; |
---|
1612 | enemyship.CollisionIgnoreGroup = 3; |
---|
1613 | enemyship.health.MaxValue = 45; |
---|
1614 | enemyship.Image = enemy_ship_05; |
---|
1615 | enemyship.explosion_scale = 70; |
---|
1616 | |
---|
1617 | Add(enemyship, -1); |
---|
1618 | enemyship.Hit(stagespeed); |
---|
1619 | |
---|
1620 | AddCollisionHandler<enemy, frontborder>(enemyship, enemy_ship_5_start_shooting); |
---|
1621 | AddCollisionHandler<enemy, player>(enemyship, damagePlayerEnemyShip2); |
---|
1622 | } |
---|
1623 | void enemy_ship_5_start_shooting(enemy enemyship, frontborder border) |
---|
1624 | { |
---|
1625 | if (!enemyship.canShoot) |
---|
1626 | { |
---|
1627 | enemyship.canShoot = true; |
---|
1628 | enemyship.LifetimeLeft = TimeSpan.FromSeconds(8.4); |
---|
1629 | enemyship.Velocity = enemyship.Velocity / 3; |
---|
1630 | |
---|
1631 | UnlimitedAngle angle = UnlimitedAngle.FromDegrees(0); |
---|
1632 | UnlimitedAngle angle2 = UnlimitedAngle.FromDegrees(90); |
---|
1633 | UnlimitedAngle angle3 = UnlimitedAngle.FromDegrees(180); |
---|
1634 | UnlimitedAngle angle4 = UnlimitedAngle.FromDegrees(270); |
---|
1635 | double i = 0; |
---|
1636 | |
---|
1637 | Timer shoot = new Timer(); |
---|
1638 | shoot.Interval = 0.06; |
---|
1639 | shoot.Timeout += delegate |
---|
1640 | { |
---|
1641 | if (!enemyship.IsDestroyed) |
---|
1642 | { |
---|
1643 | i = i + 12; |
---|
1644 | angle = UnlimitedAngle.FromDegrees(i); |
---|
1645 | angle2 = UnlimitedAngle.FromDegrees(i + 90); |
---|
1646 | angle3 = UnlimitedAngle.FromDegrees(i + 180); |
---|
1647 | angle4 = UnlimitedAngle.FromDegrees(i + 270); |
---|
1648 | |
---|
1649 | enemy_shoot_3(enemyship.Position, angle.GetVector() * 500); |
---|
1650 | enemy_shoot_3(enemyship.Position, angle2.GetVector() * 500); |
---|
1651 | enemy_shoot_3(enemyship.Position, angle3.GetVector() * 500); |
---|
1652 | enemy_shoot_3(enemyship.Position, angle4.GetVector() * 500); |
---|
1653 | |
---|
1654 | enemy_shootsfx.Play(); |
---|
1655 | } |
---|
1656 | else shoot.Stop(); |
---|
1657 | }; |
---|
1658 | |
---|
1659 | Timer wait = new Timer(); |
---|
1660 | wait.Interval = 1; |
---|
1661 | wait.Timeout += delegate |
---|
1662 | { |
---|
1663 | if (!enemyship.IsDestroyed) |
---|
1664 | { |
---|
1665 | shoot.Start(); |
---|
1666 | } |
---|
1667 | else shoot.Stop(); |
---|
1668 | }; |
---|
1669 | |
---|
1670 | wait.Start(1); |
---|
1671 | } |
---|
1672 | } |
---|
1673 | void enemy_ship_6(Vector pos, double width, double height) |
---|
1674 | { |
---|
1675 | enemy enemyship = new enemy(82, 57); |
---|
1676 | enemyship.Shape = Shape.Circle; |
---|
1677 | enemyship.Position = pos; |
---|
1678 | enemyship.IgnoresCollisionResponse = true; |
---|
1679 | enemyship.CollisionIgnoreGroup = 3; |
---|
1680 | enemyship.health.MaxValue = 70; |
---|
1681 | enemyship.Image = enemy_ship_06; |
---|
1682 | enemyship.explosion_scale = 70; |
---|
1683 | |
---|
1684 | Add(enemyship, -1); |
---|
1685 | enemyship.Hit(stagespeed); |
---|
1686 | |
---|
1687 | |
---|
1688 | |
---|
1689 | |
---|
1690 | AddCollisionHandler<enemy, frontborder>(enemyship, enemy_ship_6_start_shooting); |
---|
1691 | AddCollisionHandler<enemy, player>(enemyship, damagePlayerEnemyShip2); |
---|
1692 | } |
---|
1693 | void enemy_ship_6_start_shooting(enemy enemyship, frontborder border) |
---|
1694 | { |
---|
1695 | if (!enemyship.canShoot) |
---|
1696 | { |
---|
1697 | enemyship.canShoot = true; |
---|
1698 | enemyship.LifetimeLeft = TimeSpan.FromSeconds(8.4); |
---|
1699 | enemyship.Velocity = enemyship.Velocity / 3; |
---|
1700 | |
---|
1701 | UnlimitedAngle angle = UnlimitedAngle.FromDegrees(0); |
---|
1702 | UnlimitedAngle angle2 = UnlimitedAngle.FromDegrees(0); |
---|
1703 | UnlimitedAngle angle3 = UnlimitedAngle.FromDegrees(0); |
---|
1704 | UnlimitedAngle angle4 = UnlimitedAngle.FromDegrees(0); |
---|
1705 | double i = 0; |
---|
1706 | double c = 0; |
---|
1707 | |
---|
1708 | Timer wait = new Timer(); |
---|
1709 | Timer shoot = new Timer(); |
---|
1710 | shoot.Interval = 0.1; |
---|
1711 | shoot.Timeout += delegate |
---|
1712 | { |
---|
1713 | if (!enemyship.IsDestroyed) |
---|
1714 | { |
---|
1715 | c++; |
---|
1716 | if (c >= 18) |
---|
1717 | { |
---|
1718 | c = 0; |
---|
1719 | shoot.Stop(); |
---|
1720 | wait.Start(1); |
---|
1721 | } |
---|
1722 | |
---|
1723 | i = i + 20; |
---|
1724 | angle = UnlimitedAngle.FromDegrees(i); |
---|
1725 | angle2 = UnlimitedAngle.FromDegrees(i + 90); |
---|
1726 | angle3 = UnlimitedAngle.FromDegrees(i + 180); |
---|
1727 | angle4 = UnlimitedAngle.FromDegrees(i + 270); |
---|
1728 | |
---|
1729 | enemy_shoot_4(enemyship.Position, (angle + UnlimitedAngle.FromDegrees(0)).GetVector() * 460); |
---|
1730 | enemy_shoot_4(enemyship.Position, (angle + UnlimitedAngle.FromDegrees(7)).GetVector() * 480); |
---|
1731 | enemy_shoot_4(enemyship.Position, (angle + UnlimitedAngle.FromDegrees(14)).GetVector() * 500); |
---|
1732 | |
---|
1733 | enemy_shoot_4(enemyship.Position, (angle2 + UnlimitedAngle.FromDegrees(0)).GetVector() * 460); |
---|
1734 | enemy_shoot_4(enemyship.Position, (angle2 + UnlimitedAngle.FromDegrees(7)).GetVector() * 480); |
---|
1735 | enemy_shoot_4(enemyship.Position, (angle2 + UnlimitedAngle.FromDegrees(14)).GetVector() * 500); |
---|
1736 | |
---|
1737 | enemy_shoot_4(enemyship.Position, (angle3 + UnlimitedAngle.FromDegrees(0)).GetVector() * 460); |
---|
1738 | enemy_shoot_4(enemyship.Position, (angle3 + UnlimitedAngle.FromDegrees(7)).GetVector() * 480); |
---|
1739 | enemy_shoot_4(enemyship.Position, (angle3 + UnlimitedAngle.FromDegrees(14)).GetVector() * 500); |
---|
1740 | |
---|
1741 | enemy_shoot_4(enemyship.Position, (angle4 + UnlimitedAngle.FromDegrees(0)).GetVector() * 460); |
---|
1742 | enemy_shoot_4(enemyship.Position, (angle4 + UnlimitedAngle.FromDegrees(7)).GetVector() * 480); |
---|
1743 | enemy_shoot_4(enemyship.Position, (angle4 + UnlimitedAngle.FromDegrees(14)).GetVector() * 500); |
---|
1744 | |
---|
1745 | |
---|
1746 | enemy_shootsfx.Play(); |
---|
1747 | } |
---|
1748 | else shoot.Stop(); |
---|
1749 | }; |
---|
1750 | |
---|
1751 | wait.Interval = 1.5; |
---|
1752 | wait.Timeout += delegate |
---|
1753 | { |
---|
1754 | if (enemyship.IsDestroyed) wait.Stop(); |
---|
1755 | shoot.Start(); |
---|
1756 | }; |
---|
1757 | |
---|
1758 | Timer start = new Timer(); |
---|
1759 | start.Interval = 1; |
---|
1760 | start.Timeout += delegate |
---|
1761 | { |
---|
1762 | if (!enemyship.IsDestroyed) |
---|
1763 | { |
---|
1764 | shoot.Start(); |
---|
1765 | } |
---|
1766 | else shoot.Stop(); |
---|
1767 | }; |
---|
1768 | |
---|
1769 | start.Start(1); |
---|
1770 | } |
---|
1771 | } |
---|
1772 | |
---|
1773 | void enemy_shoot_1(Vector pos) |
---|
1774 | { |
---|
1775 | bullet enemy_bullet = new bullet(27, 27); |
---|
1776 | enemy_bullet.Shape = Shape.Circle; |
---|
1777 | enemy_bullet.Position = pos; |
---|
1778 | enemy_bullet.IgnoresCollisionResponse = true; |
---|
1779 | enemy_bullet.IgnoresGravity = true; |
---|
1780 | enemy_bullet.CollisionIgnoreGroup = 2; |
---|
1781 | enemy_bullet.Image = bullet_enemy_05; |
---|
1782 | |
---|
1783 | enemy_bullet.Hit((player.Position - enemy_bullet.Position).Normalize() * 300); |
---|
1784 | Add(enemy_bullet, 0); |
---|
1785 | AddCollisionHandler<bullet, player>(enemy_bullet, damagePlayerBullet); |
---|
1786 | AddCollisionHandler<bullet, bulletdes>(enemy_bullet, destroy); |
---|
1787 | } |
---|
1788 | void enemy_shoot_2(Vector pos, Vector dir) |
---|
1789 | { |
---|
1790 | bullet enemy_bullet = new bullet(27, 27); |
---|
1791 | enemy_bullet.Shape = Shape.Circle; |
---|
1792 | enemy_bullet.Position = pos; |
---|
1793 | enemy_bullet.IgnoresCollisionResponse = true; |
---|
1794 | enemy_bullet.IgnoresGravity = true; |
---|
1795 | enemy_bullet.CollisionIgnoreGroup = 2; |
---|
1796 | enemy_bullet.Image = bullet_enemy_02; |
---|
1797 | |
---|
1798 | Add(enemy_bullet, 0); |
---|
1799 | enemy_bullet.Hit(dir/9); |
---|
1800 | AddCollisionHandler<bullet, player>(enemy_bullet, damagePlayerBullet); |
---|
1801 | AddCollisionHandler<bullet, bulletdes>(enemy_bullet, destroy); |
---|
1802 | |
---|
1803 | Timer wait = new Timer(); |
---|
1804 | wait.Interval = 0.8; |
---|
1805 | wait.Timeout += delegate |
---|
1806 | { |
---|
1807 | enemy_bullet.Velocity = dir; |
---|
1808 | }; |
---|
1809 | wait.Start(1); |
---|
1810 | } |
---|
1811 | void enemy_shoot_3(Vector pos, Vector dir) |
---|
1812 | { |
---|
1813 | bullet enemy_bullet = new bullet(27, 27); |
---|
1814 | enemy_bullet.Shape = Shape.Circle; |
---|
1815 | enemy_bullet.Position = pos; |
---|
1816 | enemy_bullet.IgnoresCollisionResponse = true; |
---|
1817 | enemy_bullet.IgnoresGravity = true; |
---|
1818 | enemy_bullet.CollisionIgnoreGroup = 2; |
---|
1819 | enemy_bullet.Image = bullet_enemy_01; |
---|
1820 | |
---|
1821 | Add(enemy_bullet, 0); |
---|
1822 | enemy_bullet.Hit(dir); |
---|
1823 | AddCollisionHandler<bullet, player>(enemy_bullet, damagePlayerBullet); |
---|
1824 | AddCollisionHandler<bullet, bulletdes>(enemy_bullet, destroy); |
---|
1825 | |
---|
1826 | } |
---|
1827 | void enemy_shoot_4(Vector pos, Vector dir) |
---|
1828 | { |
---|
1829 | bullet enemy_bullet = new bullet(15, 35); |
---|
1830 | |
---|
1831 | Add(enemy_bullet, 0); |
---|
1832 | enemy_bullet.Shape = Shape.Circle; |
---|
1833 | enemy_bullet.Position = pos; |
---|
1834 | enemy_bullet.IgnoresCollisionResponse = true; |
---|
1835 | enemy_bullet.IgnoresGravity = true; |
---|
1836 | enemy_bullet.CollisionIgnoreGroup = 2; |
---|
1837 | enemy_bullet.Image = bullet_enemy_07; |
---|
1838 | enemy_bullet.Hit(dir); |
---|
1839 | |
---|
1840 | enemy_bullet.Angle = enemy_bullet.Velocity.Angle + Angle.FromDegrees(45); |
---|
1841 | AddCollisionHandler<bullet, player>(enemy_bullet, damagePlayerBullet); |
---|
1842 | AddCollisionHandler<bullet, bulletdes>(enemy_bullet, destroy); |
---|
1843 | |
---|
1844 | } |
---|
1845 | |
---|
1846 | #endregion |
---|
1847 | |
---|
1848 | #region Bosses |
---|
1849 | |
---|
1850 | void boss_ship_1(Vector pos, double width, double height) |
---|
1851 | { |
---|
1852 | boss boss_ship = new boss(196, 124); |
---|
1853 | boss_ship.Shape = Shape.Circle; |
---|
1854 | boss_ship.Position = pos; |
---|
1855 | boss_ship.IgnoresCollisionResponse = true; |
---|
1856 | boss_ship.CollisionIgnoreGroup = 3; |
---|
1857 | boss_ship.Image = boss_ship_01; |
---|
1858 | |
---|
1859 | Add(boss_ship, -1); |
---|
1860 | boss_ship.Hit(stagespeed); |
---|
1861 | AddCollisionHandler<boss, frontborder>(boss_ship, boss_01_start); |
---|
1862 | AddCollisionHandler<boss, player>(boss_ship, damagePlayerBossShip); |
---|
1863 | } |
---|
1864 | void boss_01_start(boss boss, frontborder border) |
---|
1865 | { |
---|
1866 | if (!boss.canShoot) |
---|
1867 | { |
---|
1868 | boss.canShoot = true; |
---|
1869 | boss.Velocity = boss.Velocity / 8; |
---|
1870 | |
---|
1871 | Timer wait = new Timer(); |
---|
1872 | wait.Interval = 5; |
---|
1873 | wait.Timeout += delegate |
---|
1874 | { |
---|
1875 | MediaPlayer.Play("Andross"); |
---|
1876 | AddCollisionHandler<boss, bullet>(boss, damageBoss); |
---|
1877 | MediaPlayer.Volume = 1; |
---|
1878 | boss.Velocity = new Vector(0, 0); |
---|
1879 | boss.health.Value = boss.health.MaxValue; |
---|
1880 | boss_01_start_shooting(boss); |
---|
1881 | }; |
---|
1882 | wait.Start(1); |
---|
1883 | |
---|
1884 | Timer fade_volume = new Timer(); |
---|
1885 | fade_volume.Interval = 0.2; |
---|
1886 | fade_volume.Timeout += delegate |
---|
1887 | { |
---|
1888 | MediaPlayer.Volume = MediaPlayer.Volume - 0.1; |
---|
1889 | if (MediaPlayer.Volume == 0) |
---|
1890 | { |
---|
1891 | fade_volume.Stop(); |
---|
1892 | } |
---|
1893 | }; |
---|
1894 | fade_volume.Start(); |
---|
1895 | |
---|
1896 | } |
---|
1897 | } |
---|
1898 | void boss_01_start_shooting(boss boss) |
---|
1899 | { |
---|
1900 | int i = 0; |
---|
1901 | |
---|
1902 | double angle5 = 0; |
---|
1903 | double c = 1; |
---|
1904 | UnlimitedAngle angle05; |
---|
1905 | |
---|
1906 | Timer shoot2 = new Timer(); |
---|
1907 | shoot2.Interval = 0.01; |
---|
1908 | shoot2.Timeout += delegate |
---|
1909 | { |
---|
1910 | if (!boss.IsDestroyed) |
---|
1911 | { |
---|
1912 | angle5 = angle5 + c; |
---|
1913 | c = c + 0.1; |
---|
1914 | angle05 = UnlimitedAngle.FromDegrees(angle5); |
---|
1915 | boss_shoot_2(boss.Position, |
---|
1916 | |
---|
1917 | angle05.GetVector() * 500 |
---|
1918 | ); |
---|
1919 | } |
---|
1920 | else |
---|
1921 | { |
---|
1922 | shoot2.Stop(); |
---|
1923 | } |
---|
1924 | }; |
---|
1925 | Timer wait = new Timer(); |
---|
1926 | |
---|
1927 | Timer enemy_shoot1 = new Timer(); |
---|
1928 | enemy_shoot1.Interval = 0.02; |
---|
1929 | enemy_shoot1.Timeout += delegate |
---|
1930 | { |
---|
1931 | i++; |
---|
1932 | if (i == 100) |
---|
1933 | { |
---|
1934 | enemy_shoot1.Stop(); |
---|
1935 | shoot2.Start(); |
---|
1936 | wait.Start(1); |
---|
1937 | }; |
---|
1938 | if (boss.IsDestroyed) |
---|
1939 | { |
---|
1940 | enemy_shoot1.Stop(); |
---|
1941 | } |
---|
1942 | boss_shoot_1(boss.Position + new Vector(RandomGen.NextDouble(-50, 50), RandomGen.NextDouble(-50, 50))); |
---|
1943 | }; |
---|
1944 | |
---|
1945 | UnlimitedAngle angle = UnlimitedAngle.FromDegrees(0); |
---|
1946 | UnlimitedAngle angle2 = UnlimitedAngle.FromDegrees(90); |
---|
1947 | UnlimitedAngle angle3 = UnlimitedAngle.FromDegrees(180); |
---|
1948 | UnlimitedAngle angle4 = UnlimitedAngle.FromDegrees(270); |
---|
1949 | double b = 0; |
---|
1950 | |
---|
1951 | Timer shoot = new Timer(); |
---|
1952 | shoot.Interval = 0.08; |
---|
1953 | shoot.Timeout += delegate |
---|
1954 | { |
---|
1955 | if (!boss.IsDestroyed) |
---|
1956 | { |
---|
1957 | b = b + 12; |
---|
1958 | angle = UnlimitedAngle.FromDegrees(b); |
---|
1959 | angle2 = UnlimitedAngle.FromDegrees(b + 90); |
---|
1960 | angle3 = UnlimitedAngle.FromDegrees(b + 180); |
---|
1961 | angle4 = UnlimitedAngle.FromDegrees(b + 270); |
---|
1962 | |
---|
1963 | boss_shoot_3(boss.Position, angle.GetVector() * 400); |
---|
1964 | boss_shoot_3(boss.Position, angle2.GetVector() * 400); |
---|
1965 | boss_shoot_3(boss.Position, angle3.GetVector() * 400); |
---|
1966 | boss_shoot_3(boss.Position, angle4.GetVector() * 400); |
---|
1967 | |
---|
1968 | enemy_shootsfx.Play(); |
---|
1969 | } |
---|
1970 | else shoot.Stop(); |
---|
1971 | }; |
---|
1972 | |
---|
1973 | wait.Interval = 0.5; |
---|
1974 | wait.Timeout += delegate |
---|
1975 | { |
---|
1976 | if (boss.IsDestroyed) wait.Stop(); |
---|
1977 | i = 0; |
---|
1978 | enemy_shoot1.Start(100); |
---|
1979 | shoot2.Stop(); |
---|
1980 | }; |
---|
1981 | |
---|
1982 | enemy_shoot1.Start(); |
---|
1983 | shoot.Start(); |
---|
1984 | } |
---|
1985 | |
---|
1986 | void boss_shoot_1(Vector pos) |
---|
1987 | { |
---|
1988 | bullet enemy_bullet = new bullet(27, 27); |
---|
1989 | enemy_bullet.Shape = Shape.Circle; |
---|
1990 | enemy_bullet.Position = pos; |
---|
1991 | enemy_bullet.IgnoresCollisionResponse = true; |
---|
1992 | enemy_bullet.IgnoresGravity = true; |
---|
1993 | enemy_bullet.CollisionIgnoreGroup = 2; |
---|
1994 | enemy_bullet.Image = bullet_enemy_06; |
---|
1995 | |
---|
1996 | enemy_bullet.Hit((player.Position - enemy_bullet.Position).Normalize() * 300); |
---|
1997 | Add(enemy_bullet, 0); |
---|
1998 | AddCollisionHandler<bullet, player>(enemy_bullet, damagePlayerBullet); |
---|
1999 | AddCollisionHandler<bullet, bulletdes>(enemy_bullet, destroy); |
---|
2000 | } |
---|
2001 | void boss_shoot_2(Vector pos, Vector dir) |
---|
2002 | { |
---|
2003 | bullet enemy_bullet = new bullet(27, 27); |
---|
2004 | enemy_bullet.Shape = Shape.Circle; |
---|
2005 | enemy_bullet.Position = pos; |
---|
2006 | enemy_bullet.IgnoresCollisionResponse = true; |
---|
2007 | enemy_bullet.IgnoresGravity = true; |
---|
2008 | enemy_bullet.CollisionIgnoreGroup = 2; |
---|
2009 | enemy_bullet.Image = bullet_enemy_06; |
---|
2010 | |
---|
2011 | Add(enemy_bullet, 0); |
---|
2012 | enemy_bullet.Hit(dir / 9); |
---|
2013 | AddCollisionHandler<bullet, player>(enemy_bullet, damagePlayerBullet); |
---|
2014 | AddCollisionHandler<bullet, bulletdes>(enemy_bullet, destroy); |
---|
2015 | |
---|
2016 | Timer wait = new Timer(); |
---|
2017 | wait.Interval = 0.8; |
---|
2018 | wait.Timeout += delegate |
---|
2019 | { |
---|
2020 | enemy_bullet.Velocity = dir; |
---|
2021 | }; |
---|
2022 | wait.Start(1); |
---|
2023 | } |
---|
2024 | void boss_shoot_3(Vector pos, Vector dir) |
---|
2025 | { |
---|
2026 | bullet enemy_bullet = new bullet(27, 27); |
---|
2027 | enemy_bullet.Shape = Shape.Circle; |
---|
2028 | enemy_bullet.Position = pos; |
---|
2029 | enemy_bullet.IgnoresCollisionResponse = true; |
---|
2030 | enemy_bullet.IgnoresGravity = true; |
---|
2031 | enemy_bullet.CollisionIgnoreGroup = 2; |
---|
2032 | enemy_bullet.Image = bullet_enemy_06; |
---|
2033 | |
---|
2034 | Add(enemy_bullet, 0); |
---|
2035 | enemy_bullet.Hit(dir); |
---|
2036 | AddCollisionHandler<bullet, player>(enemy_bullet, damagePlayerBullet); |
---|
2037 | AddCollisionHandler<bullet, bulletdes>(enemy_bullet, destroy); |
---|
2038 | |
---|
2039 | } |
---|
2040 | |
---|
2041 | |
---|
2042 | void boss_ship_2(Vector pos, double width, double height) |
---|
2043 | { |
---|
2044 | boss boss_ship = new boss(244, 256); |
---|
2045 | boss_ship.health.MaxValue = 15000; |
---|
2046 | boss_ship.health.Value = 15000; |
---|
2047 | boss_ship.Shape = Shape.FromImage(boss_ship_02); |
---|
2048 | boss_ship.Position = pos; |
---|
2049 | boss_ship.IgnoresCollisionResponse = true; |
---|
2050 | boss_ship.CollisionIgnoreGroup = 3; |
---|
2051 | boss_ship.Image = boss_ship_02; |
---|
2052 | |
---|
2053 | Add(boss_ship, -1); |
---|
2054 | boss_ship.Hit(stagespeed); |
---|
2055 | AddCollisionHandler<boss, frontborder>(boss_ship, boss_02_start); |
---|
2056 | AddCollisionHandler<boss, player>(boss_ship, damagePlayerBossShip); |
---|
2057 | } |
---|
2058 | void boss_02_start(boss boss, frontborder border) |
---|
2059 | { |
---|
2060 | if (!boss.canShoot) |
---|
2061 | { |
---|
2062 | boss.canShoot = true; |
---|
2063 | boss.Velocity = boss.Velocity / 8; |
---|
2064 | |
---|
2065 | Timer wait = new Timer(); |
---|
2066 | wait.Interval = 5; |
---|
2067 | wait.Timeout += delegate |
---|
2068 | { |
---|
2069 | MediaPlayer.Play("Andross"); |
---|
2070 | AddCollisionHandler<boss, bullet>(boss, damageBoss); |
---|
2071 | MediaPlayer.Volume = 1; |
---|
2072 | boss.Velocity = new Vector(0, 0); |
---|
2073 | boss.Oscillate(Vector.UnitY, 125, 0.2); |
---|
2074 | |
---|
2075 | boss_02_start_shooting(boss); |
---|
2076 | }; |
---|
2077 | wait.Start(1); |
---|
2078 | |
---|
2079 | Timer fade_volume = new Timer(); |
---|
2080 | fade_volume.Interval = 0.2; |
---|
2081 | fade_volume.Timeout += delegate |
---|
2082 | { |
---|
2083 | MediaPlayer.Volume = MediaPlayer.Volume - 0.1; |
---|
2084 | if (MediaPlayer.Volume == 0) |
---|
2085 | { |
---|
2086 | fade_volume.Stop(); |
---|
2087 | } |
---|
2088 | }; |
---|
2089 | fade_volume.Start(); |
---|
2090 | |
---|
2091 | } |
---|
2092 | } |
---|
2093 | void boss_02_start_shooting(boss boss) |
---|
2094 | { |
---|
2095 | UnlimitedAngle angle = UnlimitedAngle.FromDegrees(0); |
---|
2096 | UnlimitedAngle angle2 = UnlimitedAngle.FromDegrees(0); |
---|
2097 | UnlimitedAngle angle3 = UnlimitedAngle.FromDegrees(0); |
---|
2098 | UnlimitedAngle angle4 = UnlimitedAngle.FromDegrees(0); |
---|
2099 | double i = 0; |
---|
2100 | double c = 0; |
---|
2101 | double d = 0; |
---|
2102 | double f = 0; |
---|
2103 | |
---|
2104 | Timer wait = new Timer(); |
---|
2105 | Timer shoot = new Timer(); |
---|
2106 | Timer shoot2 = new Timer(); |
---|
2107 | Timer shoot3 = new Timer(); |
---|
2108 | Timer shoot4 = new Timer(); |
---|
2109 | shoot.Interval = 0.05; |
---|
2110 | shoot.Timeout += delegate |
---|
2111 | { |
---|
2112 | if (boss.IsDestroyed) |
---|
2113 | { |
---|
2114 | wait.Stop(); |
---|
2115 | shoot.Stop(); |
---|
2116 | shoot2.Stop(); |
---|
2117 | shoot3.Stop(); |
---|
2118 | shoot4.Stop(); |
---|
2119 | } |
---|
2120 | if (!boss.IsDestroyed) |
---|
2121 | { |
---|
2122 | c++; |
---|
2123 | if (c >= 36) |
---|
2124 | { |
---|
2125 | f++; |
---|
2126 | d = 1; |
---|
2127 | c = 0; |
---|
2128 | shoot.Stop(); |
---|
2129 | wait.Start(1); |
---|
2130 | } |
---|
2131 | |
---|
2132 | i = i + 10; |
---|
2133 | angle = UnlimitedAngle.FromDegrees(i); |
---|
2134 | angle2 = UnlimitedAngle.FromDegrees(i + 90); |
---|
2135 | angle3 = UnlimitedAngle.FromDegrees(i + 180); |
---|
2136 | angle4 = UnlimitedAngle.FromDegrees(i + 270); |
---|
2137 | |
---|
2138 | boss2_shoot_1(boss.Position, (angle + UnlimitedAngle.FromDegrees(0)).GetVector() * 460); |
---|
2139 | boss2_shoot_1(boss.Position, (angle + UnlimitedAngle.FromDegrees(7)).GetVector() * 480); |
---|
2140 | boss2_shoot_1(boss.Position, (angle + UnlimitedAngle.FromDegrees(14)).GetVector() * 500); |
---|
2141 | |
---|
2142 | boss2_shoot_1(boss.Position, (angle2 + UnlimitedAngle.FromDegrees(0)).GetVector() * 460); |
---|
2143 | boss2_shoot_1(boss.Position, (angle2 + UnlimitedAngle.FromDegrees(7)).GetVector() * 480); |
---|
2144 | boss2_shoot_1(boss.Position, (angle2 + UnlimitedAngle.FromDegrees(14)).GetVector() * 500); |
---|
2145 | |
---|
2146 | boss2_shoot_1(boss.Position, (angle3 + UnlimitedAngle.FromDegrees(0)).GetVector() * 460); |
---|
2147 | boss2_shoot_1(boss.Position, (angle3 + UnlimitedAngle.FromDegrees(7)).GetVector() * 480); |
---|
2148 | boss2_shoot_1(boss.Position, (angle3 + UnlimitedAngle.FromDegrees(14)).GetVector() * 500); |
---|
2149 | |
---|
2150 | boss2_shoot_1(boss.Position, (angle4 + UnlimitedAngle.FromDegrees(0)).GetVector() * 460); |
---|
2151 | boss2_shoot_1(boss.Position, (angle4 + UnlimitedAngle.FromDegrees(7)).GetVector() * 480); |
---|
2152 | boss2_shoot_1(boss.Position, (angle4 + UnlimitedAngle.FromDegrees(14)).GetVector() * 500); |
---|
2153 | |
---|
2154 | |
---|
2155 | enemy_shootsfx.Play(); |
---|
2156 | } |
---|
2157 | else shoot.Stop(); |
---|
2158 | }; |
---|
2159 | |
---|
2160 | |
---|
2161 | UnlimitedAngle angleb = UnlimitedAngle.FromDegrees(0); |
---|
2162 | UnlimitedAngle angle2b = UnlimitedAngle.FromDegrees(0); |
---|
2163 | UnlimitedAngle angle3b = UnlimitedAngle.FromDegrees(0); |
---|
2164 | UnlimitedAngle angle4b = UnlimitedAngle.FromDegrees(0); |
---|
2165 | double ib = 0; |
---|
2166 | |
---|
2167 | |
---|
2168 | |
---|
2169 | shoot2.Interval = 0.05; |
---|
2170 | shoot2.Timeout += delegate |
---|
2171 | { |
---|
2172 | if (!boss.IsDestroyed) |
---|
2173 | { |
---|
2174 | if (boss.IsDestroyed) |
---|
2175 | { |
---|
2176 | wait.Stop(); |
---|
2177 | shoot.Stop(); |
---|
2178 | shoot2.Stop(); |
---|
2179 | shoot3.Stop(); |
---|
2180 | shoot4.Stop(); |
---|
2181 | } |
---|
2182 | c++; |
---|
2183 | if (c >= 36) |
---|
2184 | { |
---|
2185 | f++; |
---|
2186 | d = 0; |
---|
2187 | c = 0; |
---|
2188 | shoot2.Stop(); |
---|
2189 | wait.Start(1); |
---|
2190 | } |
---|
2191 | |
---|
2192 | ib = ib - 10; |
---|
2193 | angleb = UnlimitedAngle.FromDegrees(ib); |
---|
2194 | angle2b = UnlimitedAngle.FromDegrees(ib - 90); |
---|
2195 | angle3b = UnlimitedAngle.FromDegrees(ib - 180); |
---|
2196 | angle4b = UnlimitedAngle.FromDegrees(ib - 270); |
---|
2197 | |
---|
2198 | boss2_shoot_2(boss.Position, (angleb + UnlimitedAngle.FromDegrees(0)).GetVector() * 460); |
---|
2199 | boss2_shoot_2(boss.Position, (angleb + UnlimitedAngle.FromDegrees(-7)).GetVector() * 480); |
---|
2200 | boss2_shoot_2(boss.Position, (angleb + UnlimitedAngle.FromDegrees(-14)).GetVector() * 500); |
---|
2201 | |
---|
2202 | boss2_shoot_2(boss.Position, (angle2b + UnlimitedAngle.FromDegrees(0)).GetVector() * 460); |
---|
2203 | boss2_shoot_2(boss.Position, (angle2b + UnlimitedAngle.FromDegrees(-7)).GetVector() * 480); |
---|
2204 | boss2_shoot_2(boss.Position, (angle2b + UnlimitedAngle.FromDegrees(-14)).GetVector() * 500); |
---|
2205 | |
---|
2206 | boss2_shoot_2(boss.Position, (angle3b + UnlimitedAngle.FromDegrees(0)).GetVector() * 460); |
---|
2207 | boss2_shoot_2(boss.Position, (angle3b + UnlimitedAngle.FromDegrees(-7)).GetVector() * 480); |
---|
2208 | boss2_shoot_2(boss.Position, (angle3b + UnlimitedAngle.FromDegrees(-14)).GetVector() * 500); |
---|
2209 | |
---|
2210 | boss2_shoot_2(boss.Position, (angle4b + UnlimitedAngle.FromDegrees(0)).GetVector() * 460); |
---|
2211 | boss2_shoot_2(boss.Position, (angle4b + UnlimitedAngle.FromDegrees(-7)).GetVector() * 480); |
---|
2212 | boss2_shoot_2(boss.Position, (angle4b + UnlimitedAngle.FromDegrees(-14)).GetVector() * 500); |
---|
2213 | |
---|
2214 | |
---|
2215 | enemy_shootsfx.Play(); |
---|
2216 | } |
---|
2217 | else shoot.Stop(); |
---|
2218 | }; |
---|
2219 | |
---|
2220 | shoot3.Interval = 0.05; |
---|
2221 | shoot3.Timeout += delegate |
---|
2222 | { |
---|
2223 | if (boss.IsDestroyed) |
---|
2224 | { |
---|
2225 | wait.Stop(); |
---|
2226 | shoot.Stop(); |
---|
2227 | shoot2.Stop(); |
---|
2228 | shoot3.Stop(); |
---|
2229 | shoot4.Stop(); |
---|
2230 | } |
---|
2231 | if (!boss.IsDestroyed) |
---|
2232 | { |
---|
2233 | c++; |
---|
2234 | if (c >= 36) |
---|
2235 | { |
---|
2236 | c = 0; |
---|
2237 | shoot3.Stop(); |
---|
2238 | wait.Start(1); |
---|
2239 | } |
---|
2240 | |
---|
2241 | ib = ib - 10; |
---|
2242 | angleb = UnlimitedAngle.FromDegrees(ib); |
---|
2243 | angle2b = UnlimitedAngle.FromDegrees(ib - 90); |
---|
2244 | angle3b = UnlimitedAngle.FromDegrees(ib - 180); |
---|
2245 | angle4b = UnlimitedAngle.FromDegrees(ib - 270); |
---|
2246 | |
---|
2247 | boss2_shoot_2(boss.Position, (angle2b + UnlimitedAngle.FromDegrees(0)).GetVector() * 460); |
---|
2248 | boss2_shoot_2(boss.Position, (angle2b + UnlimitedAngle.FromDegrees(-7)).GetVector() * 480); |
---|
2249 | boss2_shoot_2(boss.Position, (angle2b + UnlimitedAngle.FromDegrees(-14)).GetVector() * 500); |
---|
2250 | |
---|
2251 | boss2_shoot_2(boss.Position, (angle4b + UnlimitedAngle.FromDegrees(0)).GetVector() * 460); |
---|
2252 | boss2_shoot_2(boss.Position, (angle4b + UnlimitedAngle.FromDegrees(-7)).GetVector() * 480); |
---|
2253 | boss2_shoot_2(boss.Position, (angle4b + UnlimitedAngle.FromDegrees(-14)).GetVector() * 500); |
---|
2254 | |
---|
2255 | i = i + 10; |
---|
2256 | angle = UnlimitedAngle.FromDegrees(i); |
---|
2257 | angle2 = UnlimitedAngle.FromDegrees(i + 90); |
---|
2258 | angle3 = UnlimitedAngle.FromDegrees(i + 180); |
---|
2259 | angle4 = UnlimitedAngle.FromDegrees(i + 270); |
---|
2260 | |
---|
2261 | boss2_shoot_1(boss.Position, (angle2 + UnlimitedAngle.FromDegrees(0)).GetVector() * 500); |
---|
2262 | boss2_shoot_1(boss.Position, (angle2 + UnlimitedAngle.FromDegrees(7)).GetVector() * 520); |
---|
2263 | boss2_shoot_1(boss.Position, (angle2 + UnlimitedAngle.FromDegrees(14)).GetVector() * 540); |
---|
2264 | |
---|
2265 | boss2_shoot_1(boss.Position, (angle4 + UnlimitedAngle.FromDegrees(0)).GetVector() * 500); |
---|
2266 | boss2_shoot_1(boss.Position, (angle4 + UnlimitedAngle.FromDegrees(7)).GetVector() * 520); |
---|
2267 | boss2_shoot_1(boss.Position, (angle4 + UnlimitedAngle.FromDegrees(14)).GetVector() * 540); |
---|
2268 | |
---|
2269 | |
---|
2270 | enemy_shootsfx.Play(); |
---|
2271 | } |
---|
2272 | else shoot.Stop(); |
---|
2273 | }; |
---|
2274 | |
---|
2275 | double ic = 0; |
---|
2276 | double jc = 0; |
---|
2277 | double cb = 0; |
---|
2278 | |
---|
2279 | UnlimitedAngle anglec = UnlimitedAngle.FromDegrees(0); |
---|
2280 | UnlimitedAngle anglec2 = UnlimitedAngle.FromDegrees(0); |
---|
2281 | |
---|
2282 | shoot4.Interval = 0.05; |
---|
2283 | shoot4.Timeout += delegate |
---|
2284 | { |
---|
2285 | if (boss.IsDestroyed) |
---|
2286 | { |
---|
2287 | wait.Stop(); |
---|
2288 | shoot.Stop(); |
---|
2289 | shoot2.Stop(); |
---|
2290 | shoot3.Stop(); |
---|
2291 | shoot4.Stop(); |
---|
2292 | } |
---|
2293 | cb++; |
---|
2294 | if (cb >= 36) |
---|
2295 | { |
---|
2296 | ic = 0; |
---|
2297 | cb = 0; |
---|
2298 | shoot4.Stop(); |
---|
2299 | wait.Start(1); |
---|
2300 | } |
---|
2301 | |
---|
2302 | ic = ic + 10; |
---|
2303 | jc = jc - 10; |
---|
2304 | anglec = UnlimitedAngle.FromDegrees(ic); |
---|
2305 | anglec2 = UnlimitedAngle.FromDegrees(jc); |
---|
2306 | |
---|
2307 | boss2_shoot_3(boss.Position, anglec.GetVector() * 500); |
---|
2308 | boss2_shoot_3(boss.Position, (anglec + UnlimitedAngle.FromDegrees(90)).GetVector() * 480); |
---|
2309 | boss2_shoot_3(boss.Position, (anglec + UnlimitedAngle.FromDegrees(180)).GetVector() * 480); |
---|
2310 | boss2_shoot_3(boss.Position, (anglec + UnlimitedAngle.FromDegrees(270)).GetVector() * 480); |
---|
2311 | |
---|
2312 | boss2_shoot_3(boss.Position, anglec2.GetVector() * 500); |
---|
2313 | boss2_shoot_3(boss.Position, (anglec2 + UnlimitedAngle.FromDegrees(90)).GetVector() * 520); |
---|
2314 | boss2_shoot_3(boss.Position, (anglec2 + UnlimitedAngle.FromDegrees(180)).GetVector() * 520); |
---|
2315 | boss2_shoot_3(boss.Position, (anglec2 + UnlimitedAngle.FromDegrees(270)).GetVector() * 520); |
---|
2316 | |
---|
2317 | enemy_shootsfx.Play(); |
---|
2318 | }; |
---|
2319 | |
---|
2320 | wait.Interval = 1; |
---|
2321 | wait.Timeout += delegate |
---|
2322 | { |
---|
2323 | |
---|
2324 | if (boss.IsDestroyed){ |
---|
2325 | wait.Stop(); |
---|
2326 | shoot.Stop(); |
---|
2327 | shoot2.Stop(); |
---|
2328 | shoot3.Stop(); |
---|
2329 | shoot4.Stop(); |
---|
2330 | } |
---|
2331 | |
---|
2332 | if (f >= 2) |
---|
2333 | { |
---|
2334 | bool ss = RandomGen.NextBool(); |
---|
2335 | |
---|
2336 | f = 0; |
---|
2337 | |
---|
2338 | if (ss) shoot3.Start(); |
---|
2339 | else if (!ss) shoot4.Start(); |
---|
2340 | } |
---|
2341 | else if (d == 0) shoot.Start(); |
---|
2342 | else if (d == 1) shoot2.Start(); |
---|
2343 | }; |
---|
2344 | |
---|
2345 | wait.Start(); |
---|
2346 | } |
---|
2347 | |
---|
2348 | void boss2_shoot_1(Vector pos, Vector dir) |
---|
2349 | { |
---|
2350 | bullet enemy_bullet = new bullet(15, 35); |
---|
2351 | |
---|
2352 | Add(enemy_bullet, 0); |
---|
2353 | enemy_bullet.Shape = Shape.Circle; |
---|
2354 | enemy_bullet.Position = pos; |
---|
2355 | enemy_bullet.IgnoresCollisionResponse = true; |
---|
2356 | enemy_bullet.IgnoresGravity = true; |
---|
2357 | enemy_bullet.CollisionIgnoreGroup = 2; |
---|
2358 | enemy_bullet.Image = bullet_enemy_08; |
---|
2359 | enemy_bullet.Hit(dir); |
---|
2360 | |
---|
2361 | enemy_bullet.Angle = enemy_bullet.Velocity.Angle + Angle.FromDegrees(45); |
---|
2362 | AddCollisionHandler<bullet, player>(enemy_bullet, damagePlayerBullet); |
---|
2363 | AddCollisionHandler<bullet, bulletdes>(enemy_bullet, destroy); |
---|
2364 | |
---|
2365 | } |
---|
2366 | void boss2_shoot_2(Vector pos, Vector dir) |
---|
2367 | { |
---|
2368 | bullet enemy_bullet = new bullet(15, 35); |
---|
2369 | |
---|
2370 | Add(enemy_bullet, 0); |
---|
2371 | enemy_bullet.Shape = Shape.Circle; |
---|
2372 | enemy_bullet.Position = pos; |
---|
2373 | enemy_bullet.IgnoresCollisionResponse = true; |
---|
2374 | enemy_bullet.IgnoresGravity = true; |
---|
2375 | enemy_bullet.CollisionIgnoreGroup = 2; |
---|
2376 | enemy_bullet.Image = bullet_enemy_07; |
---|
2377 | enemy_bullet.Hit(dir); |
---|
2378 | |
---|
2379 | enemy_bullet.Angle = enemy_bullet.Velocity.Angle + Angle.FromDegrees(-45); |
---|
2380 | AddCollisionHandler<bullet, player>(enemy_bullet, damagePlayerBullet); |
---|
2381 | AddCollisionHandler<bullet, bulletdes>(enemy_bullet, destroy); |
---|
2382 | |
---|
2383 | } |
---|
2384 | void boss2_shoot_3(Vector pos, Vector dir) |
---|
2385 | { |
---|
2386 | bullet enemy_bullet = new bullet(27, 27); |
---|
2387 | enemy_bullet.Shape = Shape.Circle; |
---|
2388 | enemy_bullet.Position = pos; |
---|
2389 | enemy_bullet.IgnoresCollisionResponse = true; |
---|
2390 | enemy_bullet.IgnoresGravity = true; |
---|
2391 | enemy_bullet.CollisionIgnoreGroup = 2; |
---|
2392 | enemy_bullet.Image = RandomGen.SelectOne<Image>(bullet_enemy_03, bullet_enemy_04); |
---|
2393 | |
---|
2394 | Add(enemy_bullet, 0); |
---|
2395 | enemy_bullet.Hit(dir); |
---|
2396 | AddCollisionHandler<bullet, player>(enemy_bullet, damagePlayerBullet); |
---|
2397 | AddCollisionHandler<bullet, bulletdes>(enemy_bullet, destroy); |
---|
2398 | } |
---|
2399 | |
---|
2400 | void boss_ship_3(Vector pos, double width, double height) |
---|
2401 | { |
---|
2402 | boss boss_ship = new boss(258, 256); |
---|
2403 | boss_ship.health.MaxValue = 20000; |
---|
2404 | boss_ship.health.Value = 20000; |
---|
2405 | boss_ship.Shape = Shape.Circle; |
---|
2406 | boss_ship.Position = pos; |
---|
2407 | boss_ship.IgnoresCollisionResponse = true; |
---|
2408 | boss_ship.CollisionIgnoreGroup = 3; |
---|
2409 | boss_ship.Image = boss_ship_03; |
---|
2410 | |
---|
2411 | Add(boss_ship, -1); |
---|
2412 | boss_ship.Hit(stagespeed); |
---|
2413 | AddCollisionHandler<boss, frontborder>(boss_ship, boss_03_start); |
---|
2414 | AddCollisionHandler<boss, player>(boss_ship, damagePlayerBossShip); |
---|
2415 | } |
---|
2416 | void boss_03_start(boss boss, frontborder border) |
---|
2417 | { |
---|
2418 | if (!boss.canShoot) |
---|
2419 | { |
---|
2420 | boss.canShoot = true; |
---|
2421 | boss.Velocity = boss.Velocity / 8.5; |
---|
2422 | MediaPlayer.IsRepeating = true; |
---|
2423 | MediaPlayer.Play("Mirage"); |
---|
2424 | |
---|
2425 | Timer wait = new Timer(); |
---|
2426 | wait.Interval = 5.5; |
---|
2427 | wait.Timeout += delegate |
---|
2428 | { |
---|
2429 | AddCollisionHandler<boss, bullet>(boss, damageBoss); |
---|
2430 | boss.Velocity = new Vector(0, 0); |
---|
2431 | |
---|
2432 | boss_03_start_shooting(boss); |
---|
2433 | }; |
---|
2434 | wait.Start(1); |
---|
2435 | } |
---|
2436 | } |
---|
2437 | void boss_03_start_shooting(boss boss) |
---|
2438 | { |
---|
2439 | UnlimitedAngle angle = UnlimitedAngle.FromDegrees(0); |
---|
2440 | UnlimitedAngle angle2 = UnlimitedAngle.FromDegrees(0); |
---|
2441 | UnlimitedAngle angle3 = UnlimitedAngle.FromDegrees(0); |
---|
2442 | UnlimitedAngle angle4 = UnlimitedAngle.FromDegrees(0); |
---|
2443 | |
---|
2444 | UnlimitedAngle angleb = UnlimitedAngle.FromDegrees(0); |
---|
2445 | UnlimitedAngle angle2b = UnlimitedAngle.FromDegrees(0); |
---|
2446 | UnlimitedAngle angle3b = UnlimitedAngle.FromDegrees(0); |
---|
2447 | UnlimitedAngle angle4b = UnlimitedAngle.FromDegrees(0); |
---|
2448 | double i = 0; |
---|
2449 | double ib = 0; |
---|
2450 | double c = 0; |
---|
2451 | double d = 0; |
---|
2452 | double t = 0; |
---|
2453 | double f = 0; |
---|
2454 | double f2 = 0; |
---|
2455 | |
---|
2456 | Timer wait = new Timer(); |
---|
2457 | Timer shoot = new Timer(); |
---|
2458 | Timer shoot2 = new Timer(); |
---|
2459 | Timer shoot3 = new Timer(); |
---|
2460 | Timer shoot4 = new Timer(); |
---|
2461 | |
---|
2462 | shoot.Interval = 0.05; |
---|
2463 | shoot.Timeout += delegate |
---|
2464 | { |
---|
2465 | if (boss.IsDestroyed) |
---|
2466 | { |
---|
2467 | wait.Stop(); |
---|
2468 | shoot.Stop(); |
---|
2469 | shoot2.Stop(); |
---|
2470 | shoot3.Stop(); |
---|
2471 | shoot4.Stop(); |
---|
2472 | } |
---|
2473 | if (!boss.IsDestroyed) |
---|
2474 | { |
---|
2475 | c++; |
---|
2476 | if (c >= 18) |
---|
2477 | { |
---|
2478 | f++; |
---|
2479 | f2++; |
---|
2480 | d = 1; |
---|
2481 | c = 0; |
---|
2482 | shoot.Stop(); |
---|
2483 | wait.Start(1); |
---|
2484 | } |
---|
2485 | |
---|
2486 | i = i + 10; |
---|
2487 | angle = UnlimitedAngle.FromDegrees(i); |
---|
2488 | angle2 = UnlimitedAngle.FromDegrees(i + 90); |
---|
2489 | angle3 = UnlimitedAngle.FromDegrees(i + 180); |
---|
2490 | angle4 = UnlimitedAngle.FromDegrees(i + 270); |
---|
2491 | |
---|
2492 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle + UnlimitedAngle.FromDegrees(0)).GetVector() * 460, Angle.FromDegrees(45)); |
---|
2493 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle + UnlimitedAngle.FromDegrees(7)).GetVector() * 480, Angle.FromDegrees(45)); |
---|
2494 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle + UnlimitedAngle.FromDegrees(14)).GetVector() * 500, Angle.FromDegrees(45)); |
---|
2495 | |
---|
2496 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle2 + UnlimitedAngle.FromDegrees(0)).GetVector() * 460, Angle.FromDegrees(45)); |
---|
2497 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle2 + UnlimitedAngle.FromDegrees(7)).GetVector() * 480, Angle.FromDegrees(45)); |
---|
2498 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle2 + UnlimitedAngle.FromDegrees(14)).GetVector() * 500, Angle.FromDegrees(45)); |
---|
2499 | |
---|
2500 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle3 + UnlimitedAngle.FromDegrees(0)).GetVector() * 460, Angle.FromDegrees(45)); |
---|
2501 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle3 + UnlimitedAngle.FromDegrees(7)).GetVector() * 480, Angle.FromDegrees(45)); |
---|
2502 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle3 + UnlimitedAngle.FromDegrees(14)).GetVector() * 500, Angle.FromDegrees(45)); |
---|
2503 | |
---|
2504 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle4 + UnlimitedAngle.FromDegrees(0)).GetVector() * 460, Angle.FromDegrees(45)); |
---|
2505 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle4 + UnlimitedAngle.FromDegrees(7)).GetVector() * 480, Angle.FromDegrees(45)); |
---|
2506 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle4 + UnlimitedAngle.FromDegrees(14)).GetVector() * 500, Angle.FromDegrees(45)); |
---|
2507 | |
---|
2508 | |
---|
2509 | enemy_shootsfx.Play(); |
---|
2510 | } |
---|
2511 | else shoot.Stop(); |
---|
2512 | }; |
---|
2513 | |
---|
2514 | shoot2.Interval = 0.05; |
---|
2515 | shoot2.Timeout += delegate |
---|
2516 | { |
---|
2517 | if (boss.IsDestroyed) |
---|
2518 | { |
---|
2519 | wait.Stop(); |
---|
2520 | shoot.Stop(); |
---|
2521 | shoot2.Stop(); |
---|
2522 | shoot3.Stop(); |
---|
2523 | shoot4.Stop(); |
---|
2524 | } |
---|
2525 | if (!boss.IsDestroyed) |
---|
2526 | { |
---|
2527 | c++; |
---|
2528 | if (c >= 18) |
---|
2529 | { |
---|
2530 | f++; |
---|
2531 | f2++; |
---|
2532 | d = 0; |
---|
2533 | c = 0; |
---|
2534 | shoot2.Stop(); |
---|
2535 | wait.Start(1); |
---|
2536 | } |
---|
2537 | |
---|
2538 | i = i + 10; |
---|
2539 | angle = UnlimitedAngle.FromDegrees(-i); |
---|
2540 | angle2 = UnlimitedAngle.FromDegrees(-i + 90); |
---|
2541 | angle3 = UnlimitedAngle.FromDegrees(-i + 180); |
---|
2542 | angle4 = UnlimitedAngle.FromDegrees(-i + 270); |
---|
2543 | |
---|
2544 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle + UnlimitedAngle.FromDegrees(0)).GetVector() * 460, Angle.FromDegrees(-45)); |
---|
2545 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle + UnlimitedAngle.FromDegrees(-7)).GetVector() * 480, Angle.FromDegrees(-45)); |
---|
2546 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle + UnlimitedAngle.FromDegrees(-14)).GetVector() * 500, Angle.FromDegrees(-45)); |
---|
2547 | |
---|
2548 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle2 + UnlimitedAngle.FromDegrees(0)).GetVector() * 460, Angle.FromDegrees(-45)); |
---|
2549 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle2 + UnlimitedAngle.FromDegrees(-7)).GetVector() * 480, Angle.FromDegrees(-45)); |
---|
2550 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle2 + UnlimitedAngle.FromDegrees(-14)).GetVector() * 500, Angle.FromDegrees(-45)); |
---|
2551 | |
---|
2552 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle3 + UnlimitedAngle.FromDegrees(0)).GetVector() * 460, Angle.FromDegrees(-45)); |
---|
2553 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle3 + UnlimitedAngle.FromDegrees(-7)).GetVector() * 480, Angle.FromDegrees(-45)); |
---|
2554 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle3 + UnlimitedAngle.FromDegrees(-14)).GetVector() * 500, Angle.FromDegrees(-45)); |
---|
2555 | |
---|
2556 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle4 + UnlimitedAngle.FromDegrees(0)).GetVector() * 460, Angle.FromDegrees(-45)); |
---|
2557 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle4 + UnlimitedAngle.FromDegrees(-7)).GetVector() * 480, Angle.FromDegrees(-45)); |
---|
2558 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle4 + UnlimitedAngle.FromDegrees(-14)).GetVector() * 500, Angle.FromDegrees(-45)); |
---|
2559 | |
---|
2560 | |
---|
2561 | enemy_shootsfx.Play(); |
---|
2562 | } |
---|
2563 | else shoot.Stop(); |
---|
2564 | }; |
---|
2565 | |
---|
2566 | UnlimitedAngle anglec = UnlimitedAngle.FromDegrees(0); |
---|
2567 | double ic = -270; |
---|
2568 | double ic2 = 270; |
---|
2569 | double cc = 0; |
---|
2570 | |
---|
2571 | shoot3.Interval = 0.06; |
---|
2572 | shoot3.Timeout += delegate |
---|
2573 | { |
---|
2574 | if (cc >= 60) |
---|
2575 | { |
---|
2576 | cc = 0; |
---|
2577 | shoot3.Stop(); |
---|
2578 | if (t == 0) t = 1; |
---|
2579 | else if (t == 1) t = 0; |
---|
2580 | } |
---|
2581 | else if (cc != 60) |
---|
2582 | { |
---|
2583 | if (!boss.IsDestroyed) |
---|
2584 | { |
---|
2585 | if (t == 0) anglec = UnlimitedAngle.FromDegrees(ic); |
---|
2586 | else if (t == 1) anglec = UnlimitedAngle.FromDegrees(ic2); |
---|
2587 | ic = ic + 6; |
---|
2588 | ic2 = ic2 - 6; |
---|
2589 | |
---|
2590 | cc++; |
---|
2591 | enemy_shoot_2(boss.Position + new Vector(-65, 0), |
---|
2592 | |
---|
2593 | anglec.GetVector() * 500 |
---|
2594 | ); |
---|
2595 | |
---|
2596 | } |
---|
2597 | else |
---|
2598 | { |
---|
2599 | wait.Stop(); |
---|
2600 | shoot.Stop(); |
---|
2601 | shoot2.Stop(); |
---|
2602 | shoot3.Stop(); |
---|
2603 | shoot4.Stop(); |
---|
2604 | } |
---|
2605 | }; |
---|
2606 | |
---|
2607 | }; |
---|
2608 | |
---|
2609 | shoot4.Interval = 0.05; |
---|
2610 | shoot4.Timeout += delegate |
---|
2611 | { |
---|
2612 | if (boss.IsDestroyed) |
---|
2613 | { |
---|
2614 | wait.Stop(); |
---|
2615 | shoot.Stop(); |
---|
2616 | shoot2.Stop(); |
---|
2617 | shoot3.Stop(); |
---|
2618 | shoot4.Stop(); |
---|
2619 | } |
---|
2620 | if (!boss.IsDestroyed) |
---|
2621 | { |
---|
2622 | c++; |
---|
2623 | if (c >= 18) |
---|
2624 | { |
---|
2625 | c = 0; |
---|
2626 | f++; |
---|
2627 | shoot4.Stop(); |
---|
2628 | wait.Start(1); |
---|
2629 | } |
---|
2630 | |
---|
2631 | ib = ib - 10; |
---|
2632 | angleb = UnlimitedAngle.FromDegrees(ib); |
---|
2633 | angle2b = UnlimitedAngle.FromDegrees(ib - 90); |
---|
2634 | angle3b = UnlimitedAngle.FromDegrees(ib - 180); |
---|
2635 | angle4b = UnlimitedAngle.FromDegrees(ib - 270); |
---|
2636 | |
---|
2637 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle2b + UnlimitedAngle.FromDegrees(0)).GetVector() * 460, Angle.FromDegrees(-45)); |
---|
2638 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle2b + UnlimitedAngle.FromDegrees(-7)).GetVector() * 480, Angle.FromDegrees(-45)); |
---|
2639 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle2b + UnlimitedAngle.FromDegrees(-14)).GetVector() * 500, Angle.FromDegrees(-45)); |
---|
2640 | |
---|
2641 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle4b + UnlimitedAngle.FromDegrees(0)).GetVector() * 460, Angle.FromDegrees(-45)); |
---|
2642 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle4b + UnlimitedAngle.FromDegrees(-7)).GetVector() * 480, Angle.FromDegrees(-45)); |
---|
2643 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle4b + UnlimitedAngle.FromDegrees(-14)).GetVector() * 500, Angle.FromDegrees(-45)); |
---|
2644 | |
---|
2645 | i = i + 10; |
---|
2646 | angle = UnlimitedAngle.FromDegrees(i); |
---|
2647 | angle2 = UnlimitedAngle.FromDegrees(i + 90); |
---|
2648 | angle3 = UnlimitedAngle.FromDegrees(i + 180); |
---|
2649 | angle4 = UnlimitedAngle.FromDegrees(i + 270); |
---|
2650 | |
---|
2651 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle2 + UnlimitedAngle.FromDegrees(0)).GetVector() * 500, Angle.FromDegrees(45)); |
---|
2652 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle2 + UnlimitedAngle.FromDegrees(7)).GetVector() * 520, Angle.FromDegrees(45)); |
---|
2653 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle2 + UnlimitedAngle.FromDegrees(14)).GetVector() * 540, Angle.FromDegrees(45)); |
---|
2654 | |
---|
2655 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle4 + UnlimitedAngle.FromDegrees(0)).GetVector() * 500, Angle.FromDegrees(45)); |
---|
2656 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle4 + UnlimitedAngle.FromDegrees(7)).GetVector() * 520, Angle.FromDegrees(45)); |
---|
2657 | boss3_shoot_1(boss.Position + new Vector(-65, 0), (angle4 + UnlimitedAngle.FromDegrees(14)).GetVector() * 540, Angle.FromDegrees(45)); |
---|
2658 | |
---|
2659 | |
---|
2660 | enemy_shootsfx.Play(); |
---|
2661 | } |
---|
2662 | else shoot.Stop(); |
---|
2663 | }; |
---|
2664 | |
---|
2665 | wait.Interval = 0.2; |
---|
2666 | wait.Timeout += delegate |
---|
2667 | { |
---|
2668 | if (boss.IsDestroyed) |
---|
2669 | { |
---|
2670 | wait.Stop(); |
---|
2671 | shoot.Stop(); |
---|
2672 | shoot2.Stop(); |
---|
2673 | shoot3.Stop(); |
---|
2674 | shoot4.Stop(); |
---|
2675 | } |
---|
2676 | if (f >= 2) |
---|
2677 | { |
---|
2678 | f = 0; |
---|
2679 | shoot3.Start(); |
---|
2680 | |
---|
2681 | } |
---|
2682 | |
---|
2683 | if (f2 >= 2) |
---|
2684 | { |
---|
2685 | f2 = 0; |
---|
2686 | shoot4.Start(); |
---|
2687 | } |
---|
2688 | else if (d == 0) shoot.Start(); |
---|
2689 | else if (d == 1) shoot2.Start(); |
---|
2690 | }; |
---|
2691 | |
---|
2692 | wait.Start(1); |
---|
2693 | } |
---|
2694 | void boss3_shoot_1(Vector pos, Vector dir, Angle angle) |
---|
2695 | { |
---|
2696 | bullet enemy_bullet = new bullet(15, 35); |
---|
2697 | |
---|
2698 | Add(enemy_bullet, 0); |
---|
2699 | enemy_bullet.Shape = Shape.Circle; |
---|
2700 | enemy_bullet.Position = pos; |
---|
2701 | enemy_bullet.IgnoresCollisionResponse = true; |
---|
2702 | enemy_bullet.IgnoresGravity = true; |
---|
2703 | enemy_bullet.CollisionIgnoreGroup = 2; |
---|
2704 | enemy_bullet.Image = bullet_enemy_09; |
---|
2705 | enemy_bullet.Hit(dir); |
---|
2706 | |
---|
2707 | enemy_bullet.Angle = enemy_bullet.Velocity.Angle + angle; |
---|
2708 | AddCollisionHandler<bullet, player>(enemy_bullet, damagePlayerBullet); |
---|
2709 | AddCollisionHandler<bullet, bulletdes>(enemy_bullet, destroy); |
---|
2710 | |
---|
2711 | } |
---|
2712 | |
---|
2713 | void boss_aj(Vector pos, double width, double height) |
---|
2714 | { |
---|
2715 | boss boss_ship = new boss(234, 326); |
---|
2716 | boss_ship.health.MaxValue = 25000; |
---|
2717 | boss_ship.health.Value = 25000; |
---|
2718 | boss_ship.Shape = Shape.Circle; |
---|
2719 | boss_ship.Position = pos; |
---|
2720 | boss_ship.IgnoresCollisionResponse = true; |
---|
2721 | boss_ship.CollisionIgnoreGroup = 3; |
---|
2722 | boss_ship.Image = boss_ship_ajnator; |
---|
2723 | |
---|
2724 | Add(boss_ship, -1); |
---|
2725 | boss_ship.Hit(stagespeed); |
---|
2726 | AddCollisionHandler<boss, frontborder>(boss_ship, boss_aj_start); |
---|
2727 | AddCollisionHandler<boss, player>(boss_ship, damagePlayerBossShip); |
---|
2728 | } |
---|
2729 | void boss_aj_start(boss boss, frontborder border) |
---|
2730 | { |
---|
2731 | if (!boss.canShoot) |
---|
2732 | { |
---|
2733 | boss.canShoot = true; |
---|
2734 | boss.Velocity = boss.Velocity / 5; |
---|
2735 | MediaPlayer.IsRepeating = true; |
---|
2736 | MediaPlayer.Play("Wild_AJ_Approaches"); |
---|
2737 | |
---|
2738 | Timer wait = new Timer(); |
---|
2739 | wait.Interval = 3; |
---|
2740 | wait.Timeout += delegate |
---|
2741 | { |
---|
2742 | AddCollisionHandler<boss, bullet>(boss, damageBoss); |
---|
2743 | boss.Velocity = new Vector(0, 0); |
---|
2744 | |
---|
2745 | boss_aj_start_shooting(boss); |
---|
2746 | }; |
---|
2747 | wait.Start(1); |
---|
2748 | } |
---|
2749 | } |
---|
2750 | void boss_aj_start_shooting(boss boss) |
---|
2751 | { |
---|
2752 | UnlimitedAngle angle = UnlimitedAngle.FromDegrees(0); |
---|
2753 | UnlimitedAngle angle2 = UnlimitedAngle.FromDegrees(0); |
---|
2754 | UnlimitedAngle angle3 = UnlimitedAngle.FromDegrees(0); |
---|
2755 | UnlimitedAngle angle4 = UnlimitedAngle.FromDegrees(0); |
---|
2756 | |
---|
2757 | UnlimitedAngle angleb = UnlimitedAngle.FromDegrees(0); |
---|
2758 | UnlimitedAngle angle2b = UnlimitedAngle.FromDegrees(0); |
---|
2759 | UnlimitedAngle angle3b = UnlimitedAngle.FromDegrees(0); |
---|
2760 | UnlimitedAngle angle4b = UnlimitedAngle.FromDegrees(0); |
---|
2761 | double i = 0; |
---|
2762 | double ib = 0; |
---|
2763 | double c = 0; |
---|
2764 | double d = 0; |
---|
2765 | double t = 0; |
---|
2766 | double f = 0; |
---|
2767 | double f2 = 0; |
---|
2768 | |
---|
2769 | Timer wait = new Timer(); |
---|
2770 | Timer shoot = new Timer(); |
---|
2771 | Timer shoot2 = new Timer(); |
---|
2772 | Timer shoot3 = new Timer(); |
---|
2773 | Timer shoot4 = new Timer(); |
---|
2774 | |
---|
2775 | shoot.Interval = 0.05; |
---|
2776 | shoot.Timeout += delegate |
---|
2777 | { |
---|
2778 | if (boss.IsDestroyed) |
---|
2779 | { |
---|
2780 | wait.Stop(); |
---|
2781 | shoot.Stop(); |
---|
2782 | shoot2.Stop(); |
---|
2783 | shoot3.Stop(); |
---|
2784 | shoot4.Stop(); |
---|
2785 | } |
---|
2786 | if (!boss.IsDestroyed) |
---|
2787 | { |
---|
2788 | c++; |
---|
2789 | if (c >= 18) |
---|
2790 | { |
---|
2791 | f++; |
---|
2792 | f2++; |
---|
2793 | d = 1; |
---|
2794 | c = 0; |
---|
2795 | shoot.Stop(); |
---|
2796 | wait.Start(1); |
---|
2797 | } |
---|
2798 | |
---|
2799 | i = i + 10; |
---|
2800 | angle = UnlimitedAngle.FromDegrees(i); |
---|
2801 | angle2 = UnlimitedAngle.FromDegrees(i + 90); |
---|
2802 | angle3 = UnlimitedAngle.FromDegrees(i + 180); |
---|
2803 | angle4 = UnlimitedAngle.FromDegrees(i + 270); |
---|
2804 | |
---|
2805 | boss4_shoot_1(boss.Position, (angle + UnlimitedAngle.FromDegrees(0)).GetVector() * 460, Angle.FromDegrees(45)); |
---|
2806 | boss4_shoot_1(boss.Position, (angle + UnlimitedAngle.FromDegrees(7)).GetVector() * 480, Angle.FromDegrees(45)); |
---|
2807 | boss4_shoot_1(boss.Position, (angle + UnlimitedAngle.FromDegrees(14)).GetVector() * 500, Angle.FromDegrees(45)); |
---|
2808 | |
---|
2809 | boss4_shoot_1(boss.Position, (angle2 + UnlimitedAngle.FromDegrees(0)).GetVector() * 460, Angle.FromDegrees(45)); |
---|
2810 | boss4_shoot_1(boss.Position, (angle2 + UnlimitedAngle.FromDegrees(7)).GetVector() * 480, Angle.FromDegrees(45)); |
---|
2811 | boss4_shoot_1(boss.Position, (angle2 + UnlimitedAngle.FromDegrees(14)).GetVector() * 500, Angle.FromDegrees(45)); |
---|
2812 | |
---|
2813 | boss4_shoot_1(boss.Position, (angle3 + UnlimitedAngle.FromDegrees(0)).GetVector() * 460, Angle.FromDegrees(45)); |
---|
2814 | boss4_shoot_1(boss.Position, (angle3 + UnlimitedAngle.FromDegrees(7)).GetVector() * 480, Angle.FromDegrees(45)); |
---|
2815 | boss4_shoot_1(boss.Position, (angle3 + UnlimitedAngle.FromDegrees(14)).GetVector() * 500, Angle.FromDegrees(45)); |
---|
2816 | |
---|
2817 | boss4_shoot_1(boss.Position, (angle4 + UnlimitedAngle.FromDegrees(0)).GetVector() * 460, Angle.FromDegrees(45)); |
---|
2818 | boss4_shoot_1(boss.Position, (angle4 + UnlimitedAngle.FromDegrees(7)).GetVector() * 480, Angle.FromDegrees(45)); |
---|
2819 | boss4_shoot_1(boss.Position, (angle4 + UnlimitedAngle.FromDegrees(14)).GetVector() * 500, Angle.FromDegrees(45)); |
---|
2820 | |
---|
2821 | |
---|
2822 | enemy_shootsfx.Play(); |
---|
2823 | } |
---|
2824 | else shoot.Stop(); |
---|
2825 | }; |
---|
2826 | |
---|
2827 | shoot2.Interval = 0.05; |
---|
2828 | shoot2.Timeout += delegate |
---|
2829 | { |
---|
2830 | if (boss.IsDestroyed) |
---|
2831 | { |
---|
2832 | wait.Stop(); |
---|
2833 | shoot.Stop(); |
---|
2834 | shoot2.Stop(); |
---|
2835 | shoot3.Stop(); |
---|
2836 | shoot4.Stop(); |
---|
2837 | } |
---|
2838 | if (!boss.IsDestroyed) |
---|
2839 | { |
---|
2840 | c++; |
---|
2841 | if (c >= 18) |
---|
2842 | { |
---|
2843 | f++; |
---|
2844 | f2++; |
---|
2845 | d = 0; |
---|
2846 | c = 0; |
---|
2847 | shoot2.Stop(); |
---|
2848 | wait.Start(1); |
---|
2849 | } |
---|
2850 | |
---|
2851 | i = i + 10; |
---|
2852 | angle = UnlimitedAngle.FromDegrees(-i); |
---|
2853 | angle2 = UnlimitedAngle.FromDegrees(-i + 90); |
---|
2854 | angle3 = UnlimitedAngle.FromDegrees(-i + 180); |
---|
2855 | angle4 = UnlimitedAngle.FromDegrees(-i + 270); |
---|
2856 | |
---|
2857 | boss4_shoot_1(boss.Position, (angle + UnlimitedAngle.FromDegrees(0)).GetVector() * 460, Angle.FromDegrees(-45)); |
---|
2858 | boss4_shoot_1(boss.Position, (angle + UnlimitedAngle.FromDegrees(-7)).GetVector() * 480, Angle.FromDegrees(-45)); |
---|
2859 | boss4_shoot_1(boss.Position, (angle + UnlimitedAngle.FromDegrees(-14)).GetVector() * 500, Angle.FromDegrees(-45)); |
---|
2860 | |
---|
2861 | boss4_shoot_1(boss.Position, (angle2 + UnlimitedAngle.FromDegrees(0)).GetVector() * 460, Angle.FromDegrees(-45)); |
---|
2862 | boss4_shoot_1(boss.Position, (angle2 + UnlimitedAngle.FromDegrees(-7)).GetVector() * 480, Angle.FromDegrees(-45)); |
---|
2863 | boss4_shoot_1(boss.Position, (angle2 + UnlimitedAngle.FromDegrees(-14)).GetVector() * 500, Angle.FromDegrees(-45)); |
---|
2864 | |
---|
2865 | boss4_shoot_1(boss.Position, (angle3 + UnlimitedAngle.FromDegrees(0)).GetVector() * 460, Angle.FromDegrees(-45)); |
---|
2866 | boss4_shoot_1(boss.Position, (angle3 + UnlimitedAngle.FromDegrees(-7)).GetVector() * 480, Angle.FromDegrees(-45)); |
---|
2867 | boss4_shoot_1(boss.Position, (angle3 + UnlimitedAngle.FromDegrees(-14)).GetVector() * 500, Angle.FromDegrees(-45)); |
---|
2868 | |
---|
2869 | boss4_shoot_1(boss.Position, (angle4 + UnlimitedAngle.FromDegrees(0)).GetVector() * 460, Angle.FromDegrees(-45)); |
---|
2870 | boss4_shoot_1(boss.Position, (angle4 + UnlimitedAngle.FromDegrees(-7)).GetVector() * 480, Angle.FromDegrees(-45)); |
---|
2871 | boss4_shoot_1(boss.Position, (angle4 + UnlimitedAngle.FromDegrees(-14)).GetVector() * 500, Angle.FromDegrees(-45)); |
---|
2872 | |
---|
2873 | |
---|
2874 | enemy_shootsfx.Play(); |
---|
2875 | } |
---|
2876 | else shoot.Stop(); |
---|
2877 | }; |
---|
2878 | |
---|
2879 | UnlimitedAngle anglec = UnlimitedAngle.FromDegrees(0); |
---|
2880 | double ic = -270; |
---|
2881 | double ic2 = 270; |
---|
2882 | double cc = 0; |
---|
2883 | |
---|
2884 | shoot3.Interval = 0.06; |
---|
2885 | shoot3.Timeout += delegate |
---|
2886 | { |
---|
2887 | if (cc >= 60) |
---|
2888 | { |
---|
2889 | cc = 0; |
---|
2890 | shoot3.Stop(); |
---|
2891 | if (t == 0) t = 1; |
---|
2892 | else if (t == 1) t = 0; |
---|
2893 | } |
---|
2894 | else if (cc != 60) |
---|
2895 | { |
---|
2896 | if (!boss.IsDestroyed) |
---|
2897 | { |
---|
2898 | if (t == 0) anglec = UnlimitedAngle.FromDegrees(ic); |
---|
2899 | else if (t == 1) anglec = UnlimitedAngle.FromDegrees(ic2); |
---|
2900 | ic = ic + 6; |
---|
2901 | ic2 = ic2 - 6; |
---|
2902 | |
---|
2903 | cc++; |
---|
2904 | boss4_shoot_2(boss.Position, |
---|
2905 | |
---|
2906 | anglec.GetVector() * 500 |
---|
2907 | ); |
---|
2908 | |
---|
2909 | } |
---|
2910 | else |
---|
2911 | { |
---|
2912 | wait.Stop(); |
---|
2913 | shoot.Stop(); |
---|
2914 | shoot2.Stop(); |
---|
2915 | shoot3.Stop(); |
---|
2916 | shoot4.Stop(); |
---|
2917 | } |
---|
2918 | }; |
---|
2919 | |
---|
2920 | }; |
---|
2921 | |
---|
2922 | shoot4.Interval = 0.05; |
---|
2923 | shoot4.Timeout += delegate |
---|
2924 | { |
---|
2925 | if (boss.IsDestroyed) |
---|
2926 | { |
---|
2927 | wait.Stop(); |
---|
2928 | shoot.Stop(); |
---|
2929 | shoot2.Stop(); |
---|
2930 | shoot3.Stop(); |
---|
2931 | shoot4.Stop(); |
---|
2932 | } |
---|
2933 | if (!boss.IsDestroyed) |
---|
2934 | { |
---|
2935 | c++; |
---|
2936 | if (c >= 18) |
---|
2937 | { |
---|
2938 | c = 0; |
---|
2939 | f++; |
---|
2940 | shoot4.Stop(); |
---|
2941 | wait.Start(1); |
---|
2942 | } |
---|
2943 | |
---|
2944 | ib = ib - 10; |
---|
2945 | angleb = UnlimitedAngle.FromDegrees(ib); |
---|
2946 | angle2b = UnlimitedAngle.FromDegrees(ib - 90); |
---|
2947 | angle3b = UnlimitedAngle.FromDegrees(ib - 180); |
---|
2948 | angle4b = UnlimitedAngle.FromDegrees(ib - 270); |
---|
2949 | |
---|
2950 | boss4_shoot_1(boss.Position, (angle2b + UnlimitedAngle.FromDegrees(0)).GetVector() * 460, Angle.FromDegrees(-45)); |
---|
2951 | boss4_shoot_1(boss.Position, (angle2b + UnlimitedAngle.FromDegrees(-7)).GetVector() * 480, Angle.FromDegrees(-45)); |
---|
2952 | boss4_shoot_1(boss.Position, (angle2b + UnlimitedAngle.FromDegrees(-14)).GetVector() * 500, Angle.FromDegrees(-45)); |
---|
2953 | |
---|
2954 | boss4_shoot_1(boss.Position, (angle4b + UnlimitedAngle.FromDegrees(0)).GetVector() * 460, Angle.FromDegrees(-45)); |
---|
2955 | boss4_shoot_1(boss.Position, (angle4b + UnlimitedAngle.FromDegrees(-7)).GetVector() * 480, Angle.FromDegrees(-45)); |
---|
2956 | boss4_shoot_1(boss.Position, (angle4b + UnlimitedAngle.FromDegrees(-14)).GetVector() * 500, Angle.FromDegrees(-45)); |
---|
2957 | |
---|
2958 | i = i + 10; |
---|
2959 | angle = UnlimitedAngle.FromDegrees(i); |
---|
2960 | angle2 = UnlimitedAngle.FromDegrees(i + 90); |
---|
2961 | angle3 = UnlimitedAngle.FromDegrees(i + 180); |
---|
2962 | angle4 = UnlimitedAngle.FromDegrees(i + 270); |
---|
2963 | |
---|
2964 | boss4_shoot_1(boss.Position, (angle2 + UnlimitedAngle.FromDegrees(0)).GetVector() * 500, Angle.FromDegrees(45)); |
---|
2965 | boss4_shoot_1(boss.Position, (angle2 + UnlimitedAngle.FromDegrees(7)).GetVector() * 520, Angle.FromDegrees(45)); |
---|
2966 | boss4_shoot_1(boss.Position, (angle2 + UnlimitedAngle.FromDegrees(14)).GetVector() * 540, Angle.FromDegrees(45)); |
---|
2967 | |
---|
2968 | boss4_shoot_1(boss.Position, (angle4 + UnlimitedAngle.FromDegrees(0)).GetVector() * 500, Angle.FromDegrees(45)); |
---|
2969 | boss4_shoot_1(boss.Position, (angle4 + UnlimitedAngle.FromDegrees(7)).GetVector() * 520, Angle.FromDegrees(45)); |
---|
2970 | boss4_shoot_1(boss.Position, (angle4 + UnlimitedAngle.FromDegrees(14)).GetVector() * 540, Angle.FromDegrees(45)); |
---|
2971 | |
---|
2972 | |
---|
2973 | enemy_shootsfx.Play(); |
---|
2974 | } |
---|
2975 | else shoot.Stop(); |
---|
2976 | }; |
---|
2977 | |
---|
2978 | wait.Interval = 0.2; |
---|
2979 | wait.Timeout += delegate |
---|
2980 | { |
---|
2981 | if (boss.IsDestroyed) |
---|
2982 | { |
---|
2983 | wait.Stop(); |
---|
2984 | shoot.Stop(); |
---|
2985 | shoot2.Stop(); |
---|
2986 | shoot3.Stop(); |
---|
2987 | shoot4.Stop(); |
---|
2988 | } |
---|
2989 | if (f >= 2) |
---|
2990 | { |
---|
2991 | f = 0; |
---|
2992 | shoot3.Start(); |
---|
2993 | |
---|
2994 | } |
---|
2995 | |
---|
2996 | if (f2 >= 2) |
---|
2997 | { |
---|
2998 | f2 = 0; |
---|
2999 | shoot4.Start(); |
---|
3000 | } |
---|
3001 | else if (d == 0) shoot.Start(); |
---|
3002 | else if (d == 1) shoot2.Start(); |
---|
3003 | }; |
---|
3004 | |
---|
3005 | wait.Start(1); |
---|
3006 | } |
---|
3007 | |
---|
3008 | void boss4_shoot_1(Vector pos, Vector dir, Angle angle) |
---|
3009 | { |
---|
3010 | bullet enemy_bullet = new bullet(15, 35); |
---|
3011 | |
---|
3012 | Add(enemy_bullet, 0); |
---|
3013 | enemy_bullet.Shape = Shape.Circle; |
---|
3014 | enemy_bullet.Position = pos; |
---|
3015 | enemy_bullet.IgnoresCollisionResponse = true; |
---|
3016 | enemy_bullet.IgnoresGravity = true; |
---|
3017 | enemy_bullet.CollisionIgnoreGroup = 2; |
---|
3018 | enemy_bullet.Image = bullet_enemy_10; |
---|
3019 | enemy_bullet.Hit(dir); |
---|
3020 | |
---|
3021 | enemy_bullet.Angle = enemy_bullet.Velocity.Angle + angle; |
---|
3022 | AddCollisionHandler<bullet, player>(enemy_bullet, damagePlayerBullet); |
---|
3023 | AddCollisionHandler<bullet, bulletdes>(enemy_bullet, destroy); |
---|
3024 | |
---|
3025 | } |
---|
3026 | void boss4_shoot_2(Vector pos, Vector dir) |
---|
3027 | { |
---|
3028 | bullet enemy_bullet = new bullet(27, 27); |
---|
3029 | enemy_bullet.Shape = Shape.Circle; |
---|
3030 | enemy_bullet.Position = pos; |
---|
3031 | enemy_bullet.IgnoresCollisionResponse = true; |
---|
3032 | enemy_bullet.IgnoresGravity = true; |
---|
3033 | enemy_bullet.CollisionIgnoreGroup = 2; |
---|
3034 | enemy_bullet.Image = bullet_enemy_10; |
---|
3035 | |
---|
3036 | Add(enemy_bullet, 0); |
---|
3037 | enemy_bullet.Hit(dir / 9); |
---|
3038 | AddCollisionHandler<bullet, player>(enemy_bullet, damagePlayerBullet); |
---|
3039 | AddCollisionHandler<bullet, bulletdes>(enemy_bullet, destroy); |
---|
3040 | |
---|
3041 | Timer wait = new Timer(); |
---|
3042 | wait.Interval = 0.8; |
---|
3043 | wait.Timeout += delegate |
---|
3044 | { |
---|
3045 | enemy_bullet.Velocity = dir; |
---|
3046 | }; |
---|
3047 | wait.Start(1); |
---|
3048 | } |
---|
3049 | |
---|
3050 | #endregion |
---|
3051 | |
---|
3052 | #region Power-ups |
---|
3053 | |
---|
3054 | void powerup(Vector pos) |
---|
3055 | { |
---|
3056 | int a = RandomGen.NextInt(1, 11); |
---|
3057 | if (a == 1) |
---|
3058 | { |
---|
3059 | createPowerup(pos); |
---|
3060 | }; |
---|
3061 | } |
---|
3062 | void createPowerup(Vector pos) |
---|
3063 | { |
---|
3064 | int type = RandomGen.NextInt(1, 9); |
---|
3065 | |
---|
3066 | PhysicsObject powerup = new PhysicsObject(15, 15); |
---|
3067 | powerup.Position = pos; |
---|
3068 | powerup.Tag = "powerup"; |
---|
3069 | powerup.IgnoresCollisionResponse = true; |
---|
3070 | powerup.IgnoresGravity = true; |
---|
3071 | powerup.CollisionIgnoreGroup = 4; |
---|
3072 | powerup.MaximumLifetime = TimeSpan.FromSeconds(5); |
---|
3073 | |
---|
3074 | FollowerBrain powerup_follow = new FollowerBrain(player); |
---|
3075 | powerup_follow.DistanceFar = 300; |
---|
3076 | powerup_follow.Speed = 430; |
---|
3077 | powerup_follow.Active = true; |
---|
3078 | |
---|
3079 | powerup.Brain = powerup_follow; |
---|
3080 | |
---|
3081 | if (type < 5) |
---|
3082 | { |
---|
3083 | powerup.Image = powerup_damage; |
---|
3084 | AddCollisionHandler(powerup, "player1", powerupdamage); |
---|
3085 | } |
---|
3086 | else if (type > 5) |
---|
3087 | { |
---|
3088 | powerup.Image = powerup_spread; |
---|
3089 | AddCollisionHandler(powerup, "player1", powerupspread); |
---|
3090 | } |
---|
3091 | else if (type == 5) |
---|
3092 | { |
---|
3093 | powerup.Image = powerup_upgrade; |
---|
3094 | AddCollisionHandler(powerup, "player1", powerupupgrade); |
---|
3095 | } |
---|
3096 | |
---|
3097 | Add(powerup, -2); |
---|
3098 | } |
---|
3099 | void powerupdamage(PhysicsObject powerup, PhysicsObject p) |
---|
3100 | { |
---|
3101 | wpn_damageRatio.Value++; |
---|
3102 | powerup.Destroy(); |
---|
3103 | powerupsfx.Play(); |
---|
3104 | |
---|
3105 | GameObject damageup = new GameObject(121,16); |
---|
3106 | damageup.Position = p.Position + new Vector(0, 30); |
---|
3107 | damageup.MaximumLifetime = TimeSpan.FromSeconds(0.75); |
---|
3108 | damageup.Image = damage_up; |
---|
3109 | |
---|
3110 | Timer damage = new Timer(); |
---|
3111 | damage.Interval = 0.1; |
---|
3112 | damage.Timeout += delegate |
---|
3113 | { |
---|
3114 | if (damageup.IsDestroyed) damage.Stop(); |
---|
3115 | if (damageup.IsVisible) damageup.IsVisible = false; |
---|
3116 | else damageup.IsVisible = true; |
---|
3117 | }; |
---|
3118 | |
---|
3119 | Add(damageup, 2); |
---|
3120 | damage.Start(); |
---|
3121 | } |
---|
3122 | void powerupspread(PhysicsObject powerup, PhysicsObject p) |
---|
3123 | { |
---|
3124 | wpn_spread.Value++; |
---|
3125 | powerup.Destroy(); |
---|
3126 | powerupsfx.Play(); |
---|
3127 | |
---|
3128 | GameObject spreadup = new GameObject(121, 16); |
---|
3129 | spreadup.Position = p.Position + new Vector(0, 30); |
---|
3130 | spreadup.MaximumLifetime = TimeSpan.FromSeconds(0.75); |
---|
3131 | spreadup.Image = spread_up; |
---|
3132 | |
---|
3133 | Timer damage = new Timer(); |
---|
3134 | damage.Interval = 0.1; |
---|
3135 | damage.Timeout += delegate |
---|
3136 | { |
---|
3137 | if (spreadup.IsDestroyed) damage.Stop(); |
---|
3138 | if (spreadup.IsVisible) spreadup.IsVisible = false; |
---|
3139 | else spreadup.IsVisible = true; |
---|
3140 | }; |
---|
3141 | |
---|
3142 | Add(spreadup, 2); |
---|
3143 | damage.Start(); |
---|
3144 | } |
---|
3145 | void powerupupgrade(PhysicsObject powerup, PhysicsObject p) |
---|
3146 | { |
---|
3147 | drd_level.Value++; |
---|
3148 | |
---|
3149 | powerup.Destroy(); |
---|
3150 | powerupsfx.Play(); |
---|
3151 | |
---|
3152 | GameObject upgrade_pu = new GameObject(98, 16); |
---|
3153 | upgrade_pu.Position = p.Position + new Vector(0, 30); |
---|
3154 | upgrade_pu.MaximumLifetime = TimeSpan.FromSeconds(0.75); |
---|
3155 | upgrade_pu.Image = upgrade; |
---|
3156 | |
---|
3157 | Timer damage = new Timer(); |
---|
3158 | damage.Interval = 0.1; |
---|
3159 | damage.Timeout += delegate |
---|
3160 | { |
---|
3161 | if (upgrade_pu.IsDestroyed) damage.Stop(); |
---|
3162 | if (upgrade_pu.IsVisible) upgrade_pu.IsVisible = false; |
---|
3163 | else upgrade_pu.IsVisible = true; |
---|
3164 | }; |
---|
3165 | |
---|
3166 | Add(upgrade_pu, 2); |
---|
3167 | damage.Start(); |
---|
3168 | |
---|
3169 | if (drd_level.Value == 1) |
---|
3170 | { |
---|
3171 | if (drd_type == 0) droid(new Vector(-45, 0)); |
---|
3172 | else if (drd_type == 1) droid(new Vector(40,0)); |
---|
3173 | } |
---|
3174 | else if (drd_level.Value == 2) |
---|
3175 | { |
---|
3176 | if (drd_type == 0) |
---|
3177 | { |
---|
3178 | droid(new Vector(-45, 30)); |
---|
3179 | droid(new Vector(-45, -30)); |
---|
3180 | } |
---|
3181 | else if (drd_type == 1) |
---|
3182 | { |
---|
3183 | droid(new Vector(-10, 35)); |
---|
3184 | droid(new Vector(-10, -35)); |
---|
3185 | } |
---|
3186 | } |
---|
3187 | else if (drd_level.Value == 3) |
---|
3188 | { |
---|
3189 | if (drd_type == 0) |
---|
3190 | { |
---|
3191 | droid(new Vector(-30, 30)); |
---|
3192 | droid(new Vector(-30, -30)); |
---|
3193 | droid(new Vector(-50, 0)); |
---|
3194 | } |
---|
3195 | else if (drd_type == 1) |
---|
3196 | { |
---|
3197 | droid(new Vector(40, 0)); |
---|
3198 | droid(new Vector(-10, 35)); |
---|
3199 | droid(new Vector(-10, -35)); |
---|
3200 | } |
---|
3201 | } |
---|
3202 | else if (drd_level.Value == 4) |
---|
3203 | { |
---|
3204 | if (drd_type == 0) |
---|
3205 | { |
---|
3206 | droid(new Vector(-30, 50)); |
---|
3207 | droid(new Vector(-30, -50)); |
---|
3208 | droid(new Vector(-50, 30)); |
---|
3209 | droid(new Vector(-50, -30)); |
---|
3210 | } |
---|
3211 | else if (drd_type == 1) |
---|
3212 | { |
---|
3213 | droid(new Vector(-30, 55)); |
---|
3214 | droid(new Vector(-30, -55)); |
---|
3215 | droid(new Vector(-10, 35)); |
---|
3216 | droid(new Vector(-10, -35)); |
---|
3217 | } |
---|
3218 | } |
---|
3219 | |
---|
3220 | |
---|
3221 | } |
---|
3222 | |
---|
3223 | #endregion |
---|
3224 | |
---|
3225 | #region Misc/Colliders |
---|
3226 | |
---|
3227 | void destroy(PhysicsObject p, PhysicsObject target) |
---|
3228 | { |
---|
3229 | p.Destroy(); |
---|
3230 | } |
---|
3231 | void damagePlayerEnemyShip(enemy b, player p) |
---|
3232 | { |
---|
3233 | p.health.Value = p.health.Value - 5; |
---|
3234 | if (p.health <= 0) |
---|
3235 | { |
---|
3236 | explosionsfx.Play(); |
---|
3237 | explosion_animation2(playership); |
---|
3238 | playership.Destroy(); |
---|
3239 | } |
---|
3240 | b.Destroy(); |
---|
3241 | hurtsfx.Play(); |
---|
3242 | explosionsfx.Play(); |
---|
3243 | explosion_animation(b); |
---|
3244 | } |
---|
3245 | void damagePlayerEnemyShip2(enemy b, player p) |
---|
3246 | { |
---|
3247 | p.health.Value = p.health.Value - 5; |
---|
3248 | if (p.health <= 0) |
---|
3249 | { |
---|
3250 | explosionsfx.Play(); |
---|
3251 | explosion_animation2(playership); |
---|
3252 | playership.Destroy(); |
---|
3253 | } |
---|
3254 | hurtsfx.Play(); |
---|
3255 | } |
---|
3256 | void damagePlayerBossShip(boss b, player p) |
---|
3257 | { |
---|
3258 | p.health.Value = 0; |
---|
3259 | explosionsfx.Play(); |
---|
3260 | explosion_animation2(playership); |
---|
3261 | playership.Destroy(); |
---|
3262 | hurtsfx.Play(); |
---|
3263 | } |
---|
3264 | void damagePlayerBullet(bullet b, player p) |
---|
3265 | { |
---|
3266 | p.health.Value = p.health.Value - b.damage; |
---|
3267 | if (p.health <= 0) |
---|
3268 | { |
---|
3269 | explosion_animation2(playership); |
---|
3270 | playership.Destroy(); |
---|
3271 | explosionsfx.Play(); |
---|
3272 | } |
---|
3273 | b.Destroy(); |
---|
3274 | hurtsfx.Play(); |
---|
3275 | } |
---|
3276 | void damageEnemy(bullet b, enemy e) |
---|
3277 | { |
---|
3278 | e.health.Value = e.health.Value - b.damage; |
---|
3279 | if (e.health.Value <= 0 && e.IsVisible) |
---|
3280 | { |
---|
3281 | e.IsVisible = false; |
---|
3282 | powerup(e.Position); |
---|
3283 | explosionsfx.Play(); |
---|
3284 | explosion_animation(e); |
---|
3285 | }; |
---|
3286 | hitsfx.Play(); |
---|
3287 | b.Destroy(); |
---|
3288 | |
---|
3289 | } |
---|
3290 | void damageBoss(boss b, bullet bullet) |
---|
3291 | { |
---|
3292 | if (bullet.Tag == "player_bullet") |
---|
3293 | { |
---|
3294 | bullet.Destroy(); |
---|
3295 | b.health.Value = b.health.Value - bullet.damage; |
---|
3296 | if (b.health.Value <= 0 && !b001 && b.Image == boss_ship_01) |
---|
3297 | { |
---|
3298 | b001 = true; |
---|
3299 | explosion_animation_boss(b); |
---|
3300 | |
---|
3301 | Timer fade = new Timer(); |
---|
3302 | fade.Interval = 0.03; |
---|
3303 | fade.Timeout += delegate |
---|
3304 | { |
---|
3305 | MediaPlayer.Volume = MediaPlayer.Volume - 0.1; |
---|
3306 | if (MediaPlayer.Volume == 0) |
---|
3307 | { |
---|
3308 | fade.Stop(); |
---|
3309 | } |
---|
3310 | }; |
---|
3311 | fade.Start(); |
---|
3312 | |
---|
3313 | stage_clear = new GameObject(290, 39); |
---|
3314 | stage_clear.Image = stage_1_clear; |
---|
3315 | stage_clear.Position = cntr; |
---|
3316 | |
---|
3317 | Timer stageclr = new Timer(); |
---|
3318 | stageclr.Interval = 0.8; |
---|
3319 | stageclr.Timeout += delegate |
---|
3320 | { |
---|
3321 | if (stage_clear.IsVisible) stage_clear.IsVisible = false; |
---|
3322 | else stage_clear.IsVisible = true; |
---|
3323 | }; |
---|
3324 | |
---|
3325 | Timer wait = new Timer(); |
---|
3326 | wait.Interval = 1; |
---|
3327 | wait.Timeout += delegate |
---|
3328 | { |
---|
3329 | Add(stage_clear, 3); |
---|
3330 | stageclr.Start(); |
---|
3331 | SoundEffect.MasterVolume = 0.2; |
---|
3332 | MediaPlayer.Stop(); |
---|
3333 | MediaPlayer.Volume = 1; |
---|
3334 | MediaPlayer.IsRepeating = false; |
---|
3335 | player.health.Value = player.health.MaxValue; |
---|
3336 | MediaPlayer.Play("Stage Clear"); |
---|
3337 | |
---|
3338 | ControllerOne.Listen(Button.Start, ButtonState.Pressed, nextlevel, null); |
---|
3339 | }; |
---|
3340 | |
---|
3341 | wait.Start(1); |
---|
3342 | } |
---|
3343 | else if (b.health.Value <= 0 && !b002 && b.Image == boss_ship_02) |
---|
3344 | { |
---|
3345 | b002 = true; |
---|
3346 | |
---|
3347 | explosion_animation_boss(b); |
---|
3348 | |
---|
3349 | Timer fade = new Timer(); |
---|
3350 | fade.Interval = 0.03; |
---|
3351 | fade.Timeout += delegate |
---|
3352 | { |
---|
3353 | MediaPlayer.Volume = MediaPlayer.Volume - 0.1; |
---|
3354 | if (MediaPlayer.Volume == 0) |
---|
3355 | { |
---|
3356 | fade.Stop(); |
---|
3357 | } |
---|
3358 | }; |
---|
3359 | fade.Start(); |
---|
3360 | |
---|
3361 | stage_clear = new GameObject(290, 39); |
---|
3362 | stage_clear.Image = stage_2_clear; |
---|
3363 | stage_clear.Position = cntr; |
---|
3364 | |
---|
3365 | Timer stageclr = new Timer(); |
---|
3366 | stageclr.Interval = 0.8; |
---|
3367 | stageclr.Timeout += delegate |
---|
3368 | { |
---|
3369 | if (stage_clear.IsVisible) stage_clear.IsVisible = false; |
---|
3370 | else stage_clear.IsVisible = true; |
---|
3371 | }; |
---|
3372 | |
---|
3373 | Timer wait = new Timer(); |
---|
3374 | wait.Interval = 1; |
---|
3375 | wait.Timeout += delegate |
---|
3376 | { |
---|
3377 | Add(stage_clear, 3); |
---|
3378 | stageclr.Start(); |
---|
3379 | SoundEffect.MasterVolume = 0.2; |
---|
3380 | MediaPlayer.Stop(); |
---|
3381 | MediaPlayer.Volume = 1; |
---|
3382 | MediaPlayer.IsRepeating = false; |
---|
3383 | player.health.Value = player.health.MaxValue; |
---|
3384 | MediaPlayer.Play("Stage Clear"); |
---|
3385 | |
---|
3386 | ControllerOne.Listen(Button.Start, ButtonState.Pressed, nextlevel, null); |
---|
3387 | }; |
---|
3388 | |
---|
3389 | wait.Start(1); |
---|
3390 | } |
---|
3391 | else if (b.health.Value <= 0 && !b003 && b.Image == boss_ship_03) |
---|
3392 | { |
---|
3393 | b003 = true; |
---|
3394 | |
---|
3395 | explosion_animation_boss(b); |
---|
3396 | |
---|
3397 | Timer fade = new Timer(); |
---|
3398 | fade.Interval = 0.03; |
---|
3399 | fade.Timeout += delegate |
---|
3400 | { |
---|
3401 | MediaPlayer.Volume = MediaPlayer.Volume - 0.1; |
---|
3402 | if (MediaPlayer.Volume == 0) |
---|
3403 | { |
---|
3404 | fade.Stop(); |
---|
3405 | } |
---|
3406 | }; |
---|
3407 | fade.Start(); |
---|
3408 | |
---|
3409 | stage_clear = new GameObject(271, 35); |
---|
3410 | stage_clear.Image = stage_3_clear; |
---|
3411 | stage_clear.Position = cntr; |
---|
3412 | |
---|
3413 | Timer stageclr = new Timer(); |
---|
3414 | stageclr.Interval = 0.8; |
---|
3415 | stageclr.Timeout += delegate |
---|
3416 | { |
---|
3417 | if (stage_clear.IsVisible) stage_clear.IsVisible = false; |
---|
3418 | else stage_clear.IsVisible = true; |
---|
3419 | }; |
---|
3420 | |
---|
3421 | Timer wait = new Timer(); |
---|
3422 | wait.Interval = 1; |
---|
3423 | wait.Timeout += delegate |
---|
3424 | { |
---|
3425 | Add(stage_clear, 3); |
---|
3426 | stageclr.Start(); |
---|
3427 | SoundEffect.MasterVolume = 0.2; |
---|
3428 | MediaPlayer.Stop(); |
---|
3429 | MediaPlayer.Volume = 1; |
---|
3430 | MediaPlayer.IsRepeating = false; |
---|
3431 | player.health.Value = player.health.MaxValue; |
---|
3432 | MediaPlayer.Play("Stage Clear"); |
---|
3433 | |
---|
3434 | ControllerOne.Listen(Button.Start, ButtonState.Pressed, nextlevel, null); |
---|
3435 | }; |
---|
3436 | |
---|
3437 | wait.Start(1); |
---|
3438 | } |
---|
3439 | else if (b.health.Value <= 0 && !b004 && b.Image == boss_ship_ajnator) |
---|
3440 | { |
---|
3441 | b004 = true; |
---|
3442 | |
---|
3443 | explosion_animation_boss(b); |
---|
3444 | |
---|
3445 | Timer fade = new Timer(); |
---|
3446 | fade.Interval = 0.03; |
---|
3447 | fade.Timeout += delegate |
---|
3448 | { |
---|
3449 | MediaPlayer.Volume = MediaPlayer.Volume - 0.1; |
---|
3450 | if (MediaPlayer.Volume == 0) |
---|
3451 | { |
---|
3452 | fade.Stop(); |
---|
3453 | } |
---|
3454 | }; |
---|
3455 | fade.Start(); |
---|
3456 | |
---|
3457 | stage_clear = new GameObject(272, 35); |
---|
3458 | stage_clear.Image = congratulations; |
---|
3459 | stage_clear.Position = cntr; |
---|
3460 | |
---|
3461 | Timer stageclr = new Timer(); |
---|
3462 | stageclr.Interval = 0.8; |
---|
3463 | stageclr.Timeout += delegate |
---|
3464 | { |
---|
3465 | if (stage_clear.IsVisible) stage_clear.IsVisible = false; |
---|
3466 | else stage_clear.IsVisible = true; |
---|
3467 | }; |
---|
3468 | |
---|
3469 | Timer wait = new Timer(); |
---|
3470 | wait.Interval = 1; |
---|
3471 | wait.Timeout += delegate |
---|
3472 | { |
---|
3473 | Add(stage_clear, 3); |
---|
3474 | stageclr.Start(); |
---|
3475 | SoundEffect.MasterVolume = 0.2; |
---|
3476 | MediaPlayer.Stop(); |
---|
3477 | MediaPlayer.Volume = 1; |
---|
3478 | MediaPlayer.IsRepeating = false; |
---|
3479 | player.health.Value = player.health.MaxValue; |
---|
3480 | MediaPlayer.Play("Simon"); |
---|
3481 | }; |
---|
3482 | |
---|
3483 | wait.Start(1); |
---|
3484 | } |
---|
3485 | |
---|
3486 | hitsfx.Stop(); |
---|
3487 | hitsfx.Play(); |
---|
3488 | } |
---|
3489 | } |
---|
3490 | void explosion_animation(enemy enemyship) |
---|
3491 | { |
---|
3492 | GameObject explosion = new GameObject(enemyship.explosion_scale, enemyship.explosion_scale); |
---|
3493 | explosion.Position = enemyship.Position; |
---|
3494 | explosion.Animation = explosion_anim; |
---|
3495 | explosion.MaximumLifetime = TimeSpan.FromSeconds(0.2); |
---|
3496 | Add(explosion,-1); |
---|
3497 | explosion.Animation.Start(1); |
---|
3498 | } |
---|
3499 | void explosion_animation_boss(boss enemyship) |
---|
3500 | { |
---|
3501 | GameObject explosion = new GameObject(enemyship.explosion_scale, enemyship.explosion_scale); |
---|
3502 | explosion.Position = enemyship.Position; |
---|
3503 | explosion.Animation = explosion_anim; |
---|
3504 | explosion.MaximumLifetime = TimeSpan.FromSeconds(0.2); |
---|
3505 | Add(explosion, -1); |
---|
3506 | explosion.Animation.Start(1); |
---|
3507 | } |
---|
3508 | void explosion_animation2(PhysicsObject plr) |
---|
3509 | { |
---|
3510 | GameObject explosion = new GameObject(80,80); |
---|
3511 | explosion.Position = plr.Position; |
---|
3512 | explosion.Animation = explosion_anim; |
---|
3513 | explosion.MaximumLifetime = TimeSpan.FromSeconds(0.2); |
---|
3514 | Add(explosion, -1); |
---|
3515 | explosion.Animation.Start(1); |
---|
3516 | |
---|
3517 | Timer wait = new Timer(); |
---|
3518 | wait.Interval = 1; |
---|
3519 | wait.Timeout += delegate |
---|
3520 | { |
---|
3521 | SoundEffect.MasterVolume = 0.2; |
---|
3522 | MediaPlayer.IsRepeating = false; |
---|
3523 | MediaPlayer.Play("Player_down"); |
---|
3524 | |
---|
3525 | MultiSelectWindow gameover = new MultiSelectWindow("Game Over", "Quit"); |
---|
3526 | gameover.ItemSelected += select_gameover; |
---|
3527 | Add(gameover); |
---|
3528 | }; |
---|
3529 | wait.Start(1); |
---|
3530 | |
---|
3531 | } |
---|
3532 | void select_gameover(int selection) |
---|
3533 | { |
---|
3534 | switch (selection) |
---|
3535 | { |
---|
3536 | case 0: |
---|
3537 | ConfirmExit(); |
---|
3538 | break; |
---|
3539 | } |
---|
3540 | } |
---|
3541 | |
---|
3542 | void nextlevel() |
---|
3543 | { |
---|
3544 | ClearControls(); |
---|
3545 | hide_player(); |
---|
3546 | Timer.SingleShot(0.5, ClearGameObjects); |
---|
3547 | |
---|
3548 | if (currentlevel == "level_01") |
---|
3549 | { |
---|
3550 | SoundEffect.MasterVolume = 0.8; |
---|
3551 | healthBar.Destroy(); |
---|
3552 | |
---|
3553 | selectsfx.Play(); |
---|
3554 | stage_clear.Destroy(); |
---|
3555 | |
---|
3556 | Timer fade = new Timer(); |
---|
3557 | fade.Interval = 0.03; |
---|
3558 | fade.Timeout += delegate |
---|
3559 | { |
---|
3560 | MediaPlayer.Volume = MediaPlayer.Volume - 0.1; |
---|
3561 | if (MediaPlayer.Volume == 0) |
---|
3562 | { |
---|
3563 | fade.Stop(); |
---|
3564 | MediaPlayer.Stop(); |
---|
3565 | MediaPlayer.Volume = 1; |
---|
3566 | } |
---|
3567 | }; |
---|
3568 | fade.Start(); |
---|
3569 | |
---|
3570 | black = new GameObject(Screen.Width, Screen.Height); |
---|
3571 | black.Position = cntr; |
---|
3572 | black.Color = Color.Transparent; |
---|
3573 | |
---|
3574 | Add(black, 2); |
---|
3575 | black.FadeColorTo(Color.Black, 0.5); |
---|
3576 | |
---|
3577 | |
---|
3578 | Timer wait = new Timer(); |
---|
3579 | wait.Interval = 1; |
---|
3580 | wait.Timeout += delegate |
---|
3581 | { |
---|
3582 | drd_level.Value = 0; |
---|
3583 | wpn_damageRatio.Value = 1; |
---|
3584 | wpn_spread.Value = 1; |
---|
3585 | |
---|
3586 | bg.Image = stage2_bg; |
---|
3587 | bg2.Image = stage2_bg; |
---|
3588 | ClearControls(); |
---|
3589 | |
---|
3590 | currentlevel = "level_02"; |
---|
3591 | CreateLevel(currentlevel); |
---|
3592 | |
---|
3593 | GameObject stage_02_start = new GameObject(405, 39); |
---|
3594 | stage_02_start.Position = cntr; |
---|
3595 | stage_02_start.Image = stage_2_start; |
---|
3596 | Add(stage_02_start, 3); |
---|
3597 | |
---|
3598 | black = new GameObject(Screen.Width, Screen.Height); |
---|
3599 | black.Position = cntr; |
---|
3600 | black.Color = Color.Black; |
---|
3601 | Add(black, 2); |
---|
3602 | |
---|
3603 | double i = 0; |
---|
3604 | Timer start = new Timer(); |
---|
3605 | start.Interval = 0.1; |
---|
3606 | start.Timeout += delegate |
---|
3607 | { |
---|
3608 | i++; |
---|
3609 | if (i >= 15) stage_02_start.Destroy(); |
---|
3610 | if (stage_02_start.IsVisible) stage_02_start.IsVisible = false; |
---|
3611 | else stage_02_start.IsVisible = true; |
---|
3612 | }; |
---|
3613 | Pause(); |
---|
3614 | start.Start(15); |
---|
3615 | ControllerOne.Listen(Button.Start, ButtonState.Pressed, start_02, null); |
---|
3616 | }; |
---|
3617 | wait.Start(1); |
---|
3618 | } |
---|
3619 | else if (currentlevel == "level_02") |
---|
3620 | { |
---|
3621 | SoundEffect.MasterVolume = 0.8; |
---|
3622 | healthBar.Destroy(); |
---|
3623 | |
---|
3624 | selectsfx.Play(); |
---|
3625 | stage_clear.Destroy(); |
---|
3626 | |
---|
3627 | Timer fade = new Timer(); |
---|
3628 | fade.Interval = 0.03; |
---|
3629 | fade.Timeout += delegate |
---|
3630 | { |
---|
3631 | MediaPlayer.Volume = MediaPlayer.Volume - 0.1; |
---|
3632 | if (MediaPlayer.Volume == 0) |
---|
3633 | { |
---|
3634 | fade.Stop(); |
---|
3635 | MediaPlayer.Stop(); |
---|
3636 | MediaPlayer.Volume = 1; |
---|
3637 | } |
---|
3638 | }; |
---|
3639 | fade.Start(); |
---|
3640 | |
---|
3641 | black = new GameObject(Screen.Width, Screen.Height); |
---|
3642 | black.Position = cntr; |
---|
3643 | black.Color = Color.Transparent; |
---|
3644 | |
---|
3645 | Add(black, 2); |
---|
3646 | black.FadeColorTo(Color.Black, 0.5); |
---|
3647 | |
---|
3648 | |
---|
3649 | Timer wait = new Timer(); |
---|
3650 | wait.Interval = 1; |
---|
3651 | wait.Timeout += delegate |
---|
3652 | { |
---|
3653 | drd_level.Value = 0; |
---|
3654 | wpn_damageRatio.Value = 1; |
---|
3655 | wpn_spread.Value = 1; |
---|
3656 | |
---|
3657 | bg.Image = stage2_bg; |
---|
3658 | bg2.Image = stage2_bg; |
---|
3659 | ClearControls(); |
---|
3660 | |
---|
3661 | currentlevel = "level_03"; |
---|
3662 | CreateLevel(currentlevel); |
---|
3663 | |
---|
3664 | GameObject stage_03_start = new GameObject(405, 39); |
---|
3665 | stage_03_start.Position = cntr; |
---|
3666 | stage_03_start.Image = stage_3_start; |
---|
3667 | Add(stage_03_start, 3); |
---|
3668 | |
---|
3669 | black = new GameObject(Screen.Width, Screen.Height); |
---|
3670 | black.Position = cntr; |
---|
3671 | black.Color = Color.Black; |
---|
3672 | Add(black, 2); |
---|
3673 | |
---|
3674 | double i = 0; |
---|
3675 | Timer start = new Timer(); |
---|
3676 | start.Interval = 0.1; |
---|
3677 | start.Timeout += delegate |
---|
3678 | { |
---|
3679 | i++; |
---|
3680 | if (i >= 15) stage_03_start.Destroy(); |
---|
3681 | if (stage_03_start.IsVisible) stage_03_start.IsVisible = false; |
---|
3682 | else stage_03_start.IsVisible = true; |
---|
3683 | }; |
---|
3684 | Pause(); |
---|
3685 | start.Start(15); |
---|
3686 | ControllerOne.Listen(Button.Start, ButtonState.Pressed, start_03, null); |
---|
3687 | }; |
---|
3688 | wait.Start(1); |
---|
3689 | } |
---|
3690 | else if (currentlevel == "level_03") |
---|
3691 | { |
---|
3692 | SoundEffect.MasterVolume = 0.8; |
---|
3693 | healthBar.Destroy(); |
---|
3694 | |
---|
3695 | selectsfx.Play(); |
---|
3696 | stage_clear.Destroy(); |
---|
3697 | |
---|
3698 | Timer fade = new Timer(); |
---|
3699 | fade.Interval = 0.03; |
---|
3700 | fade.Timeout += delegate |
---|
3701 | { |
---|
3702 | MediaPlayer.Volume = MediaPlayer.Volume - 0.1; |
---|
3703 | if (MediaPlayer.Volume == 0) |
---|
3704 | { |
---|
3705 | fade.Stop(); |
---|
3706 | MediaPlayer.Stop(); |
---|
3707 | MediaPlayer.Volume = 1; |
---|
3708 | } |
---|
3709 | }; |
---|
3710 | fade.Start(); |
---|
3711 | |
---|
3712 | black = new GameObject(Screen.Width, Screen.Height); |
---|
3713 | black.Position = cntr; |
---|
3714 | black.Color = Color.Transparent; |
---|
3715 | |
---|
3716 | Add(black, 2); |
---|
3717 | black.FadeColorTo(Color.Black, 0.5); |
---|
3718 | |
---|
3719 | |
---|
3720 | Timer wait = new Timer(); |
---|
3721 | wait.Interval = 1; |
---|
3722 | wait.Timeout += delegate |
---|
3723 | { |
---|
3724 | drd_level.Value = 0; |
---|
3725 | wpn_damageRatio.Value = 1; |
---|
3726 | wpn_spread.Value = 1; |
---|
3727 | |
---|
3728 | bg.Image = stage_aj; |
---|
3729 | bg2.Image = stage_aj; |
---|
3730 | ClearControls(); |
---|
3731 | |
---|
3732 | currentlevel = "level_04"; |
---|
3733 | CreateLevel(currentlevel); |
---|
3734 | |
---|
3735 | GameObject stage_03_start = new GameObject(369, 35); |
---|
3736 | stage_03_start.Position = cntr; |
---|
3737 | stage_03_start.Image = bonus_stage_start; |
---|
3738 | Add(stage_03_start, 3); |
---|
3739 | |
---|
3740 | black = new GameObject(Screen.Width, Screen.Height); |
---|
3741 | black.Position = cntr; |
---|
3742 | black.Color = Color.Black; |
---|
3743 | Add(black, 2); |
---|
3744 | |
---|
3745 | double i = 0; |
---|
3746 | Timer start = new Timer(); |
---|
3747 | start.Interval = 0.1; |
---|
3748 | start.Timeout += delegate |
---|
3749 | { |
---|
3750 | i++; |
---|
3751 | if (i >= 15) stage_03_start.Destroy(); |
---|
3752 | if (stage_03_start.IsVisible) stage_03_start.IsVisible = false; |
---|
3753 | else stage_03_start.IsVisible = true; |
---|
3754 | }; |
---|
3755 | Pause(); |
---|
3756 | start.Start(15); |
---|
3757 | ControllerOne.Listen(Button.Start, ButtonState.Pressed, start_04, null); |
---|
3758 | }; |
---|
3759 | wait.Start(1); |
---|
3760 | } |
---|
3761 | } |
---|
3762 | #endregion |
---|
3763 | } |
---|