Changeset 7291


Ignore:
Timestamp:
2016-06-14 14:55:22 (7 years ago)
Author:
majuvika
Message:
 
Location:
2016/24/MattiK/ZlandZ
Files:
21 added
13 edited

Legend:

Unmodified
Added
Removed
  • 2016/24/MattiK/ZlandZ/ZlandZ/ZlandZ/ZlandZ.cs

    r7266 r7291  
    1616    PlatformCharacter Sombombo; 
    1717 
    18     Image pelaajanKuva = LoadImage("norsu"); 
    19     Image tahtiKuva = LoadImage("tahti"); 
     18    Image pelaajanKuva = LoadImage("lintu"); 
     19    Image GuninKuva = LoadImage("gun"); 
     20    Image BossinKuva = LoadImage("Boss"); 
     21    Image boxinKuva = LoadImage("box"); 
     22    Image piikinKuva = LoadImage("piikki"); 
    2023    AssaultRifle pelaajan1Ase; 
    2124    SoundEffect maaliAani = LoadSoundEffect("maali"); 
    22  
     25    int ammustenMaara = 60; 
     26    SoundEffect hyppyAani = LoadSoundEffect("Jump17"); 
    2327    public override void Begin() 
    2428    { 
     
    2832         
    2933        LisaaNappaimet(); 
     34        LuoAmmusLaskuri(); 
    3035 
    3136        Camera.Follow(Leaf); 
     
    3843 
    3944        TileMap kentta = TileMap.FromLevelAsset("kentta1"); 
     45 
    4046        kentta.SetTileMethod('#', LisaaTaso); 
    41         kentta.SetTileMethod('*', LisaaTahti); 
     47        kentta.SetTileMethod('G', Lisaagun); 
     48        kentta.SetTileMethod('B', LisaaBoss); 
     49        kentta.SetTileMethod('b', LisaaBox); 
    4250        kentta.SetTileMethod('N', LisaaPelaaja); 
     51        kentta.SetTileMethod('P', LisaaPiikki); 
    4352        kentta.SetTileMethod('S', LisaaVihu); 
    4453        kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 
     
    5665        Add(taso); 
    5766    } 
    58     IntMeter pisteLaskuri; 
    59  
    60     void Luoelamalaskuri() 
    61     { 
    62         IntMeter pisteLaskuri; 
    63     } 
    64  
    65     void LuoPistelaskuri() 
    66     { 
    67        
    68     } 
    69  
    70     void LisaaTahti(Vector paikka, double leveys, double korkeus) 
    71     { 
    72         PhysicsObject tahti = PhysicsObject.CreateStaticObject(leveys, korkeus); 
    73         tahti.IgnoresCollisionResponse = true; 
    74         tahti.Position = paikka; 
    75         tahti.Image = tahtiKuva; 
    76         tahti.Tag = "tahti"; 
    77         Add(tahti); 
     67    void LisaaPiikki(Vector paikka, double leveys, double korkeus) 
     68    { 
     69        PhysicsObject Piikki = PhysicsObject.CreateStaticObject(leveys, korkeus); 
     70        Piikki.Position = paikka; 
     71        Piikki.Color = Color.Red; 
     72        Add(Piikki); 
     73        Piikki.Image = piikinKuva; 
     74        Piikki.Tag = "piikki"; 
     75    } 
     76    void LisaaBoss(Vector paikka, double leveys, double korkeus) 
     77    { 
     78        PlatformCharacter Boss =new PlatformCharacter(leveys, korkeus); 
     79        Boss.Position = paikka; 
     80        Add(Boss); 
     81        Boss.Image = BossinKuva; 
     82        Boss.Tag = "pahis"; 
     83        PlatformWandererBrain tasoAivot = new PlatformWandererBrain(); 
     84        tasoAivot.Speed = 50; 
     85        tasoAivot.Active = true; 
     86 
     87        Boss.Brain = tasoAivot; 
     88    } 
     89    IntMeter ammusLaskuri; 
     90 
     91    void LuoAmmusLaskuri() 
     92    { 
     93        ammusLaskuri = new IntMeter(ammustenMaara); 
     94        Label pisteNaytto = new Label(); 
     95        pisteNaytto.X = Screen.Left + 100; 
     96        pisteNaytto.Y = Screen.Top - 100; 
     97        pisteNaytto.TextColor = Color.Red; 
     98        pisteNaytto.Color = Color.Green; 
     99 
     100        pisteNaytto.BindTo(ammusLaskuri); 
     101        Add(pisteNaytto); 
     102    } 
     103 
     104 
     105 
     106    void LisaaBox(Vector paikka, double leveys, double korkeus) 
     107    { 
     108        PhysicsObject Box = PhysicsObject.CreateStaticObject(leveys, korkeus); 
     109        Box.IgnoresCollisionResponse = true; 
     110        Box.Position = paikka; 
     111        Box.Image = boxinKuva; 
     112        Box.Tag = "Box"; 
     113        Add(Box); 
    78114    } 
    79115    void LisaaVihu(Vector paikka, double leveys, double korkeus) 
     
    85121        // Sombombo.X = 140;Sombombo.Y = 180; 
    86122        Sombombo.Position = paikka; 
    87     } 
    88  
    89  
    90     void LisaaPelaaja(Vector paikka, double leveys, double korkeus) 
     123 
     124        
     125 
     126        PlatformWandererBrain tasoAivot = new PlatformWandererBrain(); 
     127        tasoAivot.Speed = 50; 
     128 
     129        Sombombo.Brain = tasoAivot; 
     130    } 
     131    void Lisaagun(Vector paikka, double leveys, double korkeus) 
     132    { 
     133        PhysicsObject gun = new PhysicsObject(leveys, korkeus); 
     134        Add(gun); 
     135        gun.Image = LoadImage("gun"); 
     136        gun.Tag = "gun"; 
     137        gun.Position = paikka; 
     138    } 
     139 
     140 
     141 
     142        void LisaaPelaaja(Vector paikka, double leveys, double korkeus) 
    91143    { 
    92144        Leaf = new PlatformCharacter(leveys, korkeus); 
     
    94146        Leaf.Mass = 4.0; 
    95147        Leaf.Image = pelaajanKuva; 
    96         AddCollisionHandler(Leaf, "tahti", TormaaTahteen); 
     148        AddCollisionHandler(Leaf, "Box", TormaaTahteen); 
    97149        AddCollisionHandler(Leaf, "pahis", TormaaVihuun); 
     150        AddCollisionHandler(Leaf, "piikki", TormaaPiikkiin); 
    98151        Add(Leaf); 
    99152        //pelaaja1 on PlatformCharacter-tyyppinen 
     
    101154 
    102155        //Ammusten määrä aluksi: 
    103         Leaf.Weapon.Ammo.Value = 100; 
     156        Leaf.Weapon.Ammo.Value = ammustenMaara; 
    104157 
    105158        //Mitä tapahtuu kun ammus osuu johonkin? 
     
    110163    { 
    111164        ammus.Destroy(); 
    112         kohde.Destroy(); 
     165        if (kohde.Tag.Equals("pahis")) 
     166        { 
     167            kohde.Destroy(); 
     168        } 
    113169    } 
    114170    void AmmuAseella(PlatformCharacter pelaaja) 
    115171    { 
    116172        PhysicsObject ammus = pelaaja.Weapon.Shoot(); 
    117          
     173        ammusLaskuri.Value--; 
    118174        if (ammus != null) 
    119175        { 
     
    139195        Keyboard.Listen(Key.D, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", Leaf, nopeus); 
    140196        Keyboard.Listen(Key.W, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", Leaf, hyppyNopeus); 
    141         Keyboard.Listen(Key.Space, ButtonState.Down, AmmuAseella, "Ammu", Leaf); 
     197        Keyboard.Listen(Key.Space, ButtonState.Pressed, AmmuAseella, "Ammu", Leaf); 
    142198        ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); 
    143199 
     
    157213    { 
    158214        hahmo.Jump(nopeus); 
    159     } 
    160  
    161     void TormaaTahteen(PhysicsObject hahmo, PhysicsObject tahti) 
     215        hyppyAani.Play(); 
     216    } 
     217 
     218    void TormaaTahteen(PhysicsObject hahmo, PhysicsObject Box) 
    162219    { 
    163220        maaliAani.Play(); 
    164         MessageDisplay.Add("Keräsit tähden!"); 
    165         tahti.Destroy(); 
     221        MessageDisplay.Add("Keräsit Boxin!"); 
     222        Box.Destroy(); 
    166223    } 
    167224    void TormaaVihuun(PhysicsObject hahmo, PhysicsObject vihu) 
     
    171228        hahmo.Destroy(); 
    172229    } 
     230     void TormaaPiikkiin(PhysicsObject hahmo, PhysicsObject piikki) 
     231    { 
     232        maaliAani.Play(); 
     233        MessageDisplay.Add("You died"); 
     234        hahmo.Destroy(); 
     235    } 
    173236} 
  • 2016/24/MattiK/ZlandZ/ZlandZ/ZlandZ/ZlandZ.csproj.Debug.cachefile

    r7266 r7291  
    44Content\kentta1.xnb 
    55Content\vihu.xnb 
     6Content\Lintu.xnb 
     7Content\Piikki.xnb 
     8Content\box.xnb 
     9Content\boss.xnb 
     10Content\Jump17.xnb 
     11Content\gun.xnb 
  • 2016/24/MattiK/ZlandZ/ZlandZ/ZlandZ/obj/x86/Debug/ContentPipeline-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}.xml

    r7266 r7291  
    3636      <Options>None</Options> 
    3737      <Output>C:\MyTemp\MattiK\ZlandZ\ZlandZ\ZlandZ\bin\x86\Debug\Content\kentta1.xnb</Output> 
    38       <Time>2016-06-13T13:49:30.515756+03:00</Time> 
     38      <Time>2016-06-14T14:52:07.8748476+03:00</Time> 
    3939    </Item> 
    4040    <Item> 
     
    4646      <Output>C:\MyTemp\MattiK\ZlandZ\ZlandZ\ZlandZ\bin\x86\Debug\Content\vihu.xnb</Output> 
    4747      <Time>2016-06-13T11:18:00.8268075+03:00</Time> 
     48    </Item> 
     49    <Item> 
     50      <Source>Lintu.png</Source> 
     51      <Name>Lintu</Name> 
     52      <Importer>TextureImporter</Importer> 
     53      <Processor>TextureProcessor</Processor> 
     54      <Options>None</Options> 
     55      <Output>C:\MyTemp\MattiK\ZlandZ\ZlandZ\ZlandZ\bin\x86\Debug\Content\Lintu.xnb</Output> 
     56      <Time>2016-06-14T10:05:20.3102632+03:00</Time> 
     57    </Item> 
     58    <Item> 
     59      <Source>Piikki.png</Source> 
     60      <Name>Piikki</Name> 
     61      <Importer>TextureImporter</Importer> 
     62      <Processor>TextureProcessor</Processor> 
     63      <Options>None</Options> 
     64      <Output>C:\MyTemp\MattiK\ZlandZ\ZlandZ\ZlandZ\bin\x86\Debug\Content\Piikki.xnb</Output> 
     65      <Time>2016-06-14T10:20:32.7855016+03:00</Time> 
     66    </Item> 
     67    <Item> 
     68      <Source>box.png</Source> 
     69      <Name>box</Name> 
     70      <Importer>TextureImporter</Importer> 
     71      <Processor>TextureProcessor</Processor> 
     72      <Options>None</Options> 
     73      <Output>C:\MyTemp\MattiK\ZlandZ\ZlandZ\ZlandZ\bin\x86\Debug\Content\box.xnb</Output> 
     74      <Time>2016-06-14T12:22:30.0631562+03:00</Time> 
     75    </Item> 
     76    <Item> 
     77      <Source>boss.png</Source> 
     78      <Name>boss</Name> 
     79      <Importer>TextureImporter</Importer> 
     80      <Processor>TextureProcessor</Processor> 
     81      <Options>None</Options> 
     82      <Output>C:\MyTemp\MattiK\ZlandZ\ZlandZ\ZlandZ\bin\x86\Debug\Content\boss.xnb</Output> 
     83      <Time>2016-06-14T12:22:49.5281025+03:00</Time> 
     84    </Item> 
     85    <Item> 
     86      <Source>Jump17.wav</Source> 
     87      <Name>Jump17</Name> 
     88      <Importer>WavImporter</Importer> 
     89      <Processor>SoundEffectProcessor</Processor> 
     90      <Options>None</Options> 
     91      <Output>C:\MyTemp\MattiK\ZlandZ\ZlandZ\ZlandZ\bin\x86\Debug\Content\Jump17.xnb</Output> 
     92      <Time>2016-06-14T14:08:40.018088+03:00</Time> 
     93    </Item> 
     94    <Item> 
     95      <Source>gun.png</Source> 
     96      <Name>gun</Name> 
     97      <Importer>TextureImporter</Importer> 
     98      <Processor>TextureProcessor</Processor> 
     99      <Options>None</Options> 
     100      <Output>C:\MyTemp\MattiK\ZlandZ\ZlandZ\ZlandZ\bin\x86\Debug\Content\gun.xnb</Output> 
     101      <Time>2016-06-14T14:34:19.1299838+03:00</Time> 
    48102    </Item> 
    49103    <BuildSuccessful>true</BuildSuccessful> 
  • 2016/24/MattiK/ZlandZ/ZlandZ/ZlandZ/obj/x86/Debug/ZlandZ.csproj.FileListAbsolute.txt

    r7266 r7291  
    1212C:\MyTemp\MattiK\ZlandZ\ZlandZ\ZlandZ\obj\x86\Debug\ZlandZ.pdb 
    1313C:\MyTemp\MattiK\ZlandZ\ZlandZ\ZlandZ\bin\x86\Debug\Content\vihu.xnb 
     14C:\MyTemp\MattiK\ZlandZ\ZlandZ\ZlandZ\bin\x86\Debug\Content\Lintu.xnb 
     15C:\MyTemp\MattiK\ZlandZ\ZlandZ\ZlandZ\bin\x86\Debug\Content\Piikki.xnb 
     16C:\MyTemp\MattiK\ZlandZ\ZlandZ\ZlandZ\bin\x86\Debug\Content\box.xnb 
     17C:\MyTemp\MattiK\ZlandZ\ZlandZ\ZlandZ\bin\x86\Debug\Content\boss.xnb 
     18C:\MyTemp\MattiK\ZlandZ\ZlandZ\ZlandZ\bin\x86\Debug\Content\Jump17.xnb 
     19C:\MyTemp\MattiK\ZlandZ\ZlandZ\ZlandZ\bin\x86\Debug\Content\gun.xnb 
  • 2016/24/MattiK/ZlandZ/ZlandZ/ZlandZ/obj/x86/Debug/cachefile-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}-targetpath.txt

    r7266 r7291  
    44Content\kentta1.xnb 
    55Content\vihu.xnb 
     6Content\Lintu.xnb 
     7Content\Piikki.xnb 
     8Content\box.xnb 
     9Content\boss.xnb 
     10Content\Jump17.xnb 
     11Content\gun.xnb 
  • 2016/24/MattiK/ZlandZ/ZlandZ/ZlandZContent/ZlandZContent.contentproj

    r7266 r7291  
    7474    </Compile> 
    7575  </ItemGroup> 
     76  <ItemGroup> 
     77    <Compile Include="Lintu.png"> 
     78      <Name>Lintu</Name> 
     79      <Importer>TextureImporter</Importer> 
     80      <Processor>TextureProcessor</Processor> 
     81    </Compile> 
     82  </ItemGroup> 
     83  <ItemGroup> 
     84    <Compile Include="Piikki.png"> 
     85      <Name>Piikki</Name> 
     86      <Importer>TextureImporter</Importer> 
     87      <Processor>TextureProcessor</Processor> 
     88    </Compile> 
     89  </ItemGroup> 
     90  <ItemGroup> 
     91    <Compile Include="box.png"> 
     92      <Name>box</Name> 
     93      <Importer>TextureImporter</Importer> 
     94      <Processor>TextureProcessor</Processor> 
     95    </Compile> 
     96  </ItemGroup> 
     97  <ItemGroup> 
     98    <Compile Include="boss.png"> 
     99      <Name>boss</Name> 
     100      <Importer>TextureImporter</Importer> 
     101      <Processor>TextureProcessor</Processor> 
     102    </Compile> 
     103  </ItemGroup> 
     104  <ItemGroup> 
     105    <Compile Include="Jump17.wav"> 
     106      <Name>Jump17</Name> 
     107      <Importer>WavImporter</Importer> 
     108      <Processor>SoundEffectProcessor</Processor> 
     109    </Compile> 
     110  </ItemGroup> 
     111  <ItemGroup> 
     112    <Compile Include="gun.png"> 
     113      <Name>gun</Name> 
     114      <Importer>TextureImporter</Importer> 
     115      <Processor>TextureProcessor</Processor> 
     116    </Compile> 
     117  </ItemGroup> 
    76118  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    77119  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2016/24/MattiK/ZlandZ/ZlandZ/ZlandZContent/kentta1.txt

    r7266 r7291  
    1          * 
    2          ## 
    3  
    4        *    * 
    5        ##  ## 
    6  
    7      *        * 
    8      ##  ##  ## 
    9  
    10    *    *  *    *      
    11    ##  ##  ##  ##                           S 
    12                                             #      S  S           S S  S  S S SS SS  S  SS S S   
    13  *    *       *   *                    S          #######    ####################################### 
    14  ##  ##  ##  ##  ##                    ###    
    15  
    16       N                                PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP     
     1      
     2          
     3          
     4          
     5         N 
     6          
     7          
     8                                                                                                                               S S 
     9                                                                                                                              ##### 
     10                                                                                                                                      S 
     11                                                                                                                                     #### 
     12                                                                                                                                             S 
     13                                                                                                                                            ### 
     14                                                                       S  S       bb    S S  S  S S SS SS  S  SS S S                  S 
     15                     S        b            S    S    S    S    S       #######    #######################################    ####   ####   ### 
     16                     ####    ####     ##   ##   ##   ##   ##   ##   # 
     17     
     18          G  b  b  b                       PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP     
    1719################################################################################################################################################ 
Note: See TracChangeset for help on using the changeset viewer.