Changeset 8246 for 2016/30


Ignore:
Timestamp:
2016-07-29 11:39:58 (7 years ago)
Author:
ukjupenn
Message:
 
Location:
2016/30/JuhaniP
Files:
21 added
20 edited

Legend:

Unmodified
Added
Removed
  • 2016/30/JuhaniP/Gunjump/Gunjump/Gunjump/Gunjump.cs

    r8123 r8246  
    1212    const double hyppyNopeus = 750; 
    1313    const int RUUDUN_KOKO = 40; 
    14  
    1514    PlatformCharacter pelaaja1; 
    16  
     15    PhysicsObject vihollinen; 
    1716    Image pelaajanKuva = LoadImage("norsu"); 
    1817    Image tahtiKuva = LoadImage("tahti"); 
    19  
     18    Image mutantman = LoadImage("mutantman"); 
    2019    SoundEffect maaliAani = LoadSoundEffect("maali"); 
    21  
     20    Image ovenkuva = LoadImage("ruskeaovi"); 
    2221    public override void Begin() 
    2322    { 
     23        Aloitapeli(); 
     24        
     25    } 
     26    void Aloitapeli() 
     27    { 
     28        ClearAll(); 
    2429        Gravity = new Vector(0, -1000); 
    25  
    2630        LuoKentta(); 
    2731        LisaaNappaimet(); 
    28  
    2932        Camera.Follow(pelaaja1); 
    3033        Camera.ZoomFactor = 1.2; 
    3134        Camera.StayInLevel = true; 
    3235    } 
    33  
    3436    void LuoKentta() 
    3537    { 
    3638        TileMap kentta = TileMap.FromLevelAsset("kentta1"); 
    3739        kentta.SetTileMethod('#', LisaaTaso); 
     40        kentta.SetTileMethod('N', LisaaPelaaja); 
    3841        kentta.SetTileMethod('*', LisaaTahti); 
    39         kentta.SetTileMethod('N', LisaaPelaaja); 
     42        kentta.SetTileMethod('V', LisaaVihollinen); 
     43        kentta.SetTileMethod('L', Lisaaovi); 
     44 
    4045        kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 
    4146        Level.CreateBorders(); 
     
    6166    } 
    6267 
     68 
     69    // Aliohjelma joka ajetaan kun olio on tarpeeksi lähellä kohdetta. 
     70    void mitaTapahtuuKunOllaanLahella(AssaultRifle vihollisenase) 
     71    { 
     72        VihollinenAmmuPyssylla(vihollisenase); 
     73 
     74 
     75    } 
    6376    void LisaaPelaaja(Vector paikka, double leveys, double korkeus) 
     77 
    6478    { 
    6579        pelaaja1 = new PlatformCharacter(leveys, korkeus); 
    6680        pelaaja1.Position = paikka; 
     81        pelaaja1.Tag = "soturi"; 
    6782        pelaaja1.Mass = 4.0; 
    6883        pelaaja1.Image = pelaajanKuva; 
    6984        AddCollisionHandler(pelaaja1, "tahti", TormaaTahteen); 
     85        AddCollisionHandler(pelaaja1, "voitto", TormaaOveen); 
    7086        Add(pelaaja1); 
    7187        pelaaja1.Weapon = new AssaultRifle(30, 10); 
    72          
     88 
     89    } 
     90    void LisaaVihollinen(Vector paikka, double leveys, double korkeus) 
     91    { 
     92 
     93        vihollinen = new PhysicsObject(leveys, korkeus); 
     94        vihollinen.Image = mutantman; 
     95        vihollinen.Tag = "mutantman"; 
     96        vihollinen.Position = paikka; 
     97        vihollinen.CanRotate = false; 
     98        // RandomMoverBrain satunnaisAivot = new RandomMoverBrain(200); 
     99        Add(vihollinen); 
     100        AssaultRifle vihollisenase = new AssaultRifle(40, 40); 
     101        vihollisenase.FireRate = 5.0; 
     102        vihollisenase.ProjectileCollision = ammusosuu; 
     103 
     104        vihollinen.Add(vihollisenase); 
     105        FollowerBrain seuraajanAivot = new FollowerBrain("soturi"); 
     106 
     107        seuraajanAivot.Active = true; 
     108        seuraajanAivot.Speed = 300;                 // Millä nopeudella kohdetta seurataan 
     109        seuraajanAivot.DistanceFar = 600;           // Etäisyys jolla aletaan seurata kohdetta 
     110        seuraajanAivot.DistanceClose = 200;         // Etäisyys jolloin ollaan lähellä kohdetta 
     111        seuraajanAivot.StopWhenTargetClose = true;  // Pysähdytään kun ollaan lähellä kohdetta 
     112                                                    //seuraajanAivot.FarBrain = satunnaisAivot;   // Käytetään satunnaisaivoja kun ollaan kaukana 
     113        seuraajanAivot.TargetClose += delegate { mitaTapahtuuKunOllaanLahella(vihollisenase); }; 
     114 
     115        vihollinen.Brain = seuraajanAivot; 
     116        vihollinen.Brain.Active = true; 
    73117    } 
    74118 
     
    83127 
    84128        ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); 
    85  
     129        Keyboard.Listen(Key.Space, ButtonState.Down, PelaajaAmmuAseella, "Ammu", pelaaja1); 
    86130        ControllerOne.Listen(Button.DPadLeft, ButtonState.Down, Liikuta, "Pelaaja liikkuu vasemmalle", pelaaja1, -nopeus); 
    87131        ControllerOne.Listen(Button.DPadRight, ButtonState.Down, Liikuta, "Pelaaja liikkuu oikealle", pelaaja1, nopeus); 
     
    107151        tahti.Destroy(); 
    108152    } 
    109 } 
    110 void AmmuAseella(PlatformCharacter pelaaja) 
    111 { 
    112     PhysicsObject ammus = pelaaja.Weapon.Shoot(); 
    113  
    114     if (ammus != null) 
    115     { 
    116         //ammus.Size *= 3; 
    117         //ammus.Image = ... 
    118         //ammus.MaximumLifetime = TimeSpan.FromSeconds(2.0); 
    119     } 
    120     {  
     153 
     154    void PelaajaAmmuAseella(PlatformCharacter pelaaja) 
     155 
     156    { 
     157        PhysicsObject ammus = pelaaja.Weapon.Shoot(); 
     158 
     159        if (ammus != null) 
     160        { 
     161            AddCollisionHandler(ammus, "mutantman", ammusosuu); 
     162            //ammus.Size *= 3; 
     163            //ammus.Image = ... 
     164            ammus.MaximumLifetime = TimeSpan.FromSeconds(1.0); 
     165        } 
     166 
     167    } 
     168    //ammus.Destroy(); 
     169    void ammusosuu(PhysicsObject ammus, PhysicsObject kohde) 
     170    { 
     171 
     172        kohde.Destroy(); 
     173    } 
     174 
     175    void VihollinenAmmuPyssylla(AssaultRifle ase) 
     176 
     177    { 
     178        PhysicsObject ammus = ase.Shoot(); 
     179 
     180        if (ammus != null) 
     181        { 
     182            MessageDisplay.Add("Pumpam"); 
     183            AddCollisionHandler(ammus, "soturi", ammusosuu); 
     184            //ammus.Size *= 3; 
     185            //ammus.Image = ... 
     186            ammus.MaximumLifetime = TimeSpan.FromSeconds(1.0); 
     187        } 
     188 
     189    } 
     190 
     191    void Lisaaovi(Vector paikka,double leveys,double korkeus) 
     192    {   
     193        PhysicsObject ovi = new PhysicsObject(leveys, korkeus); 
     194        ovi.Shape = Shape.Rectangle; 
     195        ovi.Position = paikka; 
     196        ovi.Image = ovenkuva; 
     197        ovi.Tag = "voitto"; 
     198        Add(ovi); 
     199 
     200    } 
     201   void TormaaOveen(PhysicsObject pelaaja, PhysicsObject ovi) 
     202    { 
     203        Aloitapeli(); 
     204         
     205    } 
     206 
     207}  
     208     
     209     
  • 2016/30/JuhaniP/Gunjump/Gunjump/Gunjump/Gunjump.csproj.Debug.cachefile

    r8123 r8246  
    33Content\tahti.xnb 
    44Content\kentta1.xnb 
     5Content\mutantman.xnb 
     6Content\ruskeaovi.xnb 
     7Content\hyppy.xnb 
     8Content\laukaus.xnb 
     9Content\piste.xnb 
     10Content\voitto.xnb 
     11Content\mutantman.png 
  • 2016/30/JuhaniP/Gunjump/Gunjump/Gunjump/obj/x86/Debug/ContentPipeline-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}.xml

    r8123 r8246  
    1818      <Options>None</Options> 
    1919      <Output>C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\norsu.xnb</Output> 
    20       <Time>2016-07-26T14:24:47.4111271+03:00</Time> 
     20      <Time>2016-07-27T13:38:50.6191471+03:00</Time> 
    2121    </Item> 
    2222    <Item> 
     
    3636      <Options>None</Options> 
    3737      <Output>C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\kentta1.xnb</Output> 
    38       <Time>2016-07-26T14:49:02.1923271+03:00</Time> 
     38      <Time>2016-07-29T11:22:46.3154486+03:00</Time> 
     39    </Item> 
     40    <Item> 
     41      <Source>mutantman.png</Source> 
     42      <Name>mutantman</Name> 
     43      <Importer>TextureImporter</Importer> 
     44      <Processor>TextureProcessor</Processor> 
     45      <Options>None</Options> 
     46      <Output>C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\mutantman.xnb</Output> 
     47      <Time>2016-07-27T13:07:23.9907471+03:00</Time> 
     48    </Item> 
     49    <Item> 
     50      <Source>ruskeaovi.png</Source> 
     51      <Name>ruskeaovi</Name> 
     52      <Importer>TextureImporter</Importer> 
     53      <Processor>TextureProcessor</Processor> 
     54      <Options>None</Options> 
     55      <Output>C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\ruskeaovi.xnb</Output> 
     56      <Time>2016-07-28T14:31:34.9357777+03:00</Time> 
     57    </Item> 
     58    <Item> 
     59      <Source>hyppy.wav</Source> 
     60      <Name>hyppy</Name> 
     61      <Importer>WavImporter</Importer> 
     62      <Processor>SoundEffectProcessor</Processor> 
     63      <Options>None</Options> 
     64      <Output>C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\hyppy.xnb</Output> 
     65      <Time>2016-07-29T10:30:05.4666486+03:00</Time> 
     66    </Item> 
     67    <Item> 
     68      <Source>laukaus.wav</Source> 
     69      <Name>laukaus</Name> 
     70      <Importer>WavImporter</Importer> 
     71      <Processor>SoundEffectProcessor</Processor> 
     72      <Options>None</Options> 
     73      <Output>C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\laukaus.xnb</Output> 
     74      <Time>2016-07-29T10:30:05.4666486+03:00</Time> 
     75    </Item> 
     76    <Item> 
     77      <Source>piste.wav</Source> 
     78      <Name>piste</Name> 
     79      <Importer>WavImporter</Importer> 
     80      <Processor>SoundEffectProcessor</Processor> 
     81      <Options>None</Options> 
     82      <Output>C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\piste.xnb</Output> 
     83      <Time>2016-07-29T10:30:05.4666486+03:00</Time> 
     84    </Item> 
     85    <Item> 
     86      <Source>voitto.wav</Source> 
     87      <Name>voitto</Name> 
     88      <Importer>WavImporter</Importer> 
     89      <Processor>SoundEffectProcessor</Processor> 
     90      <Options>None</Options> 
     91      <Output>C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\voitto.xnb</Output> 
     92      <Time>2016-07-29T10:30:05.4666486+03:00</Time> 
    3993    </Item> 
    4094    <BuildSuccessful>true</BuildSuccessful> 
  • 2016/30/JuhaniP/Gunjump/Gunjump/Gunjump/obj/x86/Debug/Gunjump.csproj.FileListAbsolute.txt

    r8123 r8246  
    1111C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\obj\x86\Debug\Gunjump.exe 
    1212C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\obj\x86\Debug\Gunjump.pdb 
     13C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\mutantman.xnb 
     14C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\mutantman.png 
     15C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\ruskeaovi.xnb 
     16C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\hyppy.xnb 
     17C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\laukaus.xnb 
     18C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\piste.xnb 
     19C:\MyTemp\JuhaniP\Gunjump\Gunjump\Gunjump\bin\x86\Debug\Content\voitto.xnb 
  • 2016/30/JuhaniP/Gunjump/Gunjump/Gunjump/obj/x86/Debug/cachefile-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}-targetpath.txt

    r8123 r8246  
    33Content\tahti.xnb 
    44Content\kentta1.xnb 
     5Content\mutantman.xnb 
     6Content\ruskeaovi.xnb 
     7Content\hyppy.xnb 
     8Content\laukaus.xnb 
     9Content\piste.xnb 
     10Content\voitto.xnb 
     11Content\mutantman.png 
  • 2016/30/JuhaniP/Gunjump/Gunjump/GunjumpContent/GunjumpContent.contentproj

    r8123 r8246  
    6767    </Compile> 
    6868  </ItemGroup> 
     69  <ItemGroup> 
     70    <Compile Include="mutantman.png"> 
     71      <Name>mutantman</Name> 
     72      <Importer>TextureImporter</Importer> 
     73      <Processor>TextureProcessor</Processor> 
     74      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 
     75    </Compile> 
     76  </ItemGroup> 
     77  <ItemGroup> 
     78    <Compile Include="ruskeaovi.png"> 
     79      <Name>ruskeaovi</Name> 
     80      <Importer>TextureImporter</Importer> 
     81      <Processor>TextureProcessor</Processor> 
     82    </Compile> 
     83  </ItemGroup> 
     84  <ItemGroup> 
     85    <Compile Include="hyppy.wav"> 
     86      <Name>hyppy</Name> 
     87      <Importer>WavImporter</Importer> 
     88      <Processor>SoundEffectProcessor</Processor> 
     89    </Compile> 
     90    <Compile Include="laukaus.wav"> 
     91      <Name>laukaus</Name> 
     92      <Importer>WavImporter</Importer> 
     93      <Processor>SoundEffectProcessor</Processor> 
     94    </Compile> 
     95    <Compile Include="piste.wav"> 
     96      <Name>piste</Name> 
     97      <Importer>WavImporter</Importer> 
     98      <Processor>SoundEffectProcessor</Processor> 
     99    </Compile> 
     100    <Compile Include="voitto.wav"> 
     101      <Name>voitto</Name> 
     102      <Importer>WavImporter</Importer> 
     103      <Processor>SoundEffectProcessor</Processor> 
     104    </Compile> 
     105  </ItemGroup> 
    69106  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    70107  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2016/30/JuhaniP/Gunjump/Gunjump/GunjumpContent/kentta1.txt

    r8123 r8246  
    1          * 
    2          ## 
    3  
    4        *    * 
     1     VVVVVVVVVVVVVV                                                 VVVVV         V                     VVV     L 
     2    V    ############################################### ################# ###################### ################# 
     3  #### 
     4     # *V    * 
    55       ##  ## 
    66 
    77     *        * 
    8      ##  ##  ## 
    9  
    10    *    *  *    *      
    11    ##  ##  ##  ## 
    12  
    13  *    *       *   * 
    14  ##  ##  ##  ##  ## 
    15  
    16          
    17 ###################### 
    18  
    19  
    20  
    21  
    22  
    23  
    24  
    25  
    26  
    27  
    28  
    29  
    30  
    31  
    32  
    33  
    34  
    35  
    36  
    37                                              
    38                                                     ## 
    39                          #######################            ## 
    40                                                                                  ## 
    41                                                                             ## 
    42                                                  ********************   ###  
    43                                                  ##################### 
    44                                                                                                                                                           ##               ##            ##   
    45 *****************                                                                                                                   ##       ##              ## 
     8     ##  ##  ##VVVVVVVVV 
     9                   ####     VVVVVVV 
     10   VVVVVVVVVVV          ## # # # # # # # # # # # # # # # # #  
     11######################                                         # 
     12                                                                  # 
     13                                                                    #   V V   VV        V             V        V 
     14                                                                                                                                          # # # # # # # # # # # # # # # # # # # # #  # 
     15                                                                                                                                                                                        #################### 
     16                                                                                                            #### 
     17******************##*************VVVVVVVVVVVVVVVVVVV***                                                 # 
     18###########################################################################################################     ########################## 
     19                                                                                 #                            ### 
     20         #####        ## # # # #  #  # # # # # # # # # # # # # # # #   # # #             ##   # # # # # # #### 
     21                        ##                                                            ##    ##    ###   
     22########            ##                                                           #          ### 
     23 VVVVVVVVVV##VVVVV     ##                                                                ####### 
     24#################################################################################           ##  ## 
     25  ###   # #  #        #  #   #  # # #         ##           ...                  .  #          V   VV   V    #        V         
     26                                                                        #    ##      #    #     #   #    # 
     27                                                             ##            #                 # #######              ## 
     28                                                                   ##     #      #     #        #   #    #   #       # 
     29                                                      #         #       #        #   V   #    V         ##          ## 
     30                                    ## ################     #       #       #   #    ##             ##                             ## 
     31                                                                                 ##                      #       #     #    #        ##              ##                ##                 
     32                                                                            ##                                                          #   ##          ##                                  
     33                                                 ********************   ###                                                      ##               ##     ###############  # 
     34                                                 #####################                                                                                                                          
     35                                                                                                                                                          ##               ##           
     36*****************                                                                                              ##                     ##       ##                       
    4637####################                                                                                                                    ##            ## 
    47  
     38                                                                                                                                                                          
    4839                               #####                                                                                                      ##     ## 
    49                                                                       ###### 
    50                          ##                                                                                                                    ## 
    51                                            N*************************************************************************************************'      ## 
     40                                                                      ######                                                                                             
     41                         ##                                                                                                               ##     ## 
     42                               V          N*******************************************VVVVV**************************************************##****'      ## 
    5243################################################################################################################################################### 
Note: See TracChangeset for help on using the changeset viewer.