Changeset 3992
- Timestamp:
- 2013-06-06 11:51:24 (10 years ago)
- Location:
- 2013/23/LeoS
- Files:
-
- 1 added
- 1 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
2013/23/LeoS/Tasohyppelypeli2.cs
r3989 r3992 10 10 { 11 11 public IntMeter hpLaskuri; 12 public String alushousujenVari; 13 12 13 14 14 15 15 public Kytta(double width, double height, int hp) … … 30 30 { 31 31 32 PlatformCharacter snoopdogg; 32 public Boolean tpmittari = true; 33 PlatformCharacter homo; 33 34 Image olionkuva = LoadImage("hahmo"); 34 35 … … 37 38 IntMeter elamat; 38 39 List<PushButton> potionit = new List<PushButton>(); 40 Timer tpajastin; 39 41 40 42 public override void Begin() … … 42 44 LuoKentta(); 43 45 Gravity = new Vector(0, -1000); 44 elamat = new IntMeter(4, 0, 4); 45 elamat.LowerLimit += delegate { snoopdogg.Destroy();}; 46 46 elamat = new IntMeter(10, 0, 10); 47 elamat.LowerLimit += delegate { homo.Destroy(); }; 48 Level.CreateBorders(); 49 tpajastin = new Timer(); 50 tpajastin.Interval = 4; 51 tpajastin.Timeout += muutateleport; 52 tpajastin.Start(1); 53 Label tpnautto = new Label(); 54 tpnautto.Right = Screen.Right - 10; 55 tpnautto.Top = Screen.Top - 10; 56 tpnautto.TextColor = Color.White; 57 tpnautto.DecimalPlaces = 1; 58 tpnautto.BindTo(tpajastin.SecondCounter); 59 Add(tpnautto); 47 60 ProgressBar elamaPalkki = new ProgressBar(150, 20); 48 61 elamaPalkki.Left = Screen.Left + 10; … … 53 66 elamaPalkki.BorderColor = Color.Black; 54 67 Add(elamaPalkki); 55 56 57 snoopdogg = new PlatformCharacter(80, 80); 58 PlasmaCannon snoopaase = new PlasmaCannon(50, 50); 59 snoopaase.InfiniteAmmo = true; 60 snoopaase.Position = new Vector(23, -10); 61 snoopaase.ProjectileCollision += AmmusOsui; 62 snoopdogg.Weapon = snoopaase; 63 snoopdogg.Shape = Shape.Pentagon; 64 snoopdogg.Image = olionkuva; 65 snoopdogg.CanRotate = false; 66 snoopdogg.Tag = "Snoopdogg"; 67 Add(snoopdogg); 68 AddCollisionHandler(snoopdogg, "ammus", Hittipointsi); 69 AddCollisionHandler(snoopdogg, "potion", OtaPotion); 70 68 69 70 homo = new PlatformCharacter(150, 150); 71 homo.Shape = Shape.Pentagon; 72 homo.Image = olionkuva; 73 homo.CanRotate = false; 74 homo.Tag = "homo"; 75 Add(homo); 76 AddCollisionHandler(homo, "ammus", Hittipointsi); 77 AddCollisionHandler(homo, "potion", OtaPotion); 78 Mouse.IsCursorVisible = true; 71 79 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "A.C.A.B"); //näppäinkomennot 72 80 Keyboard.Listen(Key.Left, ButtonState.Down, Kavele, null, (-1000.0)); //näppäinkomennot 73 Keyboard.Listen(Key.Right, ButtonState.Down, Kavele, null, (1000.0)); //näppäinkomennot 74 Keyboard.Listen(Key.Up, ButtonState.Down, Hyppaa, null, 500.0); //näppäinkomennot 75 Keyboard.Listen(Key.A, ButtonState.Down, Ammu, null, snoopdogg); 81 Keyboard.Listen(Key.Right, ButtonState.Down, Kavele, null, (1000.0)); //näppäinkomennot //näppäinkomennot 82 Keyboard.Listen(Key.A, ButtonState.Down, Ammu, null, homo); 76 83 Keyboard.Listen(Key.Z, ButtonState.Released, JuoPotion, null); 77 84 Keyboard.Listen(Key.E, ButtonState.Down, Pusauta, null); 78 85 Keyboard.Listen(Key.Q, ButtonState.Down, Jatka, null); 79 Camera.Follow(snoopdogg); //näppäinkomennot 86 Mouse.Listen(MouseButton.Left, ButtonState.Pressed, gayteleport, null); 87 Camera.ZoomToLevel(); 88 89 } 90 91 92 void gayteleport() 93 { 94 if (tpmittari == true) 95 { 96 homo.Position = Mouse.PositionOnWorld; 97 tpmittari = false; 98 tpajastin.Reset(); 99 tpajastin.Start(1); 100 } 101 } 102 void muutateleport() 103 { 104 tpmittari = true; 80 105 } 81 106 … … 89 114 IsPaused = false; 90 115 } 91 92 116 117 93 118 void AmmusOsui(PhysicsObject ammus, PhysicsObject kohde) 94 119 { … … 107 132 potionit.RemoveAt(potionit.Count - 1); 108 133 PaivitaPotionLista(); 109 110 elamat.Value += 1; 134 135 elamat.Value += 1; 111 136 } 112 137 … … 143 168 elamat.Value -= 1; 144 169 ammus.Destroy(); 145 170 146 171 } 147 172 … … 178 203 void Kavele(double vektori) 179 204 { 180 snoopdogg.Walk(vektori);181 } 182 183 void Hyppaa(double vektori)184 {185 snoopdogg.Jump(vektori);186 }205 homo.Walk(vektori); 206 } 207 208 //void Hyppaa(double vektori) 209 //{ 210 // homo.Jump(vektori); 211 //} 187 212 188 213 … … 218 243 kytta.Tag = "kytta"; 219 244 220 AssaultRifle kyttaAse = new AssaultRifle(50 , 50);245 AssaultRifle kyttaAse = new AssaultRifle(50.0, 50.0); 221 246 kytta.Weapon = kyttaAse; 222 247 kyttaAse.InfiniteAmmo = true; … … 224 249 225 250 List<string> tagit = new List<string>(); 226 tagit.Add(" Snoopdogg");251 tagit.Add("homo"); 227 252 228 253 FollowerBrain aivot = new FollowerBrain(tagit.ToArray()); … … 241 266 void TarkistaAmpuuko(AssaultRifle ase) 242 267 { 243 if (Vector.Distance(ase.Position, snoopdogg.Position) <= 500)268 if (Vector.Distance(ase.Position, homo.Position) <= 100) 244 269 { 245 270 // ase.Angle = new Vector(ase.Position.X - Snoopdogg.Position.X, ase.Position.Y - Snoopdogg.Position.Y).Angle;
Note: See TracChangeset
for help on using the changeset viewer.