Changeset 3666 for 2012/27


Ignore:
Timestamp:
2012-07-06 12:46:18 (11 years ago)
Author:
pitkmart
Message:

Talletus.

Location:
2012/27/MaraP/MisterPoo/MisterPoo
Files:
7 added
2 edited

Legend:

Unmodified
Added
Removed
  • 2012/27/MaraP/MisterPoo/MisterPoo/MisterPoo/MisterPoo.cs

    r3616 r3666  
    99public class MisterPoo : PhysicsGame 
    1010{ 
     11    MultiSelectWindow alkuValikko; 
     12  
     13 
    1114    const double nopeus = 200; 
    1215    const double hyppyNopeus = 1000; 
     
    2932    public override void Begin() 
    3033    { 
    31         MediaPlayer.Play( "Rainbow Trololol" ); 
     34        alkuValikko = new MultiSelectWindow("Pelin Alkuvalikko", 
     35    "Aloita peli", "Kentät", "Lopeta"); 
     36        alkuValikko.AddItemHandler(0, AloitaKentta1); 
     37        alkuValikko.AddItemHandler(1, KenttaValikko); 
     38        alkuValikko.AddItemHandler(2, Exit); 
     39        Add(alkuValikko); 
     40    } 
     41 
     42    void KenttaValikko() 
     43    { 
     44        MultiSelectWindow kenttaValikko = new MultiSelectWindow("Kentät", "Luola", "Joku", "Avaruus"); 
     45        kenttaValikko.AddItemHandler(0, AloitaKentta1); 
     46        kenttaValikko.AddItemHandler(2, AloitaKentta3); 
     47        Add(kenttaValikko); 
     48    } 
     49 
     50    void AloitaKentta3() 
     51    { 
     52        MediaPlayer.Play("Rainbow Trololol"); 
    3253        kavelyVasemmalle = Image.Mirror(kavelyOikealle); 
    33         
    34         //GameObject alkuvalikko = .... 
    3554 
    3655        Gravity = new Vector(0, -1000); 
    3756 
    38         LuoKentta(); 
     57        LuoKentta("kentta3"); 
     58        LisaaNappaimet(); 
     59 
     60        Camera.Follow(pelaaja1); 
     61        Camera.ZoomToLevel(); 
     62        //Camera.StayInLevel = true; 
     63         
     64        Level.Background.Image = LoadImage("Battle MoD Level 3"); 
     65    } 
     66 
     67    void AloitaKentta1() 
     68    { 
     69        MediaPlayer.Play("Rainbow Trololol"); 
     70        kavelyVasemmalle = Image.Mirror(kavelyOikealle); 
     71 
     72        Gravity = new Vector(0, -1000); 
     73 
     74        LuoKentta("kentta1"); 
    3975        LisaaNappaimet(); 
    4076 
     
    4480    } 
    4581 
    46     void LuoKentta() 
     82    void LuoKentta(string kenttaNimi) 
    4783    { 
    48         TileMap kentta = TileMap.FromLevelAsset("kentta1"); 
     84        TileMap kentta = TileMap.FromLevelAsset(kenttaNimi); 
    4985        kentta.SetTileMethod('#', LisaaTaso); 
    5086        kentta.SetTileMethod('*', LisaaTahti); 
    5187        kentta.SetTileMethod('N', LisaaPelaaja); 
     88        kentta.SetTileMethod('n', LisaaNyan); 
     89        kentta.SetTileMethod('p', LisaaPlaneetta); 
     90        kentta.SetTileMethod('t', LisaaTaso2); 
    5291        kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 
    5392        Level.CreateBorders(); 
    54         Level.Background.CreateGradient(Color.White, Color.SkyBlue); 
     93        Level.Background.CreateGradient(Color.Black, Color.Lime); 
    5594    } 
    5695 
     
    6099        taso.Position = paikka; 
    61100        taso.Color = Color.Green; 
     101        Add(taso); 
     102    } 
     103 
     104    void LisaaTaso2(Vector paikka, double leveys, double korkeus) 
     105    { 
     106        PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys * 8, korkeus); 
     107        taso.Position = paikka; 
     108        taso.Image = LoadImage("taso"); 
     109        Add(taso); 
     110    } 
     111 
     112    void LisaaPlaneetta(Vector paikka, double leveys, double korkeus) 
     113    { 
     114        PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); 
     115        taso.Image = LoadImage("planeetta"); 
     116        taso.Position = paikka; 
     117        Add(taso); 
     118    } 
     119 
     120    void LisaaNyan(Vector paikka, double leveys, double korkeus) 
     121    { 
     122        PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys * 15, korkeus); 
     123        taso.Image = LoadImage("nyan"); 
     124        taso.Position = paikka; 
    62125        Add(taso); 
    63126    } 
     
    99162        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
    100163 
    101         Keyboard.Listen(Key.Left, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja1, -nopeus); 
    102         Keyboard.Listen(Key.Right, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja1, nopeus); 
    103         Keyboard.Listen(Key.Up, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja1, hyppyNopeus); 
     164        Keyboard.Listen(Key.A, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja1, -nopeus); 
     165        Keyboard.Listen(Key.D, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja1, nopeus); 
     166        Keyboard.Listen(Key.W, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja1, hyppyNopeus); 
    104167 
    105168        ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); 
  • 2012/27/MaraP/MisterPoo/MisterPoo/MisterPooContent/MisterPooContent.contentproj

    r3616 r3666  
    101101    </Compile> 
    102102  </ItemGroup> 
     103  <ItemGroup> 
     104    <Compile Include="Battle MoD Level 1.png"> 
     105      <Name>Battle MoD Level 1</Name> 
     106      <Importer>TextureImporter</Importer> 
     107      <Processor>TextureProcessor</Processor> 
     108    </Compile> 
     109  </ItemGroup> 
     110  <ItemGroup> 
     111    <Compile Include="Battle MoD Level 2.png"> 
     112      <Name>Battle MoD Level 2</Name> 
     113      <Importer>TextureImporter</Importer> 
     114      <Processor>TextureProcessor</Processor> 
     115    </Compile> 
     116  </ItemGroup> 
     117  <ItemGroup> 
     118    <Compile Include="Battle MoD Level 3.png"> 
     119      <Name>Battle MoD Level 3</Name> 
     120      <Importer>TextureImporter</Importer> 
     121      <Processor>TextureProcessor</Processor> 
     122    </Compile> 
     123  </ItemGroup> 
     124  <ItemGroup> 
     125    <Compile Include="nyan.png"> 
     126      <Name>nyan</Name> 
     127      <Importer>TextureImporter</Importer> 
     128      <Processor>TextureProcessor</Processor> 
     129    </Compile> 
     130    <Compile Include="planeetta.png"> 
     131      <Name>planeetta</Name> 
     132      <Importer>TextureImporter</Importer> 
     133      <Processor>TextureProcessor</Processor> 
     134    </Compile> 
     135    <Compile Include="taso.png"> 
     136      <Name>taso</Name> 
     137      <Importer>TextureImporter</Importer> 
     138      <Processor>TextureProcessor</Processor> 
     139    </Compile> 
     140  </ItemGroup> 
     141  <ItemGroup> 
     142    <Compile Include="kentta3.txt"> 
     143      <Name>kentta3</Name> 
     144      <Importer>TextFileImporter</Importer> 
     145      <Processor>TextFileContentProcessor</Processor> 
     146    </Compile> 
     147  </ItemGroup> 
    103148  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    104149  <!--  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.