Changeset 2380 for 2011/26


Ignore:
Timestamp:
2011-06-30 15:00:26 (12 years ago)
Author:
janiemit
Message:

Talletus.

Location:
2011/26/JaniN/neon wars/neon wars
Files:
5 added
2 edited

Legend:

Unmodified
Added
Removed
  • 2011/26/JaniN/neon wars/neon wars/neon wars/Peli.cs

    r2314 r2380  
    2929public class Peli : PhysicsGame 
    3030{ 
     31    ScoreList topLista = new ScoreList(10, false, 0); 
    3132    Pelaaja pelaaja; 
     33    PushButton korkeusnappi; 
     34    PushButton leveysnappi; 
     35    PushButton näytäPistelistaNappi; 
    3236    GameObject pyssy; 
    3337    int montakoVihollistaLuotu = 0; 
    3438    int montakoVihollistaLuodaan = 1; 
    3539    PhysicsObject alareuna; 
    36     int pisteet = 0; 
     40    //int pisteet = 0; 
    3741    bool ladattu = true; 
    38     Label pistelaskuri; 
     42    //Label pistelaskuri; 
    3943    int vihollisia; 
    4044    int montakoVihollistaRuudullaEnintaan = 10; 
     
    4347    Image peliloppui = LoadImage("gameover"); 
    4448    int kentanLeveys = 400; 
    45     int kentanKorkeus = 380; 
    46  
     49    int kentanKorkeus = 800; 
     50    //int pMaxMaara = 200; 
     51    ExplosionSystem rajahdys =new ExplosionSystem(LoadImage("rajahdys"), 1000); 
     52    Timer latausajastin = new Timer(); 
     53    Timer vihollistenLuontiAjastin = new Timer(); 
     54    Timer vihollistenLuomisenNopeutus = new Timer(); 
     55 
     56    int vaikeus = 0; 
    4757 
    4858    public override void Begin() 
     
    5161        Keyboard.Listen(Key.Enter, ButtonState.Released, Start_game, null); 
    5262        aloitusruudunnappulat(); 
     63        if (DataStorage.Exists("pisteet.xml")) 
     64            topLista = DataStorage.Load<ScoreList>(topLista, "pisteet.xml"); 
     65     
     66 
     67 
    5368    } 
    5469 
     
    5671    { 
    5772        ClearAll(); 
    58          
    59         //Level.Width = Level.Width * 2; 
    60         Level.Width = kentanLeveys; 
    61         //Level.Height = Level.Height * 2; 
    62         //Level.Height = Level.Height / 2; 
     73        rajahdys = new ExplosionSystem(LoadImage("rajahdys"), 1000); 
     74         
    6375        aseta_näppäimet(); 
    6476        Mouse.IsCursorVisible = true; 
    6577        Camera.ZoomToLevel(); 
    66         Timer latausajastin = new Timer(); 
     78 
    6779        latausajastin.Interval = 0.03; 
    6880        latausajastin.Trigger += new Timer.TriggerHandler(latausajastin_Trigger); 
    6981        latausajastin.Start(); 
    70  
    7182 
    7283        vihollisia = 0; 
     
    7687 
    7788        Level.BackgroundColor = Color.DarkCyan; 
    78  
    79  
    80         Timer vihollistenLuontiAjastin = new Timer(); 
     89         
    8190        vihollistenLuontiAjastin.Interval = 1; 
    8291        vihollistenLuontiAjastin.Trigger += TeeVihollisia; 
    8392        vihollistenLuontiAjastin.Start(); 
    84         //TeeVihollinen(ajastin); 
    85  
    86         Timer vihollistenLuomisenNopeutus = new Timer(); 
     93 
     94        vihollistenLuomisenNopeutus = new Timer(); 
    8795        vihollistenLuomisenNopeutus.Interval = 5; // Kuinka monen sekunnin välein vihuja tulee lisää 
    8896        vihollistenLuomisenNopeutus.Trigger += NopeutaVihollistenLuontia; 
     
    124132        alareuna = Level.CreateBottomBorder(); 
    125133 
    126  
    127         pistelaskuri = new Label(pisteet.ToString()); 
    128         pistelaskuri.Position = new Vector(Screen.Right - 40, Screen.Top - 10); 
    129         Add(pistelaskuri); 
     134        SoundEffect rajahdysAani = LoadSoundEffect("rajahdys"); 
     135 
     136 
     137 
     138        //pistelaskuri = new Label(pisteet.ToString()); 
     139        //pistelaskuri.Position = new Vector(Screen.Right - 40, Screen.Top - 10); 
     140        //Add(pistelaskuri); 
     141 
     142        if (RandomGen.NextBool()) 
     143            MediaPlayer.Play("Castlevania X(Saturn)"); 
     144        else 
     145            MediaPlayer.Play("Super Castlevania IV(SNES)"); 
     146        Add(rajahdys); 
    130147    } 
    131148 
     
    135152        Level.Background.Image = peliloppui; 
    136153        Timer.SingleShot(3, Begin); 
     154        ajastintenpysaytys(); 
    137155    } 
    138156 
     
    177195    void ammus_Destroyed(PhysicsObject ammus) 
    178196    { 
    179         Explosion rajahdys = new Explosion(70); 
    180         rajahdys.Position = ammus.Position; 
    181         rajahdys.Force = 0; 
    182         rajahdys.ShockwaveColor = Color.Transparent; 
    183         Add(rajahdys); 
     197         
     198        rajahdys.AddEffect(ammus.Position, 1000); 
     199        rajahdys.MaxScale = 8; 
     200        rajahdys.MinScale=4; 
     201        //rajahdys. 
     202 
     203 
    184204    } 
    185205 
     
    207227    void NopeutaVihollistenLuontia(Timer sender) 
    208228    { 
    209         pisteet++; 
    210         pistelaskuri.Text = pisteet.ToString(); 
    211229        montakoVihollistaLuodaan += 1; 
    212230        MessageDisplay.Add("aalto numero " + montakoVihollistaLuodaan); 
     
    241259        Mouse.IsCursorVisible = true; 
    242260        luonappi("Aloita peli", new Vector(0, 0), new Action(Start_game), Color.Aqua); 
    243         //luonappi(" 
    244     } 
    245     void luonappi(string Teksti, Vector paikka, Action action, Color väri) 
     261        korkeusnappi = luonappi("korkeus normi",new Vector(0,70),new Action(muutaKorkeutta),Color.Blue); 
     262        leveysnappi = luonappi("leveys normi", new Vector(0, -70), new Action(muutaLeveytta), Color.Red); 
     263        näytäPistelistaNappi = luonappi("pisteet", new Vector(170, 0), new Action(näytäPistelista), Color.Green); 
     264    } 
     265    PushButton luonappi(string Teksti, Vector paikka, Action action, Color väri) 
    246266    { 
    247267        PushButton nappi = new PushButton(Teksti); 
     
    250270        nappi.Color = väri; 
    251271        Add(nappi); 
    252     } 
    253  
    254 } 
     272        return nappi; 
     273    } 
     274    void ajastintenpysaytys() 
     275    { 
     276        latausajastin.Stop(); 
     277        vihollistenLuontiAjastin.Stop(); 
     278        vihollistenLuomisenNopeutus.Stop(); 
     279    } 
     280    void muutaKorkeutta() 
     281    { 
     282        vaikeus++; 
     283        vaikeus = vaikeus % 3; 
     284 
     285        switch (vaikeus) 
     286        { 
     287            case 0: Level.Height = kentanKorkeus; 
     288                korkeusnappi.Text = "korkeus=normi"; 
     289                break; 
     290            case 1: Level.Height = kentanKorkeus * 2; 
     291                korkeusnappi.Text = "korkeus=*2"; 
     292                break; 
     293            case 2: Level.Height = kentanKorkeus / 2; 
     294                korkeusnappi.Text = "korkeus=/2"; 
     295                break; 
     296            default: 
     297                break; 
     298        } 
     299        //Level.Height = Level.Height * 2; 
     300        //Level.Height = Level.Height / 2; 
     301    } 
     302    void muutaLeveytta() 
     303    { 
     304        vaikeus++; 
     305        vaikeus = vaikeus % 3; 
     306 
     307        switch (vaikeus) 
     308        { 
     309            case 0: Level.Width = kentanLeveys; 
     310                leveysnappi.Text = "leveys=normi"; 
     311                break; 
     312            case 1: Level.Width = kentanLeveys * 2; 
     313                leveysnappi.Text = "leveys=*2"; 
     314                break; 
     315            case 2: Level.Width = kentanLeveys / 2; 
     316                leveysnappi.Text = "leveys=/2"; 
     317                break; 
     318            default: 
     319                break; 
     320        } 
     321        //Level.Height = Level.Height * 2; 
     322        //Level.Height = Level.Height / 2; 
     323         
     324    } 
     325     //Level.Width = Level.Width * 2; 
     326       // Level.Width = kentanLeveys; 
     327    void näytäPistelista() 
     328    { 
     329        HighScoreWindow topIkkuna = new HighScoreWindow("Neon Wars", 
     330                             "Parhaat pisteet", 
     331                               topLista); 
     332        topIkkuna.Closed += TallennaPisteet; 
     333        Add(topIkkuna); 
     334 
     335    } 
     336    void TallennaPisteet(Window sender) 
     337    { 
     338        DataStorage.Save<ScoreList>(topLista, "pisteet.xml"); 
     339 
     340    } 
     341}  
     342 
     343// 
     344//        HighScoreWindow topIkkuna = new HighScoreWindow("Neon Wars", 
     345//                               "Parhaat pisteet", 
     346//                               topLista); 
     347//        topIkkuna.Closed += TallennaPisteet; 
     348//        Add(topIkkuna); 
  • 2011/26/JaniN/neon wars/neon wars/neon warsContent/neon warsContent.contentproj

    r2314 r2380  
    6363    </Compile> 
    6464  </ItemGroup> 
     65  <ItemGroup> 
     66    <Compile Include="Castlevania X%28Saturn%29.mp3"> 
     67      <Name>Castlevania X%28Saturn%29</Name> 
     68      <Importer>Mp3Importer</Importer> 
     69      <Processor>SongProcessor</Processor> 
     70    </Compile> 
     71  </ItemGroup> 
     72  <ItemGroup> 
     73    <Compile Include="Super Castlevania IV%28SNES%29.mp3"> 
     74      <Name>Super Castlevania IV%28SNES%29</Name> 
     75      <Importer>Mp3Importer</Importer> 
     76      <Processor>SongProcessor</Processor> 
     77    </Compile> 
     78  </ItemGroup> 
     79  <ItemGroup> 
     80    <Compile Include="rajahdys.png"> 
     81      <Name>rajahdys</Name> 
     82      <Importer>TextureImporter</Importer> 
     83      <Processor>TextureProcessor</Processor> 
     84    </Compile> 
     85  </ItemGroup> 
    6586  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    6687  <!--  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.