Changeset 3604 for 2012/27


Ignore:
Timestamp:
2012-07-05 14:56:29 (11 years ago)
Author:
eekrkolu
Message:

Talletus.

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  
    2020    PlasmaCannon pyssy; 
    2121    PlasmaCannon pyssy2; 
    22     ExplosionSystem pamaus; 
     22    ExplosionSystem rajahdys; 
     23    ExplosionSystem rajahdysPelaaja; 
     24 
     25    IntMeter laskuri; 
     26    IntMeter laskuri2; 
     27    IntMeter laskuri23; 
    2328 
    2429    Image kuva = LoadImage("lawn_summer_rf_0001_large"); 
    2530    public override void Begin() 
    2631    { 
     32 
     33        rajahdysPelaaja = new ExplosionSystem(LoadImage("atom bomb"), 100); 
     34 
    2735        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)); 
    3139            i++; 
    32             LuoPallot(RandomGen.NextDouble(-400, 400), RandomGen.NextDouble(Level.Top, 300)); 
     40            LuoPallot(RandomGen.NextDouble(-400, 400), RandomGen.NextDouble(600, 200)); 
    3341            i++; 
    3442        } 
    35  
     43        LuoPistelaskuri(); 
     44        LuoPistelaskuri2(); 
     45        LuoPistelaskuri3(); 
    3646 
    3747        pyssy = new PlasmaCannon(20, 20); 
     
    4252 
    4353        // Pelaaja 1 (vasemman puoleinen) 
    44         pallo = PhysicsObject.CreateStaticObject(170, 170); 
     54        pallo = new Pelaaja(170, 170); 
     55        pallo.MakeStatic(); 
    4556        pallo.Shape = Shape.Circle; 
    4657        pallo.Image = LoadImage("p1"); 
     
    5061        pallo.X = -240; 
    5162        pallo.Y = -200; 
     63        pallo.Destroyed += delegate { rajahdys.AddEffect(pallo.Position, 100); }; 
     64        AddCollisionHandler(pallo, "vihu", PelaajaOsuu); 
     65 
    5266        Add(pallo); 
    5367        pallo.Add(pyssy); 
    5468 
    5569        // Pelaaja 2 (oikean puoleinen) 
    56         pallo2 = PhysicsObject.CreateStaticObject(170, 170); 
     70        pallo2 = new Pelaaja(170, 170); 
     71        pallo2.MakeStatic(); 
    5772        pallo2.Shape = Shape.Circle; 
    5873        pallo2.Image = LoadImage("p2"); 
     
    6479        Add(pallo2); 
    6580        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 
    6686 
    6787        vasenReuna = Level.CreateLeftBorder(); 
     
    175195                tormaaja.Destroy(); 
    176196                if (kohde.Tag.ToString() == "vihu") 
     197                { 
    177198                    (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                
    179209            }); 
    180210        } 
     
    193223                tormaaja.Destroy(); 
    194224                if (kohde.Tag.ToString() == "vihu") 
     225                { 
    195226                    (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                } 
    197237            }); 
    198238        } 
     
    203243    { 
    204244        Grenade kranaatti; 
    205         kranaatti = new Grenade(4.0); 
     245        kranaatti = new Grenade(10.0); 
    206246        kranaatti.Angle = Angle.RightAngle; 
    207247        pallo.Throw(kranaatti, Angle.Zero, 500); 
     
    211251    { 
    212252        Grenade kranaatti2; 
    213         kranaatti2 = new Grenade(4.0); 
     253        kranaatti2 = new Grenade(10.0); 
    214254        kranaatti2.Angle = Angle.RightAngle; 
    215255        pallo2.Throw(kranaatti2, Angle.Zero, 500); 
    216256 
    217257    } 
     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 
    218310} 
    219311 
     
    228320        elamat.LowerLimit += delegate { this.Destroy(); }; 
    229321    } 
    230  
    231     public class Player : PhysicsObject 
    232     { 
    233         public IntMeter lifepojot; 
    234  
    235         public Player(double width, double height) 
     322} 
     323     
     324 
     325 
     326 
     327public class Pelaaja : PhysicsObject 
     328    { 
     329        public IntMeter hp; 
     330        ExplosionSystem pum; 
     331 
     332        public Pelaaja(double width, double height) 
    236333            : base(width, height) 
    237334        { 
    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  
    7070    </Compile> 
    7171  </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> 
    7286  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    7387  <!--  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.