Changeset 3634
- Timestamp:
- 2012-07-06 10:27:21 (11 years ago)
- Location:
- 2012/27/EemilK
- Files:
-
- 1 added
- 1 deleted
- 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
r3605 r3634 9 9 public class Survive_untill_U_die_ : PhysicsGame 10 10 { 11 ScoreList topLista = new ScoreList(1000, false, 0); 12 13 11 14 Vector oikealle = new Vector(100, 0); 12 15 Vector vasemmalle = new Vector(-100, 0); … … 30 33 public override void Begin() 31 34 { 35 if (DataStorage.Exists("Ending")) 36 topLista = DataStorage.Load<ScoreList>(topLista, "Ending"); 32 37 33 38 rajahdysPelaaja = new ExplosionSystem(LoadImage("atom bomb"), 100); … … 63 68 pallo.X = -240; 64 69 pallo.Y = -200; 65 pallo.Destroying += delegate { rajahdysPelaaja.AddEffect(pallo.Position, 1 ); };70 pallo.Destroying += delegate { rajahdysPelaaja.AddEffect(pallo.Position, 100); }; 66 71 AddCollisionHandler(pallo, "vihu", PelaajaOsuu); 67 72 … … 97 102 Level.CreateBorders(); 98 103 Camera.ZoomToLevel(); 99 Keyboard.Listen(Key.Space, ButtonState.Pressed, delegate { pallo.Destroy(); }, "");100 104 Keyboard.Listen(Key.D, ButtonState.Down, Liiku, "pelaaja1: oikealle", pallo, oikealle); 101 105 Keyboard.Listen(Key.D, ButtonState.Released, Liiku, null, pallo, Vector.Zero); … … 113 117 PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 114 118 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 119 115 120 } 116 121 void LuoPalloja(double x, double y) … … 147 152 aivot2.Speed = 10; 148 153 154 } 155 void TallennaPisteet(Window sender) 156 { 157 DataStorage.Save<ScoreList>(topLista, "Ending"); 149 158 } 150 159 … … 233 242 laskuri2.Value += 1; 234 243 laskuri23.Value += 1; 235 LuoPalloja(RandomGen.NextDouble(-400, 400), RandomGen.NextDouble( 800, 200));236 LuoPallot(RandomGen.NextDouble(-400, 400), RandomGen.NextDouble( 800, 200));244 LuoPalloja(RandomGen.NextDouble(-400, 400), RandomGen.NextDouble(600, 200)); 245 LuoPallot(RandomGen.NextDouble(-400, 400), RandomGen.NextDouble(600, 200)); 237 246 238 247 } … … 266 275 267 276 Label pisteNaytto = new Label(); 268 pisteNaytto.X = -400;269 pisteNaytto.Y = -400;270 pisteNaytto.TextColor = Color.Bl ack;271 pisteNaytto.Color = Color. White;277 pisteNaytto.X = Screen.LeftSafe + 100; 278 pisteNaytto.Y = Screen.BottomSafe + 100; 279 pisteNaytto.TextColor = Color.Blue; 280 pisteNaytto.Color = Color.Red; 272 281 273 282 pisteNaytto.BindTo(laskuri); … … 281 290 282 291 Label pisteNaytto2 = new Label(); 283 pisteNaytto2.X = 400;284 pisteNaytto2.Y = -400;285 pisteNaytto2.TextColor = Color. Black;286 pisteNaytto2.Color = Color. White;292 pisteNaytto2.X = Screen.RightSafe - 100; 293 pisteNaytto2.Y = Screen.BottomSafe + 100; 294 pisteNaytto2.TextColor = Color.Red; 295 pisteNaytto2.Color = Color.Blue; 287 296 288 297 pisteNaytto2.BindTo(laskuri2); … … 297 306 Label pisteNaytto23 = new Label(); 298 307 pisteNaytto23.X = 0; 299 pisteNaytto23.Y = -400;308 pisteNaytto23.Y = Screen.BottomSafe + 100; 300 309 pisteNaytto23.TextColor = Color.Black; 301 pisteNaytto23.Color = Color. White;310 pisteNaytto23.Color = Color.Green; 302 311 303 312 pisteNaytto23.BindTo(laskuri23); … … 309 318 { 310 319 (pelaaja as Pelaaja).hp.Value--; 320 kohde.Destroy(); 321 rajahdys.AddEffect(kohde.Position, 100); 322 Timer.SingleShot(1.0, delegate 323 { 324 if (pallo.IsDestroyed && pallo2.IsDestroyed) 325 { 326 PeliPaattyy(); 327 } 328 }); 329 } 330 331 void PeliPaattyy() 332 { 333 ClearAll(); 334 HighScoreWindow topIkkuna = new HighScoreWindow( 335 "Parhaat pisteet", 336 "Onneksi olkoon, pääsit Top 1k listalle %p! Syötä nimesi:mutta oot silti paska, koska kuolit!", 337 topLista, laskuri23.Value); 338 topIkkuna.Closed += TallennaPisteet; 339 Add(topIkkuna); 340 341 311 342 } 312 343 … … 331 362 { 332 363 public IntMeter hp; 333 ExplosionSystem pum;334 364 335 365 public Pelaaja(double width, double height) … … 339 369 340 370 hp.LowerLimit += delegate { this.Destroy(); }; 341 342 343 } 344 } 345 346 371 } 372 } -
2012/27/EemilK/Survive untill U die!/Survive untill U die!/Survive untill U die!Content/Survive untill U die!Content.contentproj
r3604 r3634 84 84 </Compile> 85 85 </ItemGroup> 86 <ItemGroup> 87 <Compile Include="Ending.jpg"> 88 <Name>Ending</Name> 89 <Importer>TextureImporter</Importer> 90 <Processor>TextureProcessor</Processor> 91 </Compile> 92 </ItemGroup> 86 93 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 87 94 <!-- 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.