Changeset 3634


Ignore:
Timestamp:
2012-07-06 10:27:21 (11 years ago)
Author:
eekrkolu
Message:

Talletus.

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  
    99public class Survive_untill_U_die_ : PhysicsGame 
    1010{ 
     11    ScoreList topLista = new ScoreList(1000, false, 0); 
     12 
     13 
    1114    Vector oikealle = new Vector(100, 0); 
    1215    Vector vasemmalle = new Vector(-100, 0); 
     
    3033    public override void Begin() 
    3134    { 
     35        if (DataStorage.Exists("Ending")) 
     36            topLista = DataStorage.Load<ScoreList>(topLista, "Ending"); 
    3237 
    3338        rajahdysPelaaja = new ExplosionSystem(LoadImage("atom bomb"), 100); 
     
    6368        pallo.X = -240; 
    6469        pallo.Y = -200; 
    65         pallo.Destroying += delegate { rajahdysPelaaja.AddEffect(pallo.Position, 1); }; 
     70        pallo.Destroying += delegate { rajahdysPelaaja.AddEffect(pallo.Position, 100); }; 
    6671        AddCollisionHandler(pallo, "vihu", PelaajaOsuu); 
    6772 
     
    97102        Level.CreateBorders(); 
    98103        Camera.ZoomToLevel(); 
    99         Keyboard.Listen(Key.Space, ButtonState.Pressed, delegate { pallo.Destroy(); }, ""); 
    100104        Keyboard.Listen(Key.D, ButtonState.Down, Liiku, "pelaaja1: oikealle", pallo, oikealle); 
    101105        Keyboard.Listen(Key.D, ButtonState.Released, Liiku, null, pallo, Vector.Zero); 
     
    113117        PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 
    114118        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
     119 
    115120    } 
    116121    void LuoPalloja(double x, double y) 
     
    147152        aivot2.Speed = 10; 
    148153 
     154    } 
     155    void TallennaPisteet(Window sender) 
     156    { 
     157        DataStorage.Save<ScoreList>(topLista, "Ending"); 
    149158    } 
    150159 
     
    233242                        laskuri2.Value += 1; 
    234243                        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)); 
    237246                         
    238247                    } 
     
    266275 
    267276        Label pisteNaytto = new Label(); 
    268         pisteNaytto.X = -400; 
    269         pisteNaytto.Y = -400; 
    270         pisteNaytto.TextColor = Color.Black; 
    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; 
    272281 
    273282        pisteNaytto.BindTo(laskuri); 
     
    281290 
    282291        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; 
    287296 
    288297        pisteNaytto2.BindTo(laskuri2); 
     
    297306        Label pisteNaytto23 = new Label(); 
    298307        pisteNaytto23.X = 0; 
    299         pisteNaytto23.Y = -400; 
     308        pisteNaytto23.Y = Screen.BottomSafe + 100; 
    300309        pisteNaytto23.TextColor = Color.Black; 
    301         pisteNaytto23.Color = Color.White; 
     310        pisteNaytto23.Color = Color.Green; 
    302311         
    303312        pisteNaytto23.BindTo(laskuri23); 
     
    309318    { 
    310319        (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 
    311342    } 
    312343 
     
    331362    { 
    332363        public IntMeter hp; 
    333         ExplosionSystem pum; 
    334364 
    335365        public Pelaaja(double width, double height) 
     
    339369             
    340370            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  
    8484    </Compile> 
    8585  </ItemGroup> 
     86  <ItemGroup> 
     87    <Compile Include="Ending.jpg"> 
     88      <Name>Ending</Name> 
     89      <Importer>TextureImporter</Importer> 
     90      <Processor>TextureProcessor</Processor> 
     91    </Compile> 
     92  </ItemGroup> 
    8693  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    8794  <!--  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.