Changeset 7487 for 2016/25


Ignore:
Timestamp:
2016-06-22 15:53:42 (7 years ago)
Author:
koannak
Message:
 
Location:
2016/25/SaanaR/Tasohyppelypeli1
Files:
6 added
17 edited

Legend:

Unmodified
Added
Removed
  • 2016/25/SaanaR/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1.cs

    r7479 r7487  
    1212    const double hyppyNopeus = 850; 
    1313    const int RUUDUN_KOKO = 40; 
    14  
     14    PhysicsObject teleportUlos; 
    1515    PlatformCharacter pelaaja1; 
    1616    int kolikoidenMaara = 0; 
    17     string[] kentat = new string[] { "kentta1", "kentta2", "kentta3" }; 
    18     int kenttaMenossa = 0; 
     17    string[] kentat = new string[] { "kentta1", "kentta2", "kentta3", "kentta4", "kentta5" }; 
     18    int kenttaMenossa = 4; 
    1919    Image pelaajanKuva = LoadImage("kärpänen"); 
    20     Image tahtiKuva = LoadImage("Piste"); 
     20    Image kolikkoKuva = LoadImage("Piste"); 
    2121    Image AmpiaisenKuva = LoadImage("Ampiainen"); 
    2222 
     
    5050    void LisaaAse (Vector paikka, double leveys, double korkeus) 
    5151    { 
    52         PhysicsObject ase = new PhysicsObject(leveys, korkeus); 
     52        PhysicsObject ase = new PhysicsObject(leveys, korkeus/3); 
    5353        ase.Position = paikka; 
    5454        ase.Tag = "ase"; 
     55        ase.Image = LoadImage("ase"); 
    5556        Add(ase); 
    5657    } 
     
    5859    { 
    5960        TileMap kentta = TileMap.FromLevelAsset(kentat[kenttaMenossa]); 
    60         kentta.SetTileMethod('#', LisaaTaso); 
    61         kentta.SetTileMethod('*', LisaaTahti); 
     61        kentta.SetTileMethod('#', LisaaTaso, "taso"); 
     62        kentta.SetTileMethod('*', LisaaKolikko); 
    6263        kentta.SetTileMethod('A', LisaaAmpiainen); 
    6364        kentta.SetTileMethod('N', LisaaPelaaja); 
    6465        kentta.SetTileMethod('-', LisaaAse); 
     66        kentta.SetTileMethod('T', LisaaTaso, "Teleport"); 
     67        kentta.SetTileMethod('U', LisaaTaso, "TeleportUlos"); 
    6568        kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 
    6669        Level.CreateBorders(); 
     
    7982        aivot.Loop = true; 
    8083    } 
    81     void LisaaTaso(Vector paikka, double leveys, double korkeus) 
     84    void LisaaTaso(Vector paikka, double leveys, double korkeus, string tyyppi) 
    8285    { 
    8386        PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); 
     87        taso.IgnoresExplosions = true; 
    8488        taso.Position = paikka; 
    8589        taso.Shape = Shape.FromImage(pilvenreunat); 
    8690        taso.Image = pilvenreunat; 
    8791        taso.Color = Color.White; 
     92        taso.Tag = tyyppi; 
     93        Add(taso); 
     94        if (tyyppi.Equals("TeleportUlos")) teleportUlos = taso; 
    8895         
    89          
    90         Add(taso); 
    91     } 
    92  
    93     void LisaaTahti(Vector paikka, double leveys, double korkeus) 
    94     { 
    95         PhysicsObject tahti = PhysicsObject.CreateStaticObject(leveys, korkeus); 
    96         tahti.IgnoresCollisionResponse = true; 
    97         tahti.Position = paikka; 
    98         tahti.Image = tahtiKuva; 
    99         tahti.Tag = "Piste"; 
     96    } 
     97 
     98    void LisaaKolikko(Vector paikka, double leveys, double korkeus) 
     99    { 
     100        PhysicsObject kolikko = PhysicsObject.CreateStaticObject(leveys, korkeus); 
     101        kolikko.IgnoresCollisionResponse = true; 
     102        kolikko.IgnoresExplosions = true; 
     103        kolikko.Position = paikka; 
     104        kolikko.Image = kolikkoKuva; 
     105        kolikko.Tag = "Piste"; 
    100106        kolikoidenMaara++; 
    101         Add(tahti); 
     107        Add(kolikko); 
    102108    } 
    103109 
     
    108114        pelaaja1.Mass = 4.0; 
    109115        pelaaja1.Image = pelaajanKuva; 
    110         AddCollisionHandler(pelaaja1, "Piste", TormaaTahteen); 
     116        AddCollisionHandler(pelaaja1, "Piste", TormaaKolikkoon); 
    111117        AddCollisionHandler(pelaaja1, "ampiainen", TörmääAmpiaiseen); 
    112118        AddCollisionHandler(pelaaja1, "ase", OtaAse); 
     119        AddCollisionHandler(pelaaja1, "Teleport", SiirraPelaajaa); 
    113120 
    114121        Add(pelaaja1); 
     122    } 
     123    void SiirraPelaajaa (PhysicsObject pelaaja, PhysicsObject teleport) 
     124    { 
     125        pelaaja1.Position = teleportUlos.Position; 
     126        pelaaja1.X += pelaaja.Height; 
     127        pelaaja1.Velocity = Vector.Zero; 
    115128    } 
    116129    void OtaAse (PhysicsObject pelaaja, PhysicsObject ase) 
     
    123136    { 
    124137        ammus.Destroy(); 
     138        Explosion ammusRajahdys = new Explosion(100); 
     139        ammusRajahdys.Position = kohde.Position; 
     140        Add(ammusRajahdys); 
     141        ammusRajahdys.Speed = 170.0; 
     142        ammusRajahdys.Force = 5; 
    125143        if (kohde.Tag.Equals("ampiainen")) kohde.Destroy(); 
     144         
    126145    } 
    127146    void TörmääAmpiaiseen (PhysicsObject pelaaja, PhysicsObject ampiainen) 
     
    165184        if (ammus != null) 
    166185        { 
     186            ammus.IgnoresExplosions = true; 
    167187            //ammus.Size *= 3; 
    168188            //ammus.Image = ... 
     
    177197    } 
    178198 
    179     void TormaaTahteen(PhysicsObject hahmo, PhysicsObject tahti) 
     199    void TormaaKolikkoon(PhysicsObject hahmo, PhysicsObject tahti) 
    180200    { 
    181201        maaliAani.Play(); 
  • 2016/25/SaanaR/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1.csproj.Debug.cachefile

    r7479 r7487  
    1212Content\hyppy.xnb 
    1313Content\kentta3.xnb 
     14Content\kentta4.xnb 
     15Content\kentta5.xnb 
     16Content\ase.xnb 
  • 2016/25/SaanaR/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1/obj/x86/Debug/ContentPipeline-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}.xml

    r7479 r7487  
    3636      <Options>None</Options> 
    3737      <Output>C:\Users\ohjelmointi\Documents\SaanaR\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\kentta1.xnb</Output> 
    38       <Time>2016-06-21T14:13:34.4026624+03:00</Time> 
     38      <Time>2016-06-22T14:16:54.5596282+03:00</Time> 
    3939    </Item> 
    4040    <Item> 
     
    9999      <Options>None</Options> 
    100100      <Output>C:\Users\ohjelmointi\Documents\SaanaR\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\kentta2.xnb</Output> 
    101       <Time>2016-06-21T15:38:14.2282009+03:00</Time> 
     101      <Time>2016-06-22T14:40:50.8741176+03:00</Time> 
    102102    </Item> 
    103103    <Item> 
     
    117117      <Options>None</Options> 
    118118      <Output>C:\Users\ohjelmointi\Documents\SaanaR\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\kentta3.xnb</Output> 
    119       <Time>2016-06-21T15:47:19.5383937+03:00</Time> 
     119      <Time>2016-06-22T15:25:25.1223315+03:00</Time> 
     120    </Item> 
     121    <Item> 
     122      <Source>kentta4.txt</Source> 
     123      <Name>kentta4</Name> 
     124      <Importer>TextFileImporter</Importer> 
     125      <Processor>TextFileContentProcessor</Processor> 
     126      <Options>None</Options> 
     127      <Output>C:\Users\ohjelmointi\Documents\SaanaR\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\kentta4.xnb</Output> 
     128      <Time>2016-06-22T15:21:40.5782184+03:00</Time> 
     129    </Item> 
     130    <Item> 
     131      <Source>kentta5.txt</Source> 
     132      <Name>kentta5</Name> 
     133      <Importer>TextFileImporter</Importer> 
     134      <Processor>TextFileContentProcessor</Processor> 
     135      <Options>None</Options> 
     136      <Output>C:\Users\ohjelmointi\Documents\SaanaR\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\kentta5.xnb</Output> 
     137      <Time>2016-06-22T14:40:50.8585246+03:00</Time> 
     138    </Item> 
     139    <Item> 
     140      <Source>ase.png</Source> 
     141      <Name>ase</Name> 
     142      <Importer>TextureImporter</Importer> 
     143      <Processor>TextureProcessor</Processor> 
     144      <Options>None</Options> 
     145      <Output>C:\Users\ohjelmointi\Documents\SaanaR\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\ase.xnb</Output> 
     146      <Time>2016-06-22T15:32:44.421579+03:00</Time> 
    120147    </Item> 
    121148    <BuildSuccessful>true</BuildSuccessful> 
  • 2016/25/SaanaR/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1/obj/x86/Debug/Tasohyppelypeli1.csproj.FileListAbsolute.txt

    r7479 r7487  
    2020C:\Users\ohjelmointi\Documents\SaanaR\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\hyppy.xnb 
    2121C:\Users\ohjelmointi\Documents\SaanaR\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\kentta3.xnb 
     22C:\Users\ohjelmointi\Documents\SaanaR\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\kentta4.xnb 
     23C:\Users\ohjelmointi\Documents\SaanaR\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\kentta5.xnb 
     24C:\Users\ohjelmointi\Documents\SaanaR\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\ase.xnb 
  • 2016/25/SaanaR/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1/obj/x86/Debug/cachefile-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}-targetpath.txt

    r7479 r7487  
    1212Content\hyppy.xnb 
    1313Content\kentta3.xnb 
     14Content\kentta4.xnb 
     15Content\kentta5.xnb 
     16Content\ase.xnb 
  • 2016/25/SaanaR/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1Content/Tasohyppelypeli1Content.contentproj

    r7479 r7487  
    130130    </Compile> 
    131131  </ItemGroup> 
     132  <ItemGroup> 
     133    <Compile Include="kentta4.txt"> 
     134      <Name>kentta4</Name> 
     135      <Importer>TextFileImporter</Importer> 
     136      <Processor>TextFileContentProcessor</Processor> 
     137    </Compile> 
     138  </ItemGroup> 
     139  <ItemGroup> 
     140    <Compile Include="kentta5.txt"> 
     141      <Name>kentta5</Name> 
     142      <Importer>TextFileImporter</Importer> 
     143      <Processor>TextFileContentProcessor</Processor> 
     144    </Compile> 
     145  </ItemGroup> 
     146  <ItemGroup> 
     147    <Compile Include="ase.png"> 
     148      <Name>ase</Name> 
     149      <Importer>TextureImporter</Importer> 
     150      <Processor>TextureProcessor</Processor> 
     151    </Compile> 
     152  </ItemGroup> 
    132153  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    133154  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2016/25/SaanaR/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1Content/kentta1.txt

    r7479 r7487  
    33 
    44*      
    5 #     * *    **    A**     
     5#    *****   **    A**     
    66         #####  ####  ##### 
    77 
     
    1515  ##    ##    ##    ##    # 
    1616 
    17 *     * *    *     *A    * 
     17*     * *   ***    *A    * 
    1818###   ###   ###   ###   ### 
    1919 
    20 *   *      *N*   *   *   A 
     20*   *  *  * *N*   *   *   A 
    2121########################### 
  • 2016/25/SaanaR/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1Content/kentta2.txt

    r7479 r7487  
    1818 
    1919N    *    *    *      A 
    20 ####################### 
     20######################## 
  • 2016/25/SaanaR/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1Content/kentta3.txt

    r7479 r7487  
    11########################################## 
    2 #  ********       AAAAAAAAAAAAAAAAAA     # 
    3 #  ********       AAAAAAAAAAAAAAAAAA     # 
    4 #  ********       AAAAAAAAAAAAAAAAAA     # 
     2#  ************   AAAAAAAAAAAAAAAAAA     # 
     3#  ************   AAAAAAAAAAAAAAAAAA     # 
     4#  ************   AAAAAAAAAAAAAAAAAA     # 
    55#####################################    # 
    66                                         # 
    7 **      * *   * A  A*A   **AA  A *A*   AA# 
     7**      * *   *    A*A   **AA  A *A*   AA# 
    88####    ###  ###   ###   ####    ###   ### 
    99 
    10     **    *    *A   A*  A *A    A*  AA 
     10    **    *    *    A*  A *A    A*  AA 
    1111    ###  ###   ##   ###   ##    ##   # 
    1212         
    13 **    * *     *     A        A     **A   A  A*  
     13****  * *     *     A        A     **A   A  A* 
    1414####  ###   ###    ##        #     ###   #  ## 
    1515                       A 
    16    **    *    *     A*   *A A     * A  * 
     16   **   **    *     A*   *A A     * A  * 
    1717  ###   ##    ##    ##   ####     ###  # 
    1818 
     
    2020##    ###    ###   ##   ##   ##  ##    ##       
    2121 
    22 N  *  -  *      * A A A* A AA*A  A *A  A *AAAA 
    23 ############################################## 
     22N  *  -  ******** A A A* A AA*A  A *A  A *AAAA 
     23############################################### 
Note: See TracChangeset for help on using the changeset viewer.