Changeset 8639


Ignore:
Timestamp:
2017-06-14 11:55:44 (6 years ago)
Author:
npo17_12
Message:

Sain slime animaation peliin mukaan.

Location:
2017/24/GregoryK/LimaPeli
Files:
12 added
4 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • 2017/24/GregoryK/LimaPeli/LimaPeli/LimaPeli/LimaPeli.cs

    r8600 r8639  
    99public class LimaPeli : PhysicsGame 
    1010{ 
     11    private Animation limanKavely; 
    1112    const double nopeus = 200; 
    1213    const double hyppyNopeus = 550; 
     
    1516    PlatformCharacter pelaaja1; 
    1617 
    17     Image pelaajanKuva = LoadImage("lima2"); 
     18    Image pelaajanKuva = LoadImage("slime\\slime1"); 
    1819    Image tahtiKuva = LoadImage("dorito"); 
     20    int kenttaNro = 1; 
    1921 
    2022 
    2123    public override void Begin() 
    2224    { 
    23         Gravity = new Vector(0, -500); 
    24  
    25         LuoKentta(); 
    26         LisaaNappaimet(); 
    27  
    28         Camera.Follow(pelaaja1); 
    29         Camera.ZoomFactor = 1.2; 
    30         Camera.StayInLevel = true; 
     25        SeuraavaKentta(); 
    3126    } 
    3227 
    33     void LuoKentta() 
     28    void SeuraavaKentta() 
    3429    { 
    35         TileMap kentta = TileMap.FromLevelAsset("kentta1"); 
     30        ClearAll(); 
     31 
     32        if (kenttaNro == 1) LuoKentta("kentta1"); 
     33        else if (kenttaNro == 2) LuoKentta("kentta2"); 
     34        else if (kenttaNro == 3) LuoKentta("kentta3"); 
     35        else if (kenttaNro > 3) Exit(); 
     36 
     37        LisaaNappaimet(); 
     38    } 
     39         
     40     
     41 
     42    void LuoKentta(string kenttaTiedostonNimi) 
     43    { 
     44        limanKavely = LoadAnimation("slime"); 
     45        TileMap kentta = TileMap.FromLevelAsset(kenttaTiedostonNimi); 
    3646        kentta.SetTileMethod('#', LisaaTaso); 
    3747        kentta.SetTileMethod('*', LisaaTahti); 
     
    4151        //Level.Background.CreateGradient(Color.White, Color.SkyBlue); 
    4252        Level.Background.Color = Color.Gray; 
    43          
     53  
     54        Gravity = new Vector(0, -500); 
     55 
     56        //LuoKentta(); 
     57        //LisaaNappaimet(); 
     58 
     59        Camera.Follow(pelaaja1); 
     60        Camera.ZoomFactor = 1.2; 
     61        Camera.StayInLevel = true; 
     62    } 
     63 
     64    void TormasiMaaliin(PhysicsObject slime, PhysicsObject maali) 
     65    { 
     66        //Kasvatetaan kenttänumeroa yhdellä ja siirrytään seuraavaan kenttään: 
     67        kenttaNro++; 
     68        SeuraavaKentta(); 
     69    } 
     70 
     71    void TormasiPiikkiin(PhysicsObject slime, PhysicsObject piikki) 
     72    { 
     73        //Sama kenttä ladataan alusta jos kenttänumeroa ei kasvateta: 
     74        SeuraavaKentta(); 
    4475    } 
    4576 
     
    6495    void LisaaPelaaja(Vector paikka, double leveys, double korkeus) 
    6596    { 
     97     
    6698        pelaaja1 = new PlatformCharacter(leveys, korkeus); 
    6799        pelaaja1.Position = paikka; 
     
    69101        pelaaja1.Image = pelaajanKuva; 
    70102        AddCollisionHandler(pelaaja1, "tahti", TormaaTahteen); 
     103        pelaaja1.Animation = new Animation(limanKavely); 
     104        pelaaja1.Animation.Start(); 
    71105        Add(pelaaja1); 
    72106    } 
  • 2017/24/GregoryK/LimaPeli/LimaPeli/LimaPeli/LimaPeli.csproj.Debug.cachefile

    r8600 r8639  
    11Content\maali.xnb 
    22Content\kentta1.xnb 
    3 Content\lima.xnb 
    43Content\dorito.xnb 
    54Content\slime background.xnb 
    6 Content\lima2.xnb 
     5Content\slime.xnb 
     6Content\slime\slime1.xnb 
     7Content\slime\slime2.xnb 
     8Content\slime\slime3_0.xnb 
     9Content\slime\slime4_0.xnb 
  • 2017/24/GregoryK/LimaPeli/LimaPeli/LimaPeli/obj/x86/Debug/ContentPipeline-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}.xml

    r8600 r8639  
    2121    </Item> 
    2222    <Item> 
    23       <Source>lima.png</Source> 
    24       <Name>lima</Name> 
    25       <Importer>TextureImporter</Importer> 
    26       <Processor>TextureProcessor</Processor> 
    27       <Options>None</Options> 
    28       <Output>C:\MyTemp\GregoryK\LimaPeli\LimaPeli\LimaPeli\bin\x86\Debug\Content\lima.xnb</Output> 
    29       <Time>2017-06-13T11:13:37.5574996+03:00</Time> 
    30     </Item> 
    31     <Item> 
    3223      <Source>dorito.png</Source> 
    3324      <Name>dorito</Name> 
     
    4839    </Item> 
    4940    <Item> 
    50       <Source>lima2.png</Source> 
    51       <Name>lima2</Name> 
     41      <Source>slime.anim</Source> 
     42      <Name>slime</Name> 
     43      <Importer>AnimationImporter</Importer> 
     44      <Processor>AnimationContentProcessor</Processor> 
     45      <Options>None</Options> 
     46      <Output>C:\MyTemp\GregoryK\LimaPeli\LimaPeli\LimaPeli\bin\x86\Debug\Content\slime.xnb</Output> 
     47      <Time>2017-06-14T11:05:09.7369882+03:00</Time> 
     48      <Request>C:\MyTemp\GregoryK\LimaPeli\LimaPeli\LimaPeli\bin\x86\Debug\Content\slime\slime1.xnb</Request> 
     49      <Request>C:\MyTemp\GregoryK\LimaPeli\LimaPeli\LimaPeli\bin\x86\Debug\Content\slime\slime2.xnb</Request> 
     50      <Request>C:\MyTemp\GregoryK\LimaPeli\LimaPeli\LimaPeli\bin\x86\Debug\Content\slime\slime3_0.xnb</Request> 
     51      <Request>C:\MyTemp\GregoryK\LimaPeli\LimaPeli\LimaPeli\bin\x86\Debug\Content\slime\slime4_0.xnb</Request> 
     52    </Item> 
     53    <Item> 
     54      <Source>slime\slime1.png</Source> 
     55      <Name>slime\slime1</Name> 
    5256      <Importer>TextureImporter</Importer> 
    5357      <Processor>TextureProcessor</Processor> 
    5458      <Options>None</Options> 
    55       <Output>C:\MyTemp\GregoryK\LimaPeli\LimaPeli\LimaPeli\bin\x86\Debug\Content\lima2.xnb</Output> 
    56       <Time>2017-06-13T12:45:11.0549912+03:00</Time> 
     59      <Output>C:\MyTemp\GregoryK\LimaPeli\LimaPeli\LimaPeli\bin\x86\Debug\Content\slime\slime1.xnb</Output> 
     60      <Time>2017-06-13T14:53:50.0950627+03:00</Time> 
     61    </Item> 
     62    <Item> 
     63      <Source>slime\slime2.png</Source> 
     64      <Name>slime\slime2</Name> 
     65      <Importer>TextureImporter</Importer> 
     66      <Processor>TextureProcessor</Processor> 
     67      <Options>None</Options> 
     68      <Output>C:\MyTemp\GregoryK\LimaPeli\LimaPeli\LimaPeli\bin\x86\Debug\Content\slime\slime2.xnb</Output> 
     69      <Time>2017-06-13T14:53:54.0385518+03:00</Time> 
     70    </Item> 
     71    <Item> 
     72      <Source>slime\slime3.png</Source> 
     73      <Importer>TextureImporter</Importer> 
     74      <Processor>TextureProcessor</Processor> 
     75      <Options>None</Options> 
     76      <Output>C:\MyTemp\GregoryK\LimaPeli\LimaPeli\LimaPeli\bin\x86\Debug\Content\slime\slime3_0.xnb</Output> 
     77      <Time>2017-06-14T10:17:32.8307018+03:00</Time> 
     78    </Item> 
     79    <Item> 
     80      <Source>slime\slime4.png</Source> 
     81      <Importer>TextureImporter</Importer> 
     82      <Processor>TextureProcessor</Processor> 
     83      <Options>None</Options> 
     84      <Output>C:\MyTemp\GregoryK\LimaPeli\LimaPeli\LimaPeli\bin\x86\Debug\Content\slime\slime4_0.xnb</Output> 
     85      <Time>2017-06-14T10:48:12.2319619+03:00</Time> 
    5786    </Item> 
    5887    <BuildSuccessful>true</BuildSuccessful> 
  • 2017/24/GregoryK/LimaPeli/LimaPeli/LimaPeli/obj/x86/Debug/LimaPeli.csproj.FileListAbsolute.txt

    r8600 r8639  
    99C:\MyTemp\GregoryK\LimaPeli\LimaPeli\LimaPeli\obj\x86\Debug\LimaPeli.exe 
    1010C:\MyTemp\GregoryK\LimaPeli\LimaPeli\LimaPeli\obj\x86\Debug\LimaPeli.pdb 
    11 C:\MyTemp\GregoryK\LimaPeli\LimaPeli\LimaPeli\bin\x86\Debug\Content\lima.xnb 
    1211C:\MyTemp\GregoryK\LimaPeli\LimaPeli\LimaPeli\bin\x86\Debug\Content\dorito.xnb 
    1312C:\MyTemp\GregoryK\LimaPeli\LimaPeli\LimaPeli\bin\x86\Debug\Content\slime background.xnb 
    14 C:\MyTemp\GregoryK\LimaPeli\LimaPeli\LimaPeli\bin\x86\Debug\Content\lima2.xnb 
     13C:\MyTemp\GregoryK\LimaPeli\LimaPeli\LimaPeli\bin\x86\Debug\Content\slime.xnb 
     14C:\MyTemp\GregoryK\LimaPeli\LimaPeli\LimaPeli\bin\x86\Debug\Content\slime\slime1.xnb 
     15C:\MyTemp\GregoryK\LimaPeli\LimaPeli\LimaPeli\bin\x86\Debug\Content\slime\slime2.xnb 
     16C:\MyTemp\GregoryK\LimaPeli\LimaPeli\LimaPeli\bin\x86\Debug\Content\slime\slime3_0.xnb 
     17C:\MyTemp\GregoryK\LimaPeli\LimaPeli\LimaPeli\bin\x86\Debug\Content\slime\slime4_0.xnb 
  • 2017/24/GregoryK/LimaPeli/LimaPeli/LimaPeli/obj/x86/Debug/cachefile-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}-targetpath.txt

    r8600 r8639  
    11Content\maali.xnb 
    22Content\kentta1.xnb 
    3 Content\lima.xnb 
    43Content\dorito.xnb 
    54Content\slime background.xnb 
    6 Content\lima2.xnb 
     5Content\slime.xnb 
     6Content\slime\slime1.xnb 
     7Content\slime\slime2.xnb 
     8Content\slime\slime3_0.xnb 
     9Content\slime\slime4_0.xnb 
  • 2017/24/GregoryK/LimaPeli/LimaPeli/LimaPeliContent/LimaPeliContent.contentproj

    r8600 r8639  
    5858  </ItemGroup> 
    5959  <ItemGroup> 
    60     <Compile Include="lima.png"> 
    61       <Name>lima</Name> 
    62       <Importer>TextureImporter</Importer> 
    63       <Processor>TextureProcessor</Processor> 
    64     </Compile> 
    65   </ItemGroup> 
    66   <ItemGroup> 
    6760    <Compile Include="dorito.png"> 
    6861      <Name>dorito</Name> 
     
    7972  </ItemGroup> 
    8073  <ItemGroup> 
    81     <Compile Include="lima2.png"> 
    82       <Name>lima2</Name> 
     74    <Compile Include="slime.anim"> 
     75      <Name>slime</Name> 
     76      <Importer>AnimationImporter</Importer> 
     77      <Processor>AnimationContentProcessor</Processor> 
     78    </Compile> 
     79  </ItemGroup> 
     80  <ItemGroup /> 
     81  <ItemGroup> 
     82    <Compile Include="slime\slime1.png"> 
     83      <Name>slime1</Name> 
     84      <Importer>TextureImporter</Importer> 
     85      <Processor>TextureProcessor</Processor> 
     86    </Compile> 
     87  </ItemGroup> 
     88  <ItemGroup> 
     89    <Compile Include="slime\slime2.png"> 
     90      <Name>slime2</Name> 
    8391      <Importer>TextureImporter</Importer> 
    8492      <Processor>TextureProcessor</Processor> 
Note: See TracChangeset for help on using the changeset viewer.