- Timestamp:
- 2012-07-05 14:56:29 (11 years ago)
- Location:
- 2012/27/EemilK/Survive untill U die!/Survive untill U die!
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2012/27/EemilK/Survive untill U die!/Survive untill U die!/Survive untill U die!/Survive_untill_U_die_.cs
r3569 r3604 20 20 PlasmaCannon pyssy; 21 21 PlasmaCannon pyssy2; 22 ExplosionSystem pamaus; 22 ExplosionSystem rajahdys; 23 ExplosionSystem rajahdysPelaaja; 24 25 IntMeter laskuri; 26 IntMeter laskuri2; 27 IntMeter laskuri23; 23 28 24 29 Image kuva = LoadImage("lawn_summer_rf_0001_large"); 25 30 public override void Begin() 26 31 { 32 33 rajahdysPelaaja = new ExplosionSystem(LoadImage("atom bomb"), 100); 34 27 35 int i = 0; 28 while (i < 200)29 { 30 LuoPalloja(RandomGen.NextDouble(-400, 400), RandomGen.NextDouble( 1000, 200));36 while (i < 100) 37 { 38 LuoPalloja(RandomGen.NextDouble(-400, 400), RandomGen.NextDouble(600, 200)); 31 39 i++; 32 LuoPallot(RandomGen.NextDouble(-400, 400), RandomGen.NextDouble( Level.Top, 300));40 LuoPallot(RandomGen.NextDouble(-400, 400), RandomGen.NextDouble(600, 200)); 33 41 i++; 34 42 } 35 43 LuoPistelaskuri(); 44 LuoPistelaskuri2(); 45 LuoPistelaskuri3(); 36 46 37 47 pyssy = new PlasmaCannon(20, 20); … … 42 52 43 53 // Pelaaja 1 (vasemman puoleinen) 44 pallo = PhysicsObject.CreateStaticObject(170, 170); 54 pallo = new Pelaaja(170, 170); 55 pallo.MakeStatic(); 45 56 pallo.Shape = Shape.Circle; 46 57 pallo.Image = LoadImage("p1"); … … 50 61 pallo.X = -240; 51 62 pallo.Y = -200; 63 pallo.Destroyed += delegate { rajahdys.AddEffect(pallo.Position, 100); }; 64 AddCollisionHandler(pallo, "vihu", PelaajaOsuu); 65 52 66 Add(pallo); 53 67 pallo.Add(pyssy); 54 68 55 69 // Pelaaja 2 (oikean puoleinen) 56 pallo2 = PhysicsObject.CreateStaticObject(170, 170); 70 pallo2 = new Pelaaja(170, 170); 71 pallo2.MakeStatic(); 57 72 pallo2.Shape = Shape.Circle; 58 73 pallo2.Image = LoadImage("p2"); … … 64 79 Add(pallo2); 65 80 pallo2.Add(pyssy2); 81 pallo2.Destroyed += delegate { rajahdys.AddEffect(pallo2.Position, 100); }; 82 AddCollisionHandler(pallo2, "vihu", PelaajaOsuu); 83 rajahdys = new ExplosionSystem(LoadImage("hitler"), 10); 84 Add(rajahdys); 85 66 86 67 87 vasenReuna = Level.CreateLeftBorder(); … … 175 195 tormaaja.Destroy(); 176 196 if (kohde.Tag.ToString() == "vihu") 197 { 177 198 (kohde as Vihu).elamat.Value--; 178 199 if ((kohde as Vihu).elamat.Value == 0) 200 { 201 rajahdys.AddEffect(kohde.Position, 1); 202 laskuri.Value += 1; 203 laskuri23.Value += 1; 204 LuoPalloja(RandomGen.NextDouble(-400, 400), RandomGen.NextDouble(700, 200)); 205 LuoPallot(RandomGen.NextDouble(-400, 400), RandomGen.NextDouble(700, 200)); 206 } 207 } 208 179 209 }); 180 210 } … … 193 223 tormaaja.Destroy(); 194 224 if (kohde.Tag.ToString() == "vihu") 225 { 195 226 (kohde as Vihu).elamat.Value--; 196 227 if ((kohde as Vihu).elamat.Value == 0) 228 { 229 rajahdys.AddEffect(kohde.Position, 1); 230 laskuri2.Value += 1; 231 laskuri23.Value += 1; 232 LuoPalloja(RandomGen.NextDouble(-400, 400), RandomGen.NextDouble(800, 200)); 233 LuoPallot(RandomGen.NextDouble(-400, 400), RandomGen.NextDouble(800, 200)); 234 235 } 236 } 197 237 }); 198 238 } … … 203 243 { 204 244 Grenade kranaatti; 205 kranaatti = new Grenade( 4.0);245 kranaatti = new Grenade(10.0); 206 246 kranaatti.Angle = Angle.RightAngle; 207 247 pallo.Throw(kranaatti, Angle.Zero, 500); … … 211 251 { 212 252 Grenade kranaatti2; 213 kranaatti2 = new Grenade( 4.0);253 kranaatti2 = new Grenade(10.0); 214 254 kranaatti2.Angle = Angle.RightAngle; 215 255 pallo2.Throw(kranaatti2, Angle.Zero, 500); 216 256 217 257 } 258 259 void LuoPistelaskuri() 260 { 261 262 laskuri = new IntMeter(0); 263 264 Label pisteNaytto = new Label(); 265 pisteNaytto.X = -400; 266 pisteNaytto.Y = -400; 267 pisteNaytto.TextColor = Color.Black; 268 pisteNaytto.Color = Color.White; 269 270 pisteNaytto.BindTo(laskuri); 271 pisteNaytto.Title = "p1: kills"; 272 Add(pisteNaytto); 273 } 274 void LuoPistelaskuri2() 275 { 276 277 laskuri2 = new IntMeter(0); 278 279 Label pisteNaytto2 = new Label(); 280 pisteNaytto2.X = 400; 281 pisteNaytto2.Y = -400; 282 pisteNaytto2.TextColor = Color.Black; 283 pisteNaytto2.Color = Color.White; 284 285 pisteNaytto2.BindTo(laskuri2); 286 pisteNaytto2.Title = "p2: kills"; 287 Add(pisteNaytto2); 288 } 289 void LuoPistelaskuri3() 290 { 291 292 laskuri23 = new IntMeter(0); 293 294 Label pisteNaytto23 = new Label(); 295 pisteNaytto23.X = 0; 296 pisteNaytto23.Y = -400; 297 pisteNaytto23.TextColor = Color.Black; 298 pisteNaytto23.Color = Color.White; 299 300 pisteNaytto23.BindTo(laskuri23); 301 pisteNaytto23.Title = "Total Kills"; 302 Add(pisteNaytto23); 303 } 304 305 void PelaajaOsuu(PhysicsObject pelaaja, PhysicsObject kohde) 306 { 307 (pelaaja as Pelaaja).hp.Value--; 308 } 309 218 310 } 219 311 … … 228 320 elamat.LowerLimit += delegate { this.Destroy(); }; 229 321 } 230 231 public class Player : PhysicsObject 232 { 233 public IntMeter lifepojot; 234 235 public Player(double width, double height) 322 } 323 324 325 326 327 public class Pelaaja : PhysicsObject 328 { 329 public IntMeter hp; 330 ExplosionSystem pum; 331 332 public Pelaaja(double width, double height) 236 333 : base(width, height) 237 334 { 238 lifepojot = new IntMeter(20, 0, 20); 239 lifepojot.LowerLimit += delegate { this.Destroy(); }; 240 } 241 } 242 } 243 244 335 hp = new IntMeter(20, 0, 20); 336 337 hp.LowerLimit += delegate { this.Destroy(); }; 338 339 340 } 341 } 342 343 -
2012/27/EemilK/Survive untill U die!/Survive untill U die!/Survive untill U die!Content/Survive untill U die!Content.contentproj
r3548 r3604 70 70 </Compile> 71 71 </ItemGroup> 72 <ItemGroup> 73 <Compile Include="hitler.png"> 74 <Name>hitler</Name> 75 <Importer>TextureImporter</Importer> 76 <Processor>TextureProcessor</Processor> 77 </Compile> 78 </ItemGroup> 79 <ItemGroup> 80 <Compile Include="atom bomb.png"> 81 <Name>atom bomb</Name> 82 <Importer>TextureImporter</Importer> 83 <Processor>TextureProcessor</Processor> 84 </Compile> 85 </ItemGroup> 72 86 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 73 87 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Note: See TracChangeset
for help on using the changeset viewer.