- Timestamp:
- 2013-06-27 15:00:58 (10 years ago)
- Location:
- 2013/26/OtsoR/Projekti/Projekti
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2013/26/OtsoR/Projekti/Projekti/Projekti/Projekti.cs
r4250 r4278 6 6 using Jypeli.Effects; 7 7 using Jypeli.Widgets; 8 class Player : PhysicsObject 8 9 public class Player : PhysicsObject 9 10 { 10 11 private IntMeter health = new IntMeter(100, 0, 100); 11 12 public IntMeter Health { get { return health; } } 13 public Color Color1; 14 public Color Color2; 15 16 public Image cannonImage; 12 17 13 18 public Player(double width, double height, Shape shape) … … 31 36 private IntMeter health = new IntMeter(5, 0, 5); 32 37 public IntMeter Health { get { return health; } } 33 38 34 39 public Enemy(double leveys, double korkeus, Shape muoto) 35 40 : base(leveys, korkeus, muoto) … … 40 45 enemyhealth.Angle = Angle.RightAngle; 41 46 Add(enemyhealth); 42 health.LowerLimit += delegate { 47 health.LowerLimit += delegate 48 { 43 49 this.Destroy(); 44 50 }; 45 51 } 46 52 } 47 class B oss: PhysicsObject53 class BigEnemy : PhysicsObject 48 54 { 49 55 private IntMeter health = new IntMeter(100, 0, 100); 50 56 public IntMeter Health { get { return health; } } 51 57 52 public B oss(double leveys, double korkeus, Shape muoto)58 public BigEnemy(double leveys, double korkeus, Shape muoto) 53 59 : base(leveys, korkeus, muoto) 54 60 { … … 58 64 enemyhealth.Angle = Angle.RightAngle; 59 65 Add(enemyhealth); 60 health.LowerLimit += delegate { 66 health.LowerLimit += delegate 67 { 61 68 this.Destroy(); 62 69 }; … … 66 73 { 67 74 Image[] shipimages = new Image[100]; 68 Color[] shipcolors = { Color.DarkGray, Color.Silver, Color.DarkOrange, Color. Ultramarine };69 Color[] shipcolors2 = { Color.Ruby, Color.Azure, Color.Emerald, Color. Emerald};70 Image miniboss = LoadImage("miniboss");75 Color[] shipcolors = { Color.DarkGray, Color.Silver, Color.DarkOrange, Color.Blue }; 76 Color[] shipcolors2 = { Color.Ruby, Color.Azure, Color.Emerald, Color.Orange }; 77 Image bigenemy = LoadImage("bigenemy"); 71 78 Image shell = LoadImage("bullet"); 72 79 Image pointer = LoadImage("pointer"); 73 80 Image rdamage = LoadImage("rdamage"); 74 81 Image rrepair = LoadImage("rrepair"); 75 76 String[] weaponnames = { "projectile","laser","plasma" }; 82 Image homing = LoadImage("missile"); 83 84 String[] weaponnames = { "projectile", "laser", "plasma", "missile" }; 77 85 78 86 PhysicsObject topedge; … … 80 88 PhysicsObject leftedge; 81 89 PhysicsObject rightedge; 82 83 Player ship ;90 91 Player ship1; 84 92 Weapon weapon; 85 93 Player ship2; … … 88 96 Weapon hostilew; 89 97 GameObject line; 98 PhysicsObject ammus; 90 99 91 100 Label number; … … 94 103 Label weaponlabel; 95 104 Label weaponlabel2; 96 Widget Aluskuva;97 Widget Aluskuva2;105 Widget aluskuva; 106 Widget aluskuva2; 98 107 IntMeter shipimg; 99 IntMeter shipcolor ;108 IntMeter shipcolor1; 100 109 IntMeter shipwpn; 101 110 IntMeter shipimg2; 102 111 IntMeter shipcolor2; 103 IntMeter ship wpn2;112 IntMeter shipWeapon2; 104 113 int shipcounter; 105 114 int bigshipcounter; … … 110 119 for (int i = 1; i <= 100; i++) 111 120 { 112 shipimages[i -1] = LoadImage("s"+i);121 shipimages[i - 1] = LoadImage("s" + i); 113 122 } 114 123 IsMouseVisible = true; … … 134 143 } 135 144 } 145 136 146 void singleplayer() 137 147 { 138 Aluskuva = new Widget(50, 50);139 Aluskuva.X = 0;140 Aluskuva.Y = 250;141 Aluskuva.Image = shipimages[0];142 Add( Aluskuva);148 aluskuva = new Widget(50, 50); 149 aluskuva.X = 0; 150 aluskuva.Y = 250; 151 aluskuva.Image = shipimages[0]; 152 Add(aluskuva); 143 153 144 154 shipimg = new IntMeter(1, 1, 100); 145 shipimg.Changed += Changeship ;146 shipwpn = new IntMeter(1, 1, 3);155 shipimg.Changed += Changeship1; 156 shipwpn = new IntMeter(1, 1, 4); 147 157 shipwpn.Changed += delegate { weaponlabel.Text = weaponnames[shipwpn.Value - 1]; }; 148 shipcolor = new IntMeter(1, 1, 4);149 shipcolor .Changed += Changeship;158 shipcolor1 = new IntMeter(0, 0, 3); 159 shipcolor1.Changed += Changeship1; 150 160 151 161 number = new Label(); … … 172 182 shipcolour.X = -125; 173 183 shipcolour.Y = 150; 174 shipcolour.BindTo(shipcolor );184 shipcolour.BindTo(shipcolor1); 175 185 Slider shipweapon = new Slider(125, 15); 176 186 shipweapon.X = 125; … … 194 204 Mouse.ListenOn(kohta1, MouseButton.Left, ButtonState.Pressed, singleplayerbase, null); 195 205 } 196 void Changeship(int vanha, int uusi) 197 { 198 Aluskuva.Image = shipimages[shipimg.Value-1].Clone(); 199 Aluskuva.Image.ReplaceColor(Color.White, shipcolors[shipcolor.Value - 1]); 200 Aluskuva.Image.ReplaceColor(Color.Black, shipcolors2[shipcolor.Value - 1]); 206 207 void Changeship1(int vanha, int uusi) 208 { 209 aluskuva.Image = shipimages[shipimg.Value - 1].Clone(); 210 aluskuva.Image.ReplaceColor(Color.White, shipcolors[shipcolor1.Value]); 211 aluskuva.Image.ReplaceColor(Color.Black, shipcolors2[shipcolor1.Value]); 201 212 } 202 213 void Changeship2(int vanha, int uusi) 203 214 { 204 Aluskuva2.Image = shipimages[shipimg2.Value - 1].Clone(); 205 Aluskuva2.Image.ReplaceColor(Color.White, shipcolors[shipcolor2.Value - 1]); 206 Aluskuva2.Image.ReplaceColor(Color.Black, shipcolors2[shipcolor2.Value - 1]); 207 } 215 aluskuva2.Image = shipimages[shipimg2.Value - 1].Clone(); 216 aluskuva2.Image.ReplaceColor(Color.White, shipcolors[shipcolor2.Value]); 217 aluskuva2.Image.ReplaceColor(Color.Black, shipcolors2[shipcolor2.Value]); 218 } 219 208 220 void Createship(double x, double y) 209 221 { 210 ship = new Player(16, 16, Shape.FromImage(Aluskuva.Image)); 211 ship.Image = Aluskuva.Image; 212 ship.Restitution = 1.0; 213 ship.X = x; 214 ship.Y = y; 215 ship.KineticFriction = 0.0; 216 ship.MomentOfInertia = Double.PositiveInfinity; 217 ship.LinearDamping = 0.95; 218 ship.AngularDamping = 0.95; 219 Add(ship); 222 ship1 = new Player(14, 14, Shape.FromImage(aluskuva.Image)); 223 ship1.Image = aluskuva.Image; 224 225 ship1.Restitution = 1.0; 226 ship1.Color1 = shipcolors[shipcolor1.Value]; 227 ship1.Color2 = shipcolors2[shipcolor1.Value]; 228 ship1.cannonImage = LoadImage("missile"); 229 ship1.cannonImage.ReplaceColor(Color.White, ship1.Color1); 230 ship1.cannonImage.ReplaceColor(Color.Black, ship1.Color2); 231 232 ship1.X = x; 233 ship1.Y = y; 234 ship1.KineticFriction = 0.0; 235 ship1.MomentOfInertia = Double.PositiveInfinity; 236 ship1.LinearDamping = 0.95; 237 ship1.AngularDamping = 0.95; 238 Add(ship1); 220 239 choice(shipwpn.Value); 221 ship .Add(weapon);222 ship .CollisionIgnoreGroup = 1;223 ship .Tag = "player";224 ship .Destroyed += playerdeath;240 ship1.Add(weapon); 241 ship1.CollisionIgnoreGroup = 1; 242 ship1.Tag = "player"; 243 ship1.Destroyed += playerdeath; 225 244 if (weapon is LaserGun) 226 245 { … … 228 247 line.Image = pointer; 229 248 line.X = 2500; 230 ship .Add(line);249 ship1.Add(line); 231 250 } 232 251 } 233 252 void Createship2(double x, double y) 234 253 { 235 ship2 = new Player(1 6, 16, Shape.FromImage(Aluskuva2.Image));236 ship2.Image = Aluskuva2.Image;254 ship2 = new Player(14, 14, Shape.FromImage(aluskuva2.Image)); 255 ship2.Image = aluskuva2.Image; 237 256 ship2.X = x; 238 257 ship2.Y = y; 258 ship2.Color1 = shipcolors[shipcolor2.Value]; 259 ship2.Color2 = shipcolors2[shipcolor2.Value]; 260 ship2.cannonImage = LoadImage("missile"); 261 ship2.cannonImage.ReplaceColor(Color.White, ship2.Color1); 262 ship2.cannonImage.ReplaceColor(Color.Black, ship2.Color2); 263 239 264 ship2.Restitution = 1.0; 240 265 ship2.KineticFriction = 0.0; … … 243 268 ship2.AngularDamping = 0.95; 244 269 Add(ship2); 245 choice2(ship wpn2.Value);270 choice2(shipWeapon2.Value); 246 271 ship2.Add(weapon2); 247 272 ship2.CollisionIgnoreGroup = 1; … … 253 278 line.Image = pointer; 254 279 line.X = 2500; 255 ship .Add(line);280 ship1.Add(line); 256 281 } 257 282 } 258 283 void Spawnhostiles() 259 284 { 260 while (shipcounter < 3 6)285 while (shipcounter < 39) 261 286 { 262 287 int hostileship = RandomGen.NextInt(0, 100); … … 296 321 void Createhostile(int randomship, double randomy, double randomx) 297 322 { 298 Enemy hostile = new Enemy(1 6, 16, Shape.FromImage(shipimages[randomship]));323 Enemy hostile = new Enemy(14, 14, Shape.FromImage(shipimages[randomship])); 299 324 hostile.Image = shipimages[randomship]; 300 325 hostile.Y = randomy; … … 318 343 hostilew.ProjectileCollision = delegate(PhysicsObject ammus, PhysicsObject kohde) { weaponhit(ammus, kohde, 10, 0); }; 319 344 hostilew.FireRate = 0.5; 320 hostilew.Power.DefaultValue = 20;321 hostilew.Power.Value = 20;345 hostilew.Power.DefaultValue = 15; 346 hostilew.Power.Value = 15; 322 347 hostile.Add(hostilew); 323 348 … … 327 352 brain.DistanceClose = 125; 328 353 brain.StopWhenTargetClose = false; 329 brain.TargetClose += delegate { fire(hostilew ); };354 brain.TargetClose += delegate { fire(hostilew, null); }; 330 355 brain.TurnWhileMoving = true; 331 356 hostile.Brain = brain; … … 333 358 void Createbighostile(double y, double x) 334 359 { 335 Enemy Big1 = new Enemy( 25, 29, Shape.FromImage(miniboss));336 Big1.Image = miniboss;360 Enemy Big1 = new Enemy(50, 28, Shape.FromImage(bigenemy)); 361 Big1.Image = bigenemy; 337 362 Big1.X = x; 338 363 Big1.Y = y; … … 351 376 Big1.Destroyed += bigenemydeath; 352 377 353 PlasmaCannon Big1w = new PlasmaCannon(0, 0);378 Cannon Big1w = new Cannon(0, 0); 354 379 Big1w.ProjectileCollision = delegate(PhysicsObject ammus, PhysicsObject kohde) { weaponhit(ammus, kohde, 3, 0); }; 355 Big1w.FireRate = 1.5; 356 Big1w.Power.DefaultValue = 300; 357 Big1w.Power.Value = 300; 380 Big1w.FireRate = 0.3; 381 Big1w.CanHitOwner = false; 382 Big1w.Power.DefaultValue = 1500; 383 Big1w.Power.Value = 1500; 358 384 Big1.Add(Big1w); 359 385 360 FollowerBrain bigbrain 1= new FollowerBrain("player");361 bigbrain 1.Speed = 15;362 bigbrain 1.DistanceFar = 10000;363 bigbrain 1.DistanceClose = 200;364 bigbrain 1.TurnSpeed = UnlimitedAngle.FromDegrees(10);365 bigbrain 1.StopWhenTargetClose = false;366 bigbrain 1.TargetClose += delegate { fire(Big1w); };367 bigbrain 1.TurnWhileMoving = true;368 Big1.Brain = bigbrain 1;386 FollowerBrain bigbrain = new FollowerBrain("player"); 387 bigbrain.Speed = 15; 388 bigbrain.DistanceFar = 10000; 389 bigbrain.DistanceClose = 325; 390 bigbrain.TurnSpeed = UnlimitedAngle.FromDegrees(25); 391 bigbrain.StopWhenTargetClose = false; 392 bigbrain.TargetClose += delegate { firehoming(Big1w); }; 393 bigbrain.TurnWhileMoving = true; 394 Big1.Brain = bigbrain; 369 395 } 370 396 void playerdeath() 371 397 { 372 MessageDisplay.Add(" A player's ship has been destroyed");398 MessageDisplay.Add("Ship lost"); 373 399 //MediaPlayer.Play("playerdeath"); 374 400 } … … 412 438 void coop() 413 439 { 414 Aluskuva = new Widget(50, 50);415 Aluskuva.X = -300;416 Aluskuva.Y = 250;417 Aluskuva.Image = shipimages[0];418 Add( Aluskuva);419 420 Aluskuva2 = new Widget(50, 50);421 Aluskuva2.X = 300;422 Aluskuva2.Y = 250;423 Aluskuva2.Image = shipimages[0];424 Add( Aluskuva2);440 aluskuva = new Widget(50, 50); 441 aluskuva.X = -300; 442 aluskuva.Y = 250; 443 aluskuva.Image = shipimages[0]; 444 Add(aluskuva); 445 446 aluskuva2 = new Widget(50, 50); 447 aluskuva2.X = 300; 448 aluskuva2.Y = 250; 449 aluskuva2.Image = shipimages[0]; 450 Add(aluskuva2); 425 451 426 452 shipimg = new IntMeter(1, 1, 100); 427 shipimg.Changed += Changeship ;428 shipwpn = new IntMeter(1, 1, 3);453 shipimg.Changed += Changeship1; 454 shipwpn = new IntMeter(1, 1, 4); 429 455 shipwpn.Changed += delegate { weaponlabel.Text = weaponnames[shipwpn.Value - 1]; }; 430 shipcolor = new IntMeter(1, 1, 4); 431 shipcolor.Changed += Changeship; 456 457 Slider shipColorP1 = new Slider(125, 15); 458 shipColorP1.X = -425; 459 shipColorP1.Y = 150; 460 shipcolor1 = new IntMeter(0, 0, 3); 461 shipcolor1.Changed += Changeship1; 462 shipColorP1.BindTo(shipcolor1); 463 464 Slider shipcolour2 = new Slider(125, 15); 465 shipcolour2.X = 225; 466 shipcolour2.Y = 150; 467 shipcolor2 = new IntMeter(0, 0, 3); 468 shipcolor2.Changed += Changeship2; 469 shipcolour2.BindTo(shipcolor2); 470 432 471 shipimg2 = new IntMeter(1, 1, 100); 433 472 shipimg2.Changed += Changeship2; 434 ship wpn2 = new IntMeter(1, 1, 3);435 ship wpn2.Changed += delegate { weaponlabel2.Text = weaponnames[shipwpn2.Value - 1]; };436 shipcolor2 = new IntMeter(1, 1, 4);437 shipcolor2.Changed += Changeship2;438 473 shipWeapon2 = new IntMeter(1, 1, 4); 474 shipWeapon2.Changed += delegate 475 { 476 weaponlabel2.Text = weaponnames[shipWeapon2.Value - 1]; 477 }; 439 478 number = new Label(); 440 479 number.BindTo(shipimg); … … 462 501 shiptype.Y = 200; 463 502 shiptype.BindTo(shipimg); 464 Slider shipcolour = new Slider(125, 15); 465 shipcolour.X = -425; 466 shipcolour.Y = 150; 467 shipcolour.BindTo(shipcolor); 503 468 504 Slider shipweapon = new Slider(125, 15); 469 505 shipweapon.X = -225; … … 475 511 shiptype2.Y = 200; 476 512 shiptype2.BindTo(shipimg2); 477 Slider shipcolour2 = new Slider(125, 15); 478 shipcolour2.X = 225; 479 shipcolour2.Y = 150; 480 shipcolour2.BindTo(shipcolor2); 513 481 514 Slider shipweapon2 = new Slider(125, 15); 482 515 shipweapon2.X = 425; 483 516 shipweapon2.Y = 150; 484 shipweapon2.BindTo(ship wpn2);517 shipweapon2.BindTo(shipWeapon2); 485 518 Add(shiptype); 486 Add(ship colour);519 Add(shipColorP1); 487 520 Add(shipweapon); 488 521 Add(shiptype2); … … 497 530 foreach (Label valikonKohta2 in valikonKohdat2) 498 531 { 499 Add(valikonKohta2);532 Add(valikonKohta2); 500 533 } 501 534 Mouse.ListenOn(kohta2, MouseButton.Left, ButtonState.Pressed, coopbase, null); … … 509 542 weapon.ProjectileCollision = delegate(PhysicsObject ammus, PhysicsObject kohde) { weaponhit(ammus, kohde, 0, 1); }; 510 543 weapon.FireRate = 4.5; 511 weapon.Power.Value = 100;512 weapon.Power.DefaultValue = 100;544 weapon.Power.Value = 25; 545 weapon.Power.DefaultValue = 25; 513 546 break; 514 547 case 2: … … 516 549 weapon.ProjectileCollision = delegate(PhysicsObject ammus, PhysicsObject kohde) { weaponhit(ammus, kohde, 0, 5); }; 517 550 weapon.FireRate = 0.8; 518 weapon.Power.DefaultValue = 100 0;519 weapon.Power.Value = 100 0;551 weapon.Power.DefaultValue = 100; 552 weapon.Power.Value = 100; 520 553 break; 521 554 case 3: … … 523 556 weapon.ProjectileCollision = delegate(PhysicsObject ammus, PhysicsObject kohde) { weaponhit(ammus, kohde, 0, 3); }; 524 557 weapon.FireRate = 1.5; 525 weapon.Power.Value = 750; 526 weapon.Power.DefaultValue = 750; 558 weapon.Power.Value = 400; 559 weapon.Power.DefaultValue = 400; 560 break; 561 case 4: 562 weapon = new Cannon(0, 0); 563 weapon.ProjectileCollision = delegate(PhysicsObject ammus, PhysicsObject kohde) { weaponhit(ammus, kohde, 0, 5); }; 564 weapon.FireRate = 0.8; 565 weapon.Power.DefaultValue = 1500; 566 weapon.Power.Value = 1500; 527 567 break; 528 568 } … … 536 576 weapon2.ProjectileCollision = delegate(PhysicsObject ammus, PhysicsObject kohde) { weaponhit(ammus, kohde, 0, 1); }; 537 577 weapon2.FireRate = 4.5; 538 weapon2.Power.Value = 100;539 weapon2.Power.DefaultValue = 100;578 weapon2.Power.Value = 25; 579 weapon2.Power.DefaultValue = 25; 540 580 break; 541 581 case 2: … … 550 590 weapon2.ProjectileCollision = delegate(PhysicsObject ammus, PhysicsObject kohde) { weaponhit(ammus, kohde, 0, 3); }; 551 591 weapon2.FireRate = 1.5; 552 weapon2.Power.Value = 750; 553 weapon2.Power.DefaultValue = 750; 554 break; 555 } 556 } 557 void fire(Weapon ase) 592 weapon2.Power.Value = 400; 593 weapon2.Power.DefaultValue = 400; 594 break; 595 case 4: 596 weapon2 = new Cannon(0, 0); 597 weapon2.ProjectileCollision = delegate(PhysicsObject ammus, PhysicsObject kohde) { weaponhit(ammus, kohde, 0, 5); }; 598 weapon2.FireRate = 0.8; 599 weapon2.Power.DefaultValue = 1500; 600 weapon2.Power.Value = 1500; 601 break; 602 } 603 } 604 void fire(Weapon ase, Player ship) 558 605 { 559 606 PhysicsObject ammus = ase.Shoot(); … … 564 611 //ammus.Image = ...; 565 612 //ammus.MaximumLifetime = TimeSpan.FromSeconds(2.0); 566 ammus.MaximumLifetime = TimeSpan.From Minutes(1.0);613 ammus.MaximumLifetime = TimeSpan.FromSeconds(10.0); 567 614 if (ase is AssaultRifle) 568 615 { … … 577 624 ammus.Size *= 2; 578 625 ammus.IgnoresCollisionResponse = true; 626 ammus.Tag = "laser"; 579 627 } 580 628 if (ase is PlasmaCannon) 581 629 { 582 ammus.Size *= 1.2;630 ammus.Size *= 0.9; 583 631 AddCollisionHandler(ammus, CollisionHandler.DestroyObject); 584 632 ammus.IgnoresCollisionResponse = true; 585 633 ammus.CollisionIgnoreGroup = 3; 586 634 } 635 if (ase is Cannon) 636 { 637 ammus.Size *= 0.8; 638 // ammus.Image = homing; 639 ammus.Image = ship.cannonImage; 640 AddCollisionHandler(ammus, missilehit); 641 ammus.AngularDamping = 1.0; 642 ammus.IgnoresCollisionResponse = true; 643 644 FollowerBrain ammusbrain = new FollowerBrain("hostile", "laser"); 645 //ammusbrain.DistanceFar = 125; 646 ammusbrain.DistanceFar = 50; 647 ammusbrain.Speed = 80; 648 ammusbrain.TurnSpeed = UnlimitedAngle.FromDegrees(360); 649 ammusbrain.StopWhenTargetClose = false; 650 ammusbrain.TurnWhileMoving = true; 651 ammus.Brain = ammusbrain; 652 } 653 } 654 } 655 void missilehit(PhysicsObject tormaaja, PhysicsObject kohde) 656 { 657 tormaaja.Destroy(); 658 Explosion missilecrash = new Explosion(8); 659 missilecrash.Position = tormaaja.Position; 660 missilecrash.UseShockWave = false; 661 Add(missilecrash); 662 } 663 void firehoming(Weapon ase) 664 { 665 PhysicsObject ammus = ase.Shoot(); 666 if (ammus != null) 667 { 668 //Add(ammus, 2); 669 //ammus.Size *= ; 670 //ammus.Image = ...; 671 //ammus.MaximumLifetime = TimeSpan.FromSeconds(2.0); 672 ammus.MaximumLifetime = TimeSpan.FromSeconds(5.0); 673 ammus.Image = homing; 674 AddCollisionHandler(ammus, missilehit); 675 ammus.IgnoresCollisionResponse = true; 676 ammus.Size *= 0.8; 677 ammus.AngularDamping = 1.0; 678 ammus.Image.ReplaceColor(Color.White, Color.Ultramarine); 679 ammus.Image.ReplaceColor(Color.Black, Color.Green); 680 AddCollisionHandler(ammus, "player1", CollisionHandler.DestroyObject); 681 FollowerBrain ammusbrain = new FollowerBrain("player", "laser"); 682 //ammusbrain.DistanceFar = 125; 683 ammusbrain.DistanceFar = 50; 684 ammusbrain.Speed = 80; 685 ammusbrain.TurnSpeed = UnlimitedAngle.FromDegrees(360); 686 ammusbrain.StopWhenTargetClose = false; 687 ammusbrain.TurnWhileMoving = true; 688 ammus.Brain = ammusbrain; 587 689 } 588 690 } … … 604 706 void Controlsship() 605 707 { 606 Keyboard.Listen(Key.W, ButtonState.Down, movement, null, 0, 100, ship );607 Keyboard.Listen(Key.S, ButtonState.Down, movement, null, 0, -100, ship );608 Keyboard.Listen(Key.A, ButtonState.Down, movement, null, -100, 0, ship );609 Keyboard.Listen(Key.D, ButtonState.Down, movement, null, 100, 0, ship );610 Keyboard.Listen(Key.Space, ButtonState.Down, fire, "", weapon );611 Mouse.ListenMovement(0, Aim, null, ship );612 Mouse.Listen(MouseButton.Left, ButtonState.Down, fire, null, weapon );708 Keyboard.Listen(Key.W, ButtonState.Down, movement, null, 0, 100, ship1); 709 Keyboard.Listen(Key.S, ButtonState.Down, movement, null, 0, -100, ship1); 710 Keyboard.Listen(Key.A, ButtonState.Down, movement, null, -100, 0, ship1); 711 Keyboard.Listen(Key.D, ButtonState.Down, movement, null, 100, 0, ship1); 712 Keyboard.Listen(Key.Space, ButtonState.Down, fire, "", weapon, ship1); 713 Mouse.ListenMovement(0, Aim, null, ship1); 714 Mouse.Listen(MouseButton.Left, ButtonState.Down, fire, null, weapon, ship1); 613 715 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, null); 614 716 } … … 624 726 void Controlsship1() 625 727 { 626 Keyboard.Listen(Key.W, ButtonState.Down, thrust, "", 1.0, ship );627 Keyboard.Listen(Key.S, ButtonState.Down, thrust, "", -1.0, ship );628 Keyboard.Listen(Key.A, ButtonState.Down, tilt, "", 1.0, ship );629 Keyboard.Listen(Key.D, ButtonState.Down, tilt, "", -1.0, ship );630 Keyboard.Listen(Key.Space, ButtonState.Down, fire, "", weapon );728 Keyboard.Listen(Key.W, ButtonState.Down, thrust, "", 1.0, ship1); 729 Keyboard.Listen(Key.S, ButtonState.Down, thrust, "", -1.0, ship1); 730 Keyboard.Listen(Key.A, ButtonState.Down, tilt, "", 1.0, ship1); 731 Keyboard.Listen(Key.D, ButtonState.Down, tilt, "", -1.0, ship1); 732 Keyboard.Listen(Key.Space, ButtonState.Down, fire, "", weapon, ship1); 631 733 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 632 734 } … … 637 739 Keyboard.Listen(Key.NumPad4, ButtonState.Down, tilt, "", 1.0, ship2); 638 740 Keyboard.Listen(Key.NumPad6, ButtonState.Down, tilt, "", -1.0, ship2); 639 Keyboard.Listen(Key.Add, ButtonState.Down, fire, "", weapon2 );741 Keyboard.Listen(Key.Add, ButtonState.Down, fire, "", weapon2, ship2); 640 742 } 641 743 void thrust(double direction, Player ship) 642 744 { 643 Vector shipdirection = Vector.FromLengthAndAngle(100.0 *direction, ship.Angle);745 Vector shipdirection = Vector.FromLengthAndAngle(100.0 * direction, ship.Angle); 644 746 ship.Push(shipdirection); 645 747 } 646 748 void tilt(double direction, Player ship) 647 749 { 648 ship.AngularAcceleration = 10.0 *direction;750 ship.AngularAcceleration = 10.0 * direction; 649 751 } 650 752 void singleplayerbase() … … 663 765 a.Start(); 664 766 } 767 665 768 void coopbase() 666 769 { … … 680 783 a.Start(); 681 784 } 785 682 786 void Spawnrunes() 683 787 { -
2013/26/OtsoR/Projekti/Projekti/ProjektiContent/ProjektiContent.contentproj
r4250 r4278 573 573 </ItemGroup> 574 574 <ItemGroup> 575 <Compile Include="miniboss.png"> 576 <Name>miniboss</Name> 575 <Compile Include="bigenemy.png"> 576 <Name>bigenemy</Name> 577 <Importer>TextureImporter</Importer> 578 <Processor>TextureProcessor</Processor> 579 </Compile> 580 </ItemGroup> 581 <ItemGroup> 582 <Compile Include="missile.png"> 583 <Name>missile</Name> 577 584 <Importer>TextureImporter</Importer> 578 585 <Processor>TextureProcessor</Processor>
Note: See TracChangeset
for help on using the changeset viewer.