Changeset 5952 for 2015/24


Ignore:
Timestamp:
2015-06-09 15:05:18 (8 years ago)
Author:
tocholmo
Message:

Ensimmäinen taso tehty, Seuraava tekevänä

Location:
2015/24/TomasC
Files:
15 added
1 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • 2015/24/TomasC/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1.cs

    r5920 r5952  
    1414 
    1515    PlatformCharacter pelaaja1; 
     16    int kenttaNro = 1; 
     17     
    1618 
    1719    Image pelaajanKuva = LoadImage("norsu"); 
     
    2022    SoundEffect maaliAani = LoadSoundEffect("maali"); 
    2123 
     24    Image taustakuva = LoadImage("BR"); 
     25   
    2226    public override void Begin() 
    2327    { 
     28        LataaKentta(); 
     29    } 
     30 
     31    void LataaKentta() 
     32    { 
     33        ClearAll(); 
     34 
    2435        Gravity = new Vector(0, -1000); 
    2536 
    26         LuoKentta(); 
     37        IsFullScreen = true; 
     38 
     39        LuoKentta("kentta"+kenttaNro); 
    2740        LisaaNappaimet(); 
    2841 
    2942        Camera.Follow(pelaaja1); 
    30         Camera.ZoomFactor = 1.2; 
     43        Camera.ZoomFactor = 2.0; 
    3144        Camera.StayInLevel = true; 
    3245    } 
    3346 
    34     void LuoKentta() 
     47    void seuraavakentta() 
    3548    { 
    36         TileMap kentta = TileMap.FromLevelAsset("kentta1"); 
    37         kentta.SetTileMethod('K', Lisaahirvio); 
    38         kentta.SetTileMethod('#', LisaaTaso); 
    39         kentta.SetTileMethod('*', LisaaTahti); 
    40         kentta.SetTileMethod('N', LisaaPelaaja); 
    41         kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 
     49        kenttaNro++; 
     50        LataaKentta(); 
     51    } 
     52 
     53    void LuoKentta(string kentta) 
     54    { 
     55        ColorTileMap ruudut = ColorTileMap.FromLevelAsset(kentta); 
     56 
     57        ruudut.SetTileMethod(Color.Black, Lisaahirvio); 
     58        ruudut.SetTileMethod(Color.Rose, LisaaTaso); 
     59        ruudut.SetTileMethod(Color.Red, LisaaTahti); 
     60        ruudut.SetTileMethod(Color.Gold, LisaaPelaaja); 
     61        ruudut.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 
    4262        Level.CreateBorders(); 
    43         Level.Background.CreateGradient(Color.White, Color.SkyBlue); 
     63        Level.Background.Image = taustakuva; 
    4464    } 
    4565 
     
    4969        taso.Position = paikka; 
    5070        taso.Color = Color.Green; 
     71        taso.CollisionIgnoreGroup = 3; 
    5172        Add(taso); 
    5273    } 
     
    7091        AddCollisionHandler(pelaaja1, "tahti", TormaaTahteen); 
    7192        AddCollisionHandler(pelaaja1, "Jarmo", TormaaShrek); 
    72  
     93        pelaaja1.Tag = "Jimmy"; 
    7394        Add(pelaaja1); 
    7495    } 
     
    99120    void Hyppaa(PlatformCharacter hahmo, double nopeus) 
    100121    { 
     122         
    101123        hahmo.Jump(nopeus); 
    102124    } 
     
    110132    void Lisaahirvio(Vector paikka, double leveys, double korkeus) 
    111133    { 
    112         PhysicsObject Jarmo = PhysicsObject.CreateStaticObject(leveys, korkeus); 
     134        PhysicsObject Jarmo = new PhysicsObject(leveys, korkeus); 
    113135        Jarmo.Position = paikka; 
    114         Jarmo.Image = tahtiKuva; 
     136        Jarmo.Image = LoadImage("Jarmo"); 
    115137        Jarmo.Tag = "Jarmo"; 
    116138        Add(Jarmo); 
     139 
     140        FollowerBrain seuraajanAivot = new FollowerBrain("Jimmy"); 
     141        Jarmo.Brain = seuraajanAivot; 
     142        seuraajanAivot.Speed = 100; 
     143        seuraajanAivot.DistanceFar = 2000; 
     144        seuraajanAivot.DistanceClose = 2000; 
     145        seuraajanAivot.StopWhenTargetClose = false; 
     146        seuraajanAivot.Active = true; 
     147        Jarmo.CollisionIgnoreGroup = 3; 
     148 
     149  
    117150    } 
    118151    void TormaaShrek(PhysicsObject hahmo, PhysicsObject Jarmo) 
     
    121154        maaliAani.Play(); 
    122155        MessageDisplay.Add("GET OUT OF ME SWAMP"); 
     156        rajaytaShrek(Jarmo, LoadImage("Snipe"), 100); 
     157        rajaytaShrek(Jarmo, LoadImage("Shrekt"), 200); 
     158        rajaytaShrek(Jarmo, LoadImage("MD"), 100); 
     159        Timer.SingleShot(3.0, LataaKentta); 
     160 
     161         
    123162    } 
     163    void rajaytaShrek(PhysicsObject Jarmo, Image kuva, int pMax) 
     164    { 
     165         
     166        ExplosionSystem rajahdys = new ExplosionSystem(kuva, pMax); 
     167        rajahdys.Position = Jarmo.Position; 
     168 
     169        Add(rajahdys); 
     170        rajahdys.AddEffect(Jarmo.X, Jarmo.Y, pMax); 
     171    } 
     172    void Pelaaja1Tormasi(PhysicsObject pelaaja1, PhysicsObject Jarmo) 
     173    { 
     174         
     175         
     176          LataaKentta(); 
     177         
    124178} 
     179 
     180 } 
  • 2015/24/TomasC/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1.csproj.Debug.cachefile

    r5920 r5952  
    22Content\norsu.xnb 
    33Content\tahti.xnb 
    4 Content\kentta1.xnb 
     4Content\Jarmo.xnb 
     5Content\Shrekt.xnb 
     6Content\Snipe.xnb 
     7Content\MD.xnb 
     8Content\BR.xnb 
     9Content\Kentta1.xnb 
     10Content\Kentta1.png 
  • 2015/24/TomasC/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1/obj/x86/Debug/ContentPipeline-{B88964E3-D150-4A29-8542-EAE6F8D61D58}.xml

    r5920 r5952  
    3030    </Item> 
    3131    <Item> 
    32       <Source>kentta1.txt</Source> 
    33       <Name>kentta1</Name> 
    34       <Importer>TextFileImporter</Importer> 
    35       <Processor>TextFileContentProcessor</Processor> 
     32      <Source>Jarmo.png</Source> 
     33      <Name>Jarmo</Name> 
     34      <Importer>TextureImporter</Importer> 
     35      <Processor>TextureProcessor</Processor> 
    3636      <Options>None</Options> 
    37       <Output>C:\MyTemp\TomasC\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\kentta1.xnb</Output> 
    38       <Time>2015-06-08T14:39:43.4289912+03:00</Time> 
     37      <Output>C:\MyTemp\TomasC\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\Jarmo.xnb</Output> 
     38      <Time>2015-06-09T09:52:55.1770641+03:00</Time> 
     39    </Item> 
     40    <Item> 
     41      <Source>Shrekt.png</Source> 
     42      <Name>Shrekt</Name> 
     43      <Importer>TextureImporter</Importer> 
     44      <Processor>TextureProcessor</Processor> 
     45      <Options>None</Options> 
     46      <Output>C:\MyTemp\TomasC\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\Shrekt.xnb</Output> 
     47      <Time>2015-06-09T10:51:45.2556641+03:00</Time> 
     48    </Item> 
     49    <Item> 
     50      <Source>Snipe.png</Source> 
     51      <Name>Snipe</Name> 
     52      <Importer>TextureImporter</Importer> 
     53      <Processor>TextureProcessor</Processor> 
     54      <Options>None</Options> 
     55      <Output>C:\MyTemp\TomasC\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\Snipe.xnb</Output> 
     56      <Time>2015-06-09T11:12:17.8351641+03:00</Time> 
     57    </Item> 
     58    <Item> 
     59      <Source>MD.png</Source> 
     60      <Name>MD</Name> 
     61      <Importer>TextureImporter</Importer> 
     62      <Processor>TextureProcessor</Processor> 
     63      <Options>None</Options> 
     64      <Output>C:\MyTemp\TomasC\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\MD.xnb</Output> 
     65      <Time>2015-06-09T11:16:46.8034641+03:00</Time> 
     66    </Item> 
     67    <Item> 
     68      <Source>BR.png</Source> 
     69      <Name>BR</Name> 
     70      <Importer>TextureImporter</Importer> 
     71      <Processor>TextureProcessor</Processor> 
     72      <Options>None</Options> 
     73      <Output>C:\MyTemp\TomasC\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\BR.xnb</Output> 
     74      <Time>2015-06-09T11:49:32.1894641+03:00</Time> 
     75    </Item> 
     76    <Item> 
     77      <Source>Kentta1.png</Source> 
     78      <Name>Kentta1</Name> 
     79      <Importer>TextureImporter</Importer> 
     80      <Processor>TextureProcessor</Processor> 
     81      <Options>None</Options> 
     82      <Output>C:\MyTemp\TomasC\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\Kentta1.xnb</Output> 
     83      <Time>2015-06-09T14:40:41.5936641+03:00</Time> 
    3984    </Item> 
    4085    <BuildSuccessful>true</BuildSuccessful> 
  • 2015/24/TomasC/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1/obj/x86/Debug/Tasohyppelypeli1.csproj.FileListAbsolute.txt

    r5920 r5952  
    1111C:\MyTemp\TomasC\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\obj\x86\Debug\Tasohyppelypeli1.exe 
    1212C:\MyTemp\TomasC\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\obj\x86\Debug\Tasohyppelypeli1.pdb 
     13C:\MyTemp\TomasC\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\Jarmo.xnb 
     14C:\MyTemp\TomasC\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\Shrekt.xnb 
     15C:\MyTemp\TomasC\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\Snipe.xnb 
     16C:\MyTemp\TomasC\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\MD.xnb 
     17C:\MyTemp\TomasC\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\BR.xnb 
     18C:\MyTemp\TomasC\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\Kentta1.png 
  • 2015/24/TomasC/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1/obj/x86/Debug/cachefile-{B88964E3-D150-4A29-8542-EAE6F8D61D58}-targetpath.txt

    r5920 r5952  
    22Content\norsu.xnb 
    33Content\tahti.xnb 
    4 Content\kentta1.xnb 
     4Content\Jarmo.xnb 
     5Content\Shrekt.xnb 
     6Content\Snipe.xnb 
     7Content\MD.xnb 
     8Content\BR.xnb 
     9Content\Kentta1.xnb 
     10Content\Kentta1.png 
  • 2015/24/TomasC/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1Content/Tasohyppelypeli1Content.contentproj

    r5920 r5952  
    6161      <Processor>TextureProcessor</Processor> 
    6262    </Compile> 
    63     <Compile Include="kentta1.txt"> 
    64       <Name>kentta1</Name> 
    65       <Importer>TextFileImporter</Importer> 
    66       <Processor>TextFileContentProcessor</Processor> 
     63  </ItemGroup> 
     64  <ItemGroup> 
     65    <Compile Include="Jarmo.png"> 
     66      <Name>Jarmo</Name> 
     67      <Importer>TextureImporter</Importer> 
     68      <Processor>TextureProcessor</Processor> 
     69    </Compile> 
     70  </ItemGroup> 
     71  <ItemGroup> 
     72    <Compile Include="Shrekt.png"> 
     73      <Name>Shrekt</Name> 
     74      <Importer>TextureImporter</Importer> 
     75      <Processor>TextureProcessor</Processor> 
     76    </Compile> 
     77  </ItemGroup> 
     78  <ItemGroup> 
     79    <Compile Include="Snipe.png"> 
     80      <Name>Snipe</Name> 
     81      <Importer>TextureImporter</Importer> 
     82      <Processor>TextureProcessor</Processor> 
     83    </Compile> 
     84  </ItemGroup> 
     85  <ItemGroup> 
     86    <Compile Include="MD.png"> 
     87      <Name>MD</Name> 
     88      <Importer>TextureImporter</Importer> 
     89      <Processor>TextureProcessor</Processor> 
     90    </Compile> 
     91  </ItemGroup> 
     92  <ItemGroup> 
     93    <Compile Include="BR.png"> 
     94      <Name>BR</Name> 
     95      <Importer>TextureImporter</Importer> 
     96      <Processor>TextureProcessor</Processor> 
     97    </Compile> 
     98  </ItemGroup> 
     99  <ItemGroup> 
     100    <Compile Include="Kentta1.png"> 
     101      <Name>Kentta1</Name> 
     102      <Importer>TextureImporter</Importer> 
     103      <Processor>TextureProcessor</Processor> 
     104      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    67105    </Compile> 
    68106  </ItemGroup> 
Note: See TracChangeset for help on using the changeset viewer.