Changeset 3397


Ignore:
Timestamp:
2012-06-29 12:21:04 (11 years ago)
Author:
mitokalu
Message:

Talletus.

Location:
2012/26/MikaL/Zombie Survival/Zombie Survival
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 2012/26/MikaL/Zombie Survival/Zombie Survival/Zombie Survival/Zombie_Survival.cs

    r3379 r3397  
    2424        peli.rahaLaskuri.Value += 50; 
    2525        this.Destroy(); 
    26         peli.SpawnaaZombi(); 
     26        peli.SpawnAjastin(); 
     27    } 
     28 
     29    public override void Update(Time time) 
     30    { 
     31        base.Update(time); 
     32        Angle = Velocity.Angle; 
    2733    } 
    2834} 
     
    5157 
    5258    DoubleMeter p1_hp; 
     59    DoubleMeter p2_hp; 
    5360 
    5461 
     
    7784        zombipaikat = new List<Vector>(); 
    7885 
    79         SetWindowSize(1024, 768, true); 
     86        SetWindowSize(1024, 768, false); 
    8087        if (DataStorage.Exists("scores.xml")) topLista = DataStorage.Load<ScoreList>(topLista, "scores.xml"); 
    8188 
     
    9198    void StartGame() 
    9299    { 
     100        //multiplayer.Value = 0; 
    93101        zombipaikat.Clear(); 
    94102        ui(); 
    95103        LuoMap(); 
    96104        controls(); 
    97          
    98105                LuoKillLaskuri(); 
    99106                LuoRahalaskuri(); 
     
    135142    void LuoMap() 
    136143    { 
    137         SetWindowSize(1024, 768, false); 
    138144        ColorTileMap ruudut = ColorTileMap.FromLevelAsset("map"); 
    139145        ruudut.SetTileMethod(Color.Black, TeeSeina); 
     
    147153        Level.Background.Image = lol; 
    148154        Camera.ZoomToLevel(); 
     155        LuoZombi(); 
     156        LuoZombi(); 
     157        LuoZombi(); 
     158 
    149159         
    150160         
     
    198208        ak2.Image = null; 
    199209        ak2.Color = Color.Transparent; 
    200         ak1.ProjectileCollision = AmmusOsui; 
    201         ak1.Ammo.Value = p1_lipas.Value; 
     210        ak2.ProjectileCollision = AmmusOsui; 
     211        ak2.Ammo.Value = p1_lipas.Value; 
    202212        p2.Add(ak2); 
    203213    } 
    204     public void SpawnaaZombi() 
    205     { 
    206         //Tee ajastin  
     214    public void SpawnAjastin() 
     215    { 
     216        Timer ajastin = new Timer(); 
     217        ajastin.Interval = 6.5; 
     218        ajastin.Timeout += LuoZombi; 
     219        ajastin.Start(); 
     220 
     221        Timer ajastin2 = new Timer(); 
     222        ajastin2.Interval = 30; 
     223        ajastin2.Timeout += LuoZombi; 
     224        ajastin2.Start(); 
     225 
    207226    } 
    208227    void TeeZombiPaikka(Vector paikka, double leveys, double korkeus) 
     
    291310 
    292311        ControllerOne.Listen(Button.Y, ButtonState.Pressed, Use, null, p2); 
     312        ControllerOne.Listen(Button.RightShoulder, ButtonState.Down, Shoot, null, p2); 
     313        ControllerOne.Listen(Button.X, ButtonState.Pressed, Reload, null, p2); 
    293314 
    294315    } 
     
    331352        //Ase 
    332353        LuoAse(-100, Level.Top + 70); 
    333         LuoAse(Level.Left + 20, Level.Bottom + 100); 
     354        LuoAse(-505, Level.Bottom + 100); 
    334355        if(multiplayer == 1) LuoAse(+100, Level.Top + 70); 
    335356         
     
    344365 
    345366        //p2_hp 
    346         DoubleMeter p2_hp = new DoubleMeter(100); 
     367        p2_hp = new DoubleMeter(5); 
    347368        Label player2 = new Label("Player 2"); 
    348369        player2.X = Screen.Left + 40; 
    349370        player2.Y = Screen.Top - 40; 
    350         p2_hp.MaxValue = 100; 
     371        p2_hp.MaxValue = 5; 
    351372        ProgressBar p2_hpPalkki = new ProgressBar(170, 20); 
    352373        p2_hpPalkki.BindTo(p2_hp); 
     
    367388        p2_ammo_label.BindTo(p2_ammo); 
    368389        p2_ammo_lipas.Y = Screen.Top - 50; 
    369         p2_ammo_lipas.X = +100; 
     390        p2_ammo_lipas.X = +60; 
    370391        vali.Y = Screen.Top - 50; 
    371         vali.X = +85; 
     392        vali.X = +75; 
    372393        p2_ammo_label.Y = Screen.Top - 50; 
    373         p2_ammo_label.X = +60; 
     394        p2_ammo_label.X = +100; 
    374395        Add(p2_ammo_lipas); 
    375396        Add(vali); 
     
    437458        { 
    438459            PhysicsObject ammus = ak2.Shoot(); 
    439             if (ammus != null) p1_lipas.Value--; 
     460            if (ammus != null) p2_lipas.Value--; 
    440461        } 
    441462        if (p1_lipas == 0) 
     
    445466            Add(lataa); 
    446467        } 
    447         if (multiplayer == 1 && p2_lipas == 0) 
    448         { 
    449             lataa2 = new Label("Reload"); 
     468        if (multiplayer == 0) return; 
     469        if (p2_lipas == 0) 
     470        { 
     471            lataa2 = new Label("Reload (X)"); 
    450472            lataa2.X = -50; 
    451             lataa.MaximumLifetime = TimeSpan.FromSeconds(1); 
    452             Add(lataa); 
     473            lataa2.MaximumLifetime = TimeSpan.FromSeconds(1); 
     474            Add(lataa2); 
    453475        } 
    454476    } 
     
    457479        if (kohde.Tag == "living") p1_hp.Value--; 
    458480        if (p1_hp == 0) GameOver(); 
     481        if (multiplayer == 1 && p2_hp == 0) GameOver(); 
    459482    } 
    460483    void LuoAikaLaskuri() 
     
    526549            ak1.Ammo.Value = p1_lipas.Value; 
    527550        } 
     551 
     552        if (multiplayer == 1 && p2_ammo > 29 && p2_lipas == 0) 
     553        { 
     554            p2_ammo.Value -= 30; 
     555            p2_lipas.Value += 30; 
     556            ak2.Ammo.Value = p2_lipas.Value; 
     557        } 
     558 
    528559        //if (p1_lipas == 0) 
    529560        //{ 
     
    562593        ClearAll(); 
    563594        Mouse.IsCursorVisible = true; 
    564         HighScoreWindow topIkkuna = new HighScoreWindow("Parhaat pisteet","Onneksi olkoon, pääsit listalle lahtaamalla %p zombia! Syötä nimesi:", 
    565                              topLista, killLaskuri); 
     595        HighScoreWindow topIkkuna = new HighScoreWindow("Parhaat pisteet", "Onneksi olkoon, pääsit listalle lahtaamalla %p zombia! Syötä nimesi:", topLista, killLaskuri); 
    566596        topIkkuna.Closed += TallennaPisteet; 
    567597        Add(topIkkuna); 
     
    569599    void TallennaPisteet(Window sender) 
    570600    { 
    571         DataStorage.Save<ScoreList>(topLista, "pisteet.xml"); 
     601        DataStorage.Save<ScoreList>(topLista, "scores.xml"); 
    572602        Valikko(); 
    573603    } 
  • 2012/26/MikaL/Zombie Survival/Zombie Survival/Zombie SurvivalContent/Zombie SurvivalContent.contentproj

    r3379 r3397  
    4747    <Compile Include="fullbar.png"> 
    4848      <Name>fullbar</Name> 
    49       <Importer>TextureImporter</Importer> 
    50       <Processor>TextureProcessor</Processor> 
    51     </Compile> 
    52     <Compile Include="upbar.png"> 
    53       <Name>upbar</Name> 
    5449      <Importer>TextureImporter</Importer> 
    5550      <Processor>TextureProcessor</Processor> 
Note: See TracChangeset for help on using the changeset viewer.