Changeset 1215 for 2010/27/viaawipi/samsh cubes/Peli.cs
- Timestamp:
- 2010-07-09 11:06:09 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/27/viaawipi/samsh cubes/Peli.cs
r1195 r1215 27 27 protected override void Begin() 28 28 { 29 30 29 31 isku1 = new IntMeter(0); 30 32 isku2 = new IntMeter(0); … … 39 41 void seuraavaKentta() 40 42 { 43 41 44 ClearAll(); 45 MediaPlayer.Play("sm26"); 42 46 43 47 isku1 = new IntMeter(20); … … 77 81 78 82 Timer ajastin = new Timer(); 79 ajastin.Interval = 1 ;83 ajastin.Interval = 10; 80 84 ajastin.Trigger += HeitaKranaatti; 81 85 Add(ajastin); … … 121 125 Keyboard.Listen(Key.Right, ButtonState.Down, liikuta, "Liikkuu oikealle", pelaaja1, nopeus); 122 126 Keyboard.Listen(Key.Up, ButtonState.Pressed, hyppaa, "Hyppää", pelaaja1, hyppyVoima); 123 Keyboard.Listen(Key.Down, ButtonState.Pressed, iske1, " tiputa");127 Keyboard.Listen(Key.Down, ButtonState.Pressed, iske1, "hit"); 124 128 125 129 … … 129 133 Keyboard.Listen(Key.D, ButtonState.Down, liikuta, "Liikkuu oikealle", pelaaja2, nopeus); 130 134 Keyboard.Listen(Key.W, ButtonState.Pressed, hyppaa, "Hyppää", pelaaja2, hyppyVoima); 131 Keyboard.Listen(Key.S, ButtonState.Pressed, iske2, " tiputa");135 Keyboard.Listen(Key.S, ButtonState.Pressed, iske2, "hit"); 132 136 133 Keyboard.Listen(Key.Enter, ButtonState.Pressed, seuraavaKentta , "Hyppää"); 134 135 136 lisaaGamePadNappaimet(ControllerOne); 137 } 138 139 void lisaaGamePadNappaimet(GamePad controller) 140 { 141 controller.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); 142 143 controller.Listen(Button.DPadLeft, ButtonState.Down, liikuta, "Pelaaja liikkuu vasemmalle", pelaaja1, -nopeus); 144 controller.Listen(Button.DPadRight, ButtonState.Down, liikuta, "Pelaaja liikkuu oikealle", pelaaja1, nopeus); 145 controller.Listen(Button.A, ButtonState.Pressed, hyppaa, "Pelaaja hyppää", pelaaja1, hyppyVoima); 137 Keyboard.Listen(Key.Enter, ButtonState.Pressed, seuraavaKentta , "restart"); 146 138 } 147 139 … … 154 146 { 155 147 hahmo.Jump(voima); 148 PlaySound("power beam"); 149 150 156 151 } 157 152 … … 179 174 isku1.Value +=RandomGen.NextInt(1,10); 180 175 pelaaja2.Hit(new Vector(aba.X * isku1, aba.Y * isku1)); 176 PlaySound("plzbmfire"); 181 177 } 182 178 … … 190 186 isku2.Value += RandomGen.NextInt(1, 10); 191 187 pelaaja1.Hit(new Vector(aba.X * isku2, aba.Y * isku2)); 188 PlaySound("icebfire"); 192 189 } 193 190 … … 195 192 void HeitaKranaatti(Timer sender) 196 193 { 197 198 Explosion rajahdys = new Explosion(RandomGen.NextDouble(10,50)); 199 rajahdys.X = RandomGen.NextDouble(Level.Left, Level.Right); 200 rajahdys.Force = 500; 201 rajahdys.Y = RandomGen.NextDouble(Level.Left, Level.Right); 202 Add(rajahdys); 194 for (int i = 0; i < RandomGen.NextInt(1, 100); i++) 195 { 196 197 198 Grenade kranaatti = new Grenade(RandomGen.NextDouble(0.5,4)); 199 kranaatti.X = RandomGen.NextDouble(Level.Left, Level.Right); 200 kranaatti.Y = Level.Top - 10; 201 kranaatti.FuseTime = TimeSpan.FromSeconds(RandomGen.NextDouble(0,3.0)); 202 kranaatti.ExplosionForce = 2500; 203 kranaatti.ExplosionRadius = 50; 204 kranaatti.ExplosionSpeed = 100; 205 206 Add(kranaatti); 207 Vector heittoVoima = Vector.FromLengthAndAngle(RandomGen.NextDouble(5000, 10000), Angle.Degrees(RandomGen.NextDouble(180, 360))); 208 kranaatti.Hit(heittoVoima); 209 } 210 203 211 204 212 }
Note: See TracChangeset
for help on using the changeset viewer.