Changeset 4124 for 2013/24


Ignore:
Timestamp:
2013-06-13 15:04:44 (10 years ago)
Author:
eevipenn
Message:

Talletus.

Location:
2013/24/EemeliP/Tasohyppelypeli3/Tasohyppelypeli3
Files:
13 added
6 edited

Legend:

Unmodified
Added
Removed
  • 2013/24/EemeliP/Tasohyppelypeli3/Tasohyppelypeli3/Tasohyppelypeli3/Braaains!!.cs

    r4104 r4124  
    99public class Tasohyppelypeli3 : PhysicsGame 
    1010{ 
     11    int kenttaNro = 1; 
     12 
    1113    const double nopeus = 450; 
    1214    const double hyppyNopeus = 800; 
    1315    const int RUUDUN_KOKO = 40; 
    1416 
     17    Vector aloituspaikka = Vector.Zero; 
    1518    PlatformCharacter pelaaja1; 
    1619 
     20    Image maaliKuva = LoadImage("finish"); 
     21    Image vaaraKuva = LoadImage("spike"); 
    1722    Image pelaajanKuva = LoadImage("ukko"); 
    18     Image tahtiKuva = LoadImage("Brains"); 
     23    Image tahtiKuva = LoadImage("tahti"); 
    1924 
    2025    SoundEffect maaliAani = LoadSoundEffect("beep"); 
     
    2429    { 
    2530        fetusAnimaatio = LoadAnimation("fetus"); 
    26  
    27         MultiSelectWindow alkuValikko = new MultiSelectWindow("Braaains!!", 
    28             "Start", "Close"); 
    29         //alkuValikko.AddItemHandler(0, AloitaPeli); 
     31        MultiSelectWindow alkuValikko = new MultiSelectWindow("Braaains!!", "Start", "Close"); 
     32        alkuValikko.AddItemHandler(0, AloitaPeli); 
    3033        alkuValikko.AddItemHandler(1, Exit); 
    3134        Add(alkuValikko); 
     35 
    3236        IsFullScreen = true; 
    33         Gravity = new Vector(0, -1000); 
    3437 
    35         LuoKentta(); 
    36         LisaaNappaimet(); 
     38    } 
    3739 
    38         Camera.Follow(pelaaja1); 
    39         Camera.ZoomFactor = 1.2; 
    40         Camera.StayInLevel = true; 
     40    void AloitaPeli() 
     41    { 
     42        SeuraavaKentta(); 
    4143    } 
    4244 
     
    4547        MediaPlayer.Play("hotdamned"); 
    4648        TileMap kentta = TileMap.FromLevelAsset("kentta1"); 
    47         kentta.SetTileMethod('#', LisaaTaso); 
    48         kentta.SetTileMethod('*', LisaaTahti); 
    49         kentta.SetTileMethod('N', LisaaPelaaja); 
    50         kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 
    51         Level.CreateBorders(); 
    52         Level.Background.CreateGradient(Color.Red, Color.Black); 
    5349    } 
    5450 
     
    7167    } 
    7268 
     69    void LisaaVaara(Vector paikka, double leveys, double korkeus) 
     70    { 
     71        PhysicsObject vaara = PhysicsObject.CreateStaticObject(leveys, korkeus); 
     72        vaara.IgnoresCollisionResponse = true; 
     73        vaara.Position = paikka; 
     74        vaara.Image = vaaraKuva; 
     75        vaara.Tag = "spike"; 
     76        Add(vaara); 
     77    } 
     78 
    7379    void LisaaPelaaja(Vector paikka, double leveys, double korkeus) 
    7480    { 
     
    7985        pelaaja1.Mass = 4.0; 
    8086        //pelaaja1.Image = pelaajanKuva; 
     87        aloituspaikka = paikka; 
    8188        AddCollisionHandler(pelaaja1, "tahti", TormaaTahteen); 
     89        AddCollisionHandler(pelaaja1, "spike", TormaaVaaraan); 
     90        AddCollisionHandler(pelaaja1, "maali", TormasiMaaliin); 
    8291        Add(pelaaja1); 
    8392    } 
     93 
     94 
    8495 
    8596    void LisaaNappaimet() 
     
    118129        tahti.Destroy(); 
    119130    } 
    120 }    
     131 
     132    void TormaaVaaraan(PhysicsObject hahmo, PhysicsObject vaara) 
     133    { 
     134        MessageDisplay.Add("Start again"); 
     135        hahmo.Position = aloituspaikka; 
     136    } 
     137 
     138    void AloitaAlusta() 
     139    { 
     140        LuoKentta(); 
     141        Gravity = new Vector(0, -1000); 
     142    } 
     143 
     144    void LuoKentta(string kenttaNimi) 
     145    { 
     146        MediaPlayer.Play(kenttaNimi + "_musiikki"); 
     147        TileMap kentta = TileMap.FromLevelAsset(kenttaNimi); 
     148        kentta.SetTileMethod('#', LisaaTaso); 
     149        kentta.SetTileMethod('M', LisaaMaali); 
     150        kentta.SetTileMethod('V', LisaaVaara); 
     151        kentta.SetTileMethod('*', LisaaTahti); 
     152        kentta.SetTileMethod('N', LisaaPelaaja); 
     153        kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 
     154        Level.CreateBorders(); 
     155        Level.Background.CreateGradient(Color.Red, Color.Black); 
     156 
     157    } 
     158    void TormasiMaaliin(PhysicsObject pelaaja, PhysicsObject maali) 
     159    { 
     160        kenttaNro++; 
     161        SeuraavaKentta(); 
     162    } 
     163 
     164 
     165    void SeuraavaKentta() 
     166    { 
     167        ClearAll(); 
     168 
     169        if (kenttaNro == 1) LuoKentta("kentta1"); 
     170        else if (kenttaNro == 2) LuoKentta("kentta2"); 
     171        else if (kenttaNro == 3) LuoKentta("kentta3"); 
     172        else if (kenttaNro == 4) LuoKentta("kentta4"); 
     173        else if (kenttaNro == 5) LuoKentta("kentta5"); 
     174        else if (kenttaNro > 6) Exit(); 
     175 
     176        Gravity = new Vector(0, -1000); 
     177        LisaaNappaimet(); 
     178 
     179        Camera.Follow(pelaaja1); 
     180        Camera.ZoomFactor = 1.2; 
     181        Camera.StayInLevel = true; 
     182 
     183    } 
     184 
     185    void LisaaMaali(Vector paikka, double leveys, double korkeus) 
     186    { 
     187        PhysicsObject maali = PhysicsObject.CreateStaticObject(leveys, korkeus); 
     188        maali.IgnoresCollisionResponse = true; 
     189        maali.Position = paikka; 
     190        maali.Image = maaliKuva; 
     191        maali.Tag = "maali"; 
     192        Add(maali); 
     193    } 
     194 
     195} 
  • 2013/24/EemeliP/Tasohyppelypeli3/Tasohyppelypeli3/Tasohyppelypeli3Content/Tasohyppelypeli3Content.contentproj

    r4104 r4124  
    5656      <Processor>SoundEffectProcessor</Processor> 
    5757    </Compile> 
    58     <Compile Include="norsu.png"> 
    59       <Name>norsu</Name> 
    60       <Importer>TextureImporter</Importer> 
    61       <Processor>TextureProcessor</Processor> 
    62     </Compile> 
    6358    <Compile Include="tahti.png"> 
    6459      <Name>tahti</Name> 
     
    10499      <Processor>TextureProcessor</Processor> 
    105100    </Compile> 
    106     <Compile Include="stick.png"> 
    107       <Name>stick</Name> 
    108       <Importer>TextureImporter</Importer> 
    109       <Processor>TextureProcessor</Processor> 
    110     </Compile> 
    111101  </ItemGroup> 
    112102  <ItemGroup> 
     
    118108  </ItemGroup> 
    119109  <ItemGroup> 
    120     <Compile Include="paikallaan.anim"> 
    121       <Name>paikallaan</Name> 
    122       <Importer>AnimationImporter</Importer> 
    123       <Processor>AnimationContentProcessor</Processor> 
     110    <Compile Include="kentta1_musiikki.mp3"> 
     111      <Name>kentta1_musiikki</Name> 
     112      <Importer>Mp3Importer</Importer> 
     113      <Processor>SongProcessor</Processor> 
    124114    </Compile> 
    125115  </ItemGroup> 
    126116  <ItemGroup> 
    127     <Compile Include="hotdamned.mp3"> 
    128       <Name>hotdamned</Name> 
     117    <Compile Include="spike.png"> 
     118      <Name>spike</Name> 
     119      <Importer>TextureImporter</Importer> 
     120      <Processor>TextureProcessor</Processor> 
     121    </Compile> 
     122  </ItemGroup> 
     123  <ItemGroup> 
     124    <Compile Include="finish.png"> 
     125      <Name>finish</Name> 
     126      <Importer>TextureImporter</Importer> 
     127      <Processor>TextureProcessor</Processor> 
     128    </Compile> 
     129  </ItemGroup> 
     130  <ItemGroup> 
     131    <Compile Include="kentta2.txt"> 
     132      <Name>kentta2</Name> 
     133      <Importer>TextFileImporter</Importer> 
     134      <Processor>TextFileContentProcessor</Processor> 
     135    </Compile> 
     136  </ItemGroup> 
     137  <ItemGroup> 
     138    <Compile Include="kentta3.txt"> 
     139      <Name>kentta3</Name> 
     140      <Importer>TextFileImporter</Importer> 
     141      <Processor>TextFileContentProcessor</Processor> 
     142    </Compile> 
     143    <Compile Include="kentta4.txt"> 
     144      <Name>kentta4</Name> 
     145      <Importer>TextFileImporter</Importer> 
     146      <Processor>TextFileContentProcessor</Processor> 
     147    </Compile> 
     148    <Compile Include="kentta5.txt"> 
     149      <Name>kentta5</Name> 
     150      <Importer>TextFileImporter</Importer> 
     151      <Processor>TextFileContentProcessor</Processor> 
     152    </Compile> 
     153  </ItemGroup> 
     154  <ItemGroup> 
     155    <Compile Include="braaains.png"> 
     156      <Name>braaains</Name> 
     157      <Importer>TextureImporter</Importer> 
     158      <Processor>TextureProcessor</Processor> 
     159    </Compile> 
     160  </ItemGroup> 
     161  <ItemGroup> 
     162    <Compile Include="kentta2_musiikki.mp3"> 
     163      <Name>kentta2_musiikki</Name> 
     164      <Importer>Mp3Importer</Importer> 
     165      <Processor>SongProcessor</Processor> 
     166    </Compile> 
     167  </ItemGroup> 
     168  <ItemGroup> 
     169    <Compile Include="kentta3_musiikki.mp3"> 
     170      <Name>kentta3_musiikki</Name> 
     171      <Importer>Mp3Importer</Importer> 
     172      <Processor>SongProcessor</Processor> 
     173    </Compile> 
     174  </ItemGroup> 
     175  <ItemGroup> 
     176    <Compile Include="kentta4_musiikki.mp3"> 
     177      <Name>kentta4_musiikki</Name> 
     178      <Importer>Mp3Importer</Importer> 
     179      <Processor>SongProcessor</Processor> 
     180    </Compile> 
     181  </ItemGroup> 
     182  <ItemGroup> 
     183    <Compile Include="kentta5_musiikki.mp3"> 
     184      <Name>kentta5_musiikki</Name> 
    129185      <Importer>Mp3Importer</Importer> 
    130186      <Processor>SongProcessor</Processor> 
  • 2013/24/EemeliP/Tasohyppelypeli3/Tasohyppelypeli3/Tasohyppelypeli3Content/kentta1.txt

    r4104 r4124  
    88             ###               ###                                   *                                                                                          ###             # 
    99                                #                        *          ###          #                                                                              #               #                      
    10        *                        #                       ###                      #                                                                    ####################################          #############          ############          ############# 
    11       ###                       #                                          *     #                                                                 #                                     #          #                                                        # 
     10       V                        #                       ###                      #                                                                    ####################################          #############          ############          ############# 
     11      ###                       #                  V                       *     #                                                                 #                                     #          #            VVVVVVVVVV            VVVVVVVVVV            # 
    1212                                #                 ###                    #### *  #                                                                  #*                                   #          #                                                        # 
    1313 *             *                #############                               #    #                                                                   #                                   #          #                                                        # 
    1414###           ###               #                                           #    #                                                                    #                                  #          #                                                        # 
    15     N                           #  *                                        #    #                                                                        #                              #          #                                                        #                                   *********************************** 
    16 #############################################################################    #                                                                       #                               #          #                                                        #                         **        #####################################################  
    17                                                                             #    #                                                                      #                                #          #                                                        #                        ####             
    18                                                                             #    #                                                                     #                                 #          #                                                        #               ###                       #       #       # # ##    # 
    19                                                                             #    #                                                            *       #                                  #          #                                                        #                                          #     # #     #  # # #   # 
    20                                                                             #    #                                            *      #################                                   ############                                                        ############################                #   #   #   #   # #  #  # 
    21                                                                             #    #                                           ###     #                                                                                                                                                                    # #     # #    # #   # # 
    22                                                                             #    #                                      *            #                                                                                                                                                                     #       #     # #    ## 
     15    N                VVVVVVVVVVV#  *                 VVVVVVVVVVVVVVVVVVVVVVV#    #                                                                        #                              #          #                                                        #                                         M 
     16#############################################################################    #                                                                       #                               #          #                                                        #                         **        ####### 
     17                                                                            #    #                                                                      #                                #          #                                                        #                V       ####VVVVVVV             
     18                                                                            #    #                                                                     #                                 #          #                                                        #               ###                                                         
     19                                                                            #    #                                                            *       #                                  #VVVVVVVVVV#                                                        #VVVVVVV         V                           
     20                                                                            #    #                                            *      #################                                   ############                                                        ###########################################                 
     21                                                                            #    #                                           ###     #                                                                                                                                                                     
     22                                                                            #    #                                      *            #                                                                                                                                                                      
    2323                                                                            #    #                                     ###           #               
    2424                                                                            #    ###############             ###                     #    
Note: See TracChangeset for help on using the changeset viewer.