Changeset 1626 for 2010


Ignore:
Timestamp:
2010-08-05 14:57:15 (13 years ago)
Author:
hesasnel
Message:

Kenttää on tehty. Lisää animaatiota yritetty tehdä, taikajuoman ansiosta voi leijua. Textuureita on tehty lisää.

Location:
2010/31/hesasnel/Teron seikkailu
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • 2010/31/hesasnel/Teron seikkailu/Content/Content.contentproj

    r1605 r1626  
    103103    </Compile> 
    104104  </ItemGroup> 
     105  <ItemGroup> 
     106    <Compile Include="multa.png"> 
     107      <Name>multa</Name> 
     108      <Importer>TextureImporter</Importer> 
     109      <Processor>TextureProcessor</Processor> 
     110    </Compile> 
     111  </ItemGroup> 
     112  <ItemGroup> 
     113    <Compile Include="Ruohikko.png"> 
     114      <Name>Ruohikko</Name> 
     115      <Importer>TextureImporter</Importer> 
     116      <Processor>TextureProcessor</Processor> 
     117    </Compile> 
     118  </ItemGroup> 
     119  <ItemGroup> 
     120    <Compile Include="Taikajuoma.png"> 
     121      <Name>Taikajuoma</Name> 
     122      <Importer>TextureImporter</Importer> 
     123      <Processor>TextureProcessor</Processor> 
     124    </Compile> 
     125  </ItemGroup> 
     126  <ItemGroup> 
     127    <Compile Include="Tramppa.png"> 
     128      <Name>Tramppa</Name> 
     129      <Importer>TextureImporter</Importer> 
     130      <Processor>TextureProcessor</Processor> 
     131    </Compile> 
     132  </ItemGroup> 
     133  <ItemGroup> 
     134    <Compile Include="Ovi.png"> 
     135      <Name>Ovi</Name> 
     136      <Importer>TextureImporter</Importer> 
     137      <Processor>TextureProcessor</Processor> 
     138    </Compile> 
     139  </ItemGroup> 
     140  <ItemGroup> 
     141    <Compile Include="ropelli pyörii2.png"> 
     142      <Name>ropelli pyörii2</Name> 
     143      <Importer>TextureImporter</Importer> 
     144      <Processor>TextureProcessor</Processor> 
     145    </Compile> 
     146  </ItemGroup> 
     147  <ItemGroup> 
     148    <Compile Include="ropelli pyörii2 vasen.png"> 
     149      <Name>ropelli pyörii2 vasen</Name> 
     150      <Importer>TextureImporter</Importer> 
     151      <Processor>TextureProcessor</Processor> 
     152    </Compile> 
     153  </ItemGroup> 
    105154  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    106155  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2010/31/hesasnel/Teron seikkailu/Peli.cs

    r1605 r1626  
    77class Tasohyppely : PhysicsGame 
    88{ 
     9    const int ruudunKorkeus = 30; 
     10    const int ruudunLeveys = 30; 
    911    const double nopeus = 400; 
    1012    const double hyppyVoima = 3500; 
     13 
     14    Vector normaalipainovoima = new Vector(0, -1000); 
     15    Vector leijumisvoima = new Vector(0, 50); 
    1116 
    1217    Image paikallaanVasemmalle = LoadImage("Tero vasen"); 
     
    1419    Image[] kavelyVasemmalle = LoadImages("Tero vasen", "Tero 2 vasen"); 
    1520    Image[] kavelyOikealle = LoadImages("Tero", "Tero 2"); 
    16     Image[] hyppy = LoadImages("Tero hyppää"); 
     21    Image[] hyppyOikealle = LoadImages("Tero hyppää"); 
     22    Image[] hyppyVasemmalle = LoadImages ("Tero hyppää vasen"); 
     23    Image[] leijuntaOikealle = LoadImages("ropelli pyörii","ropelli pyörii2"); 
     24    Image[] leijuntaVasemmalle = LoadImages("ropelli pyörii vasen,ropelli pyörii2 vasen"); 
     25    Image[] multa = LoadImages("multa"); 
     26    Image[] ruoho = LoadImages("Ruohikko"); 
     27    Image[] ovi = LoadImages("Ovi"); 
     28    Image[] taikajuoma = LoadImages("Taikajuoma"); 
     29    Image[] tramppa = LoadImages("Tramppa"); 
     30 
     31    bool taikajuomakaytossa = false; 
     32 
     33    Animation hyppyanim; 
     34    Animation kavelyanim; 
    1735    PlatformCharacter pelaaja1; 
    1836 
    1937    protected override void Begin() 
    2038    { 
    21         Gravity = new Vector(00000, -1000); 
     39        Gravity = new Vector(0, -1000); 
     40        hyppyanim = new Animation(hyppyOikealle); 
     41        //kavelyanim = new Animation(); 
    2242 
    2343        luoKentta(); 
     
    3151    void luoKentta() 
    3252    { 
     53        TileMap ruudut = TileMap.FromFile("Kenttä1.txt"); 
     54        ruudut['='] = LuoMulta; 
     55        ruudut['.'] = LuoRuohikko; 
     56        ruudut['F'] = LuoTaikajuoma; 
     57        ruudut['T'] = LuoTramppa; 
     58        ruudut['M'] = LuoOvi; 
     59        ruudut.Insert(ruudunLeveys, ruudunKorkeus); 
    3360        Level.CreateBorders(); 
    34         Level.Background.CreateGradient(Color.White, Color.SkyBlue); 
     61        Level.Background.CreateGradient(Color.SkyBlue, Color.SkyBlue); 
    3562 
    36         lisaaTaso(-200, -350); 
    37         lisaaTaso(0, -200); 
    3863 
    3964        lisaaPelaajat(); 
     
    5378        pelaaja1 = new PlatformCharacter(70, 100); 
    5479        pelaaja1.Mass = 4.0; 
    55         pelaaja1.KineticFriction = 2.0;        
     80        pelaaja1.KineticFriction = 1.0;        
    5681        pelaaja1.Image = LoadImage("Tero"); 
     82        AddCollisionHandler(pelaaja1, KasittelePelaajanTormays); 
     83 
    5784        pelaaja1.X = 0; 
    5885        pelaaja1.Y = Level.Bottom + 120; 
     
    6289        pelaaja1.LeftWalkingAnimation = new Animation(kavelyVasemmalle); 
    6390        pelaaja1.RightWalkingAnimation = new Animation(kavelyOikealle); 
    64         pelaaja1.MidAirAnimation = new Animation(hyppy); 
    6591 
    6692        Add(pelaaja1); 
     93    } 
     94 
     95    void KasittelePelaajanTormays(PhysicsObject pelaaja, PhysicsObject kohde) 
     96    { 
     97        string tagi = kohde.Tag.ToString(); 
     98 
     99        if (tagi == "taikajuoma") 
     100        { 
     101            kohde.Destroy(); 
     102            taikajuomakaytossa = true; 
     103             
     104        } 
     105        if (tagi == "taso") 
     106        { 
     107            //Gravity = normaalipainovoima; 
     108        } 
    67109    } 
    68110 
     
    75117        Keyboard.Listen(Key.Right, ButtonState.Down, liikuta, "Liikkuu oikealle", pelaaja1, nopeus); 
    76118        Keyboard.Listen(Key.Space, ButtonState.Pressed, hyppaa, "Hyppää", pelaaja1, hyppyVoima); 
     119        Keyboard.Listen(Key.Space, ButtonState.Down, leiju, "Leiju"); 
    77120 
    78121        ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); 
     
    81124        ControllerOne.Listen(Button.DPadRight, ButtonState.Down, liikuta, "Pelaaja liikkuu oikealle", pelaaja1, nopeus); 
    82125        ControllerOne.Listen(Button.A, ButtonState.Pressed, hyppaa, "Pelaaja hyppää", pelaaja1, hyppyVoima); 
     126 
     127    } 
     128 
     129    void leiju() 
     130    { 
     131        if (taikajuomakaytossa) 
     132        { 
     133            //Gravity = new Vector(0, -200); 
     134            pelaaja1.Hit(leijumisvoima); 
     135        } 
    83136    } 
    84137 
     
    91144    { 
    92145        hahmo.Jump(voima); 
     146        hahmo.Animation = new Animation(hyppyOikealle); 
     147        hahmo.Animation.Start(1); 
    93148    } 
     149    PhysicsObject LuoMulta() 
     150{ 
     151    PhysicsObject multa = PhysicsObject.CreateStaticObject(31.0,31.0); 
     152    multa.Image = LoadImage("multa"); 
     153    return multa; 
     154         
    94155} 
     156    PhysicsObject LuoRuohikko() 
     157    { 
     158    PhysicsObject Ruohikko = PhysicsObject.CreateStaticObject(31.0, 31.0); 
     159    Ruohikko.Image = LoadImage("Ruohikko"); 
     160    Ruohikko.Tag = "taso"; 
     161    return Ruohikko; 
     162    } 
     163    PhysicsObject LuoTaikajuoma() 
     164    { 
     165        PhysicsObject Taikajuoma = PhysicsObject.CreateStaticObject(50.0, 80.0); 
     166        Taikajuoma.Image = LoadImage("Taikajuoma"); 
     167        Taikajuoma.Tag = "taikajuoma"; 
     168        return Taikajuoma; 
     169    } 
     170    PhysicsObject LuoTramppa() 
     171    { 
     172        PhysicsObject Tramppa = PhysicsObject.CreateStaticObject(80.0, 50.0); 
     173        Tramppa.Image = LoadImage("Tramppa"); 
     174        return Tramppa; 
     175    } 
     176    PhysicsObject LuoOvi() 
     177    { 
     178        PhysicsObject Ovi = PhysicsObject.CreateStaticObject(50.0, 100.0); 
     179        Ovi.Image = LoadImage("Ovi"); 
     180        return Ovi; 
     181    } 
     182 
     183    protected override void Update(Time time) 
     184    { 
     185        //if (pelaaja1.a 
     186        base.Update(time); 
     187    } 
     188         
     189}  
  • 2010/31/hesasnel/Teron seikkailu/Teron seikkailu.csproj

    r1605 r1626  
    8989    <Content Include="Game.ico" /> 
    9090    <Content Include="GameThumbnail.png" /> 
     91    <Content Include="Kenttä1.txt"> 
     92      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 
     93    </Content> 
    9194  </ItemGroup> 
    9295  <ItemGroup> 
Note: See TracChangeset for help on using the changeset viewer.