Changeset 620


Ignore:
Timestamp:
2010-06-09 14:55:24 (13 years ago)
Author:
leperoih
Message:

NYT SAIN ANIMAATION TEHTYY KU SE LIIKKUU!!!!!

Location:
2010/23/leperoih
Files:
43 added
4 edited

Legend:

Unmodified
Added
Removed
  • 2010/23/leperoih/Tasohyppely2/Content/Content.contentproj

    r570 r620  
    6868    </Compile> 
    6969  </ItemGroup> 
     70  <ItemGroup> 
     71    <Compile Include="portaali.png"> 
     72      <Name>portaali</Name> 
     73      <Importer>TextureImporter</Importer> 
     74      <Processor>TextureProcessor</Processor> 
     75    </Compile> 
     76  </ItemGroup> 
     77  <ItemGroup> 
     78    <Compile Include="päämies.png"> 
     79      <Name>päämies</Name> 
     80      <Importer>TextureImporter</Importer> 
     81      <Processor>TextureProcessor</Processor> 
     82    </Compile> 
     83  </ItemGroup> 
     84  <ItemGroup> 
     85    <Compile Include="pedobear.png"> 
     86      <Name>pedobear</Name> 
     87      <Importer>TextureImporter</Importer> 
     88      <Processor>TextureProcessor</Processor> 
     89    </Compile> 
     90  </ItemGroup> 
     91  <ItemGroup> 
     92    <Compile Include="baby.jpg"> 
     93      <Name>baby</Name> 
     94      <Importer>TextureImporter</Importer> 
     95      <Processor>TextureProcessor</Processor> 
     96    </Compile> 
     97  </ItemGroup> 
     98  <ItemGroup> 
     99    <Compile Include="mother.jpg"> 
     100      <Name>mother</Name> 
     101      <Importer>TextureImporter</Importer> 
     102      <Processor>TextureProcessor</Processor> 
     103    </Compile> 
     104  </ItemGroup> 
     105  <ItemGroup> 
     106    <Compile Include="vasemmalleliikkuu.png"> 
     107      <Name>vasemmalleliikkuu</Name> 
     108      <Importer>TextureImporter</Importer> 
     109      <Processor>TextureProcessor</Processor> 
     110    </Compile> 
     111  </ItemGroup> 
     112  <ItemGroup> 
     113    <Compile Include="oikealleliikkuu.png"> 
     114      <Name>oikealleliikkuu</Name> 
     115      <Importer>TextureImporter</Importer> 
     116      <Processor>TextureProcessor</Processor> 
     117    </Compile> 
     118  </ItemGroup> 
     119  <ItemGroup> 
     120    <Compile Include="oikealleliikkuu2.png"> 
     121      <Name>oikealleliikkuu2</Name> 
     122      <Importer>TextureImporter</Importer> 
     123      <Processor>TextureProcessor</Processor> 
     124    </Compile> 
     125  </ItemGroup> 
    70126  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    71127  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2010/23/leperoih/Tasohyppely2/Peli.cs

    r570 r620  
    1616 
    1717        PlatformCharacter pelaaja1; 
     18        PhysicsObject pahikset; 
    1819 
    1920        int kenttaNro; // monesko kenttä on menossa 
     
    2223        protected override void Begin() 
    2324        { 
     25            Timer ajastin = new Timer(); 
     26            ajastin.Interval = 1; 
     27            ajastin.Trigger += new Timer.TriggerHandler(VihollinenLyo); 
     28            Add(ajastin); 
     29            ajastin.Start(); 
    2430            kenttaNro = 0; 
    2531            Level.Width = 2000; 
     
    4349 
    4450            seuraavaKentta(); 
    45             MessageDisplay.Add("Etsi iso tähti!"); 
     51            MessageDisplay.Add("Etsi iso portaali!"); 
     52        } 
     53 
     54        protected override void Update(Time time) 
     55        { 
     56            onkoPelaajaLahella(); 
     57            base.Update(time); 
    4658        } 
    4759 
     
    6577        { 
    6678            Level.CreateBorders(); 
    67             Level.Background.CreateGradient(Color.White, Color.Red); 
    68  
    69             lisaaTaso(300, 100); 
    70             lisaaTaso(0, -200); 
    71             lisaaTaso(-375, -150); 
     79            Level.Background.CreateGradient(Color.Green, Color.Blue); 
     80 
     81            lisaaTaso(-150, -200); 
     82            lisaaTaso(-150, -350); 
     83            lisaaTaso(-100, -425); 
     84            lisaaTaso(300, 0); 
     85            lisaaTaso(0, -250); 
     86            lisaaTaso(-375, -200); 
    7287            lisaaTaso(-150, 500); 
    7388            lisaaTaso(200,-250); 
    7489            lisaaTaso(-250, 100); 
     90            lisaaTaso(-500, -400); 
     91            lisaaTaso(-550, -300); 
    7592 
    7693            lisaaMaali(); 
     
    8198        { 
    8299            Level.CreateBorders(); 
    83  
    84100        } 
    85101 
     
    87103        { 
    88104            PhysicsObject taso = PhysicsObject.CreateStaticObject(100, 30); 
    89             taso.Color = Color.Brown; 
     105            taso.Color = Color.Green; 
    90106            taso.X = x; 
    91107            taso.Y = y; 
     
    97113            pelaaja1 = new PlatformCharacter(40, 80); 
    98114            pelaaja1.Mass = 14.0; 
    99             pelaaja1.Image = LoadImage("My char"); 
     115            //pelaaja1.Image = LoadImage("My char"); 
    100116            pelaaja1.X = 0; 
    101117            pelaaja1.Y = Level.Bottom + 120; 
     118            Juokseminen(); 
    102119 
    103120            AddCollisionHandler(pelaaja1, osuiMaaliin); 
    104121 
    105122            Add(pelaaja1); 
    106         } 
    107  
     123 
     124            pahikset = new PhysicsObject(40, 80); 
     125            pahikset.Image = LoadImage("pedobear"); 
     126            pahikset.CanRotate = false; 
     127            pahikset.StaticFriction = 0.1; 
     128            pahikset.Mass = 10.0; 
     129            Add(pahikset); 
     130        } 
     131 
     132        void Juokseminen() 
     133        { 
     134            Image[] tekstuurit = LoadImages("oikealleliikkuu", "oikealleliikkuu2"); 
     135            Animation KavelyTekstuuri = new Animation( tekstuurit ); 
     136            KavelyTekstuuri.FPS = 5; 
     137            pelaaja1.RightWalkingAnimation = KavelyTekstuuri; 
     138            pelaaja1.LeftWalkingAnimation = Animation.Mirror( KavelyTekstuuri ); 
     139            pelaaja1.RightIdleAnimation = new Animation( LoadImage( "My char" ) ); 
     140            pelaaja1.LeftIdleAnimation = new Animation( Image.Mirror( LoadImage( "My char" ) ) ); 
     141        } 
     142 
     143        void onkoPelaajaLahella() 
     144        { 
     145            if (Math.Abs(pelaaja1.X - pahikset.X) < 400 && pelaaja1.Y >= pahikset.Y) 
     146            { 
     147                pahikset.Hit(pelaaja1.Position - pahikset.Position); 
     148            } 
     149        } 
     150 
     151        void VihollinenLyo(Timer sender) 
     152        { 
     153            MessageDisplay.Add("vihollinenLyo"); 
     154        } 
    108155        void lisaaMaali() 
    109156        { 
     
    111158            maali.Tag = "maali"; 
    112159            maali.IgnoresCollisionResponse = true; 
    113             maali.X = 100; 
    114             maali.Y = 300; 
    115             maali.Image = LoadImage("fffuuuuuuuuu"); 
     160            maali.X = 0; 
     161            maali.Y = 0; 
     162            maali.Image = LoadImage("portaali"); 
    116163            Add(maali); 
    117164        } 
     
    136183 
    137184            controller.Listen(Button.DPadLeft, ButtonState.Down, liikuta, "Pelaaja liikkuu vasemmalle", pelaaja1, -nopeus); 
     185            controller.Listen(Button.DPadLeft, ButtonState.Released, liikuta, "Liikkuu vasemmalle", pelaaja1, 0.0); 
    138186            controller.Listen(Button.DPadRight, ButtonState.Down, liikuta, "Pelaaja liikkuu oikealle", pelaaja1, nopeus); 
     187            controller.Listen(Button.DPadRight, ButtonState.Released, liikuta, "Liikkuu oikealle", pelaaja1, 0.0); 
    139188            controller.Listen(Button.A, ButtonState.Pressed, hyppaa, "Pelaaja hyppää", pelaaja1, hyppyVoima); 
    140189        } 
Note: See TracChangeset for help on using the changeset viewer.