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