Changeset 9111
- Timestamp:
- 2017-07-26 10:48:04 (6 years ago)
- Location:
- 2017/30/HugoE/HanniAndHoo
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
2017/30/HugoE/HanniAndHoo/HanniAndHoo/HanniAndHoo/HanniAndHoo.cs
r9098 r9111 9 9 public class HanniAndHoo : PhysicsGame 10 10 { 11 Image HanninKuva = LoadImage("Hanni");12 Image HoonKuva = LoadImage("Hoo");11 //Image HanninKuva = LoadImage("Hanni"); 12 //Image HoonKuva = LoadImage("Hoo"); 13 13 14 AssaultRifle HanninAse; 15 16 14 17 PhysicsObject Hanni; 15 18 PhysicsObject Hoo; 19 16 20 public override void Begin() 17 21 { 18 22 LuoNappaimet(); 19 23 LuoPelaajat(); 24 //AmmuAseella(); 25 26 20 27 21 28 … … 32 39 Hanni.Shape = Shape.Circle; 33 40 Hanni.Color = Color.Blue; 34 Hanni.Image = HanninKuva; 41 // Hanni.Image = HanninKuva; 42 Hanni.CanRotate = false; 35 43 Add(Hanni); 44 HanninAse = new AssaultRifle(30, 10); 45 HanninAse.ProjectileCollision = AmmusOsui; 46 HanninAse.X = Hanni.Position.X + 550; 47 Hanni.Add(HanninAse); 48 HanninAse.Position = Hanni.Position; 49 50 36 51 Hoo = new PhysicsObject(100.0, 100.0); 37 52 Hoo.X = Level.Right - 20.0; … … 39 54 Hoo.Shape = Shape.Circle; 40 55 Hoo.Color = Color.Red; 41 Hoo.Image = HoonKuva; 56 // Hoo.Image = HoonKuva; 57 Hoo.CanRotate = false; 42 58 Add(Hoo); 59 } 60 61 void AmmusOsui(PhysicsObject Ammus, PhysicsObject Kohde) 62 { 63 43 64 } 44 65 void LuoNappaimet() 45 66 { 46 Keyboard.Listen(Key.W, ButtonState.Down, LiikutaHannia, null, new Vector(0, 1000));67 Keyboard.Listen(Key.W, ButtonState.Down, LiikutaHannia, null, new Vector(0, 500)); 47 68 Keyboard.Listen(Key.W, ButtonState.Released, LiikutaHannia, null, new Vector(0, 0)); 69 Keyboard.Listen(Key.D, ButtonState.Down, LiikutaHannia, null, new Vector(100.0, 0.0)); 70 Keyboard.Listen(Key.D, ButtonState.Released, LiikutaHannia, null, new Vector(0, 0)); 71 Keyboard.Listen(Key.A, ButtonState.Down, LiikutaHannia, null, new Vector(-100, 0)); 72 Keyboard.Listen(Key.A, ButtonState.Released, LiikutaHannia, null, new Vector(0, 0)); 73 74 48 75 49 76 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); … … 52 79 void LuoKentta() 53 80 { 54 Gravity = new Vector(0.0, -800.0); 81 82 Level.CreateBorders(); 83 55 84 56 85 } … … 60 89 void LiikutaHannia(Vector vektori) 61 90 { 62 Hanni.Push(vektori); 91 Hanni.Velocity = (vektori); 92 93 } 94 95 void AmmuAseella(AssaultRifle HanninAse) 96 { 97 PhysicsObject ammus = HanninAse.Shoot(); 98 Keyboard.Listen(Key.Space, ButtonState.Down, AmmuAseella, "Ammu", HanninAse); 99 100 if (ammus != null) 101 { 102 ammus.Size *= 3; 103 ammus.MaximumLifetime = TimeSpan.FromSeconds(2.0); 104 105 } 106 63 107 64 108 } … … 71 115 72 116 117 118 119 120 73 121 }
Note: See TracChangeset
for help on using the changeset viewer.