Changeset 4626 for 2013


Ignore:
Timestamp:
2013-07-24 13:55:59 (10 years ago)
Author:
viosfilp
Message:

Talletus.

Location:
2013/30/VilleF/Lentokone/Lentokone
Files:
8 added
2 edited

Legend:

Unmodified
Added
Removed
  • 2013/30/VilleF/Lentokone/Lentokone/Lentokone/Lentokone.cs

    r4621 r4626  
    99public class Lentokone : PhysicsGame 
    1010{ 
    11     private Animation ukkelianim; 
     11    private Animation sauruksenLento; 
     12    private Animation juusto; 
     13    private Animation miesa; 
    1214 
    13  
    14     Image ukkeliP = LoadImage("ukkeliP"); 
     15    Image ukkeliPi = LoadImage("ukkeli"); 
    1516    Image pommik = LoadImage("pommi"); 
    16  
    1717    Image maisema = LoadImage("havutausta"); 
    18     Image havusauruskuva = LoadImage("havusauruskuva"); 
     18    Image havusaurus = LoadImage("havusauruskuva"); 
    1919    Vector nopeusYlos = new Vector(0, 1000); 
    2020    Vector nopeusAlas = new Vector(0, -1000); 
    2121    PhysicsObject pelaaja; 
    2222    PhysicsObject pommi; 
    23     PhysicsObject vihu; 
     23    PhysicsObject ukkeli1; 
    2424     
    25  
    26     private Animation sauruksenLento; 
    27  
    28  
    29  
    3025    public override void Begin() 
    3126    { 
    32         ukkelianim = LoadAnimation("ukkeli"); 
     27        miesa = LoadAnimation("blingbling"); 
     28        juusto = LoadAnimation("ukkeli"); 
    3329        sauruksenLento = LoadAnimation("animaatio"); 
    3430        Level.Width = 1920; 
     
    3834        LuoKentta(); 
    3935        LuoPelaaja(); 
     36        LisaaVihollinen(); 
     37        LisaaVihollinen(); 
    4038        pelaaja.Animation = sauruksenLento; 
    4139        pelaaja.Animation.Start(); 
    4240        pelaaja.Animation.FPS = 3; 
    43  
    4441        Camera.ZoomToLevel(); 
    4542        PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 
    46         pelaaja.Animation = sauruksenLento; 
    47         pelaaja.Animation.Start(); 
    48         pelaaja.Animation.FPS = 3; 
    49  
    5043        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
    5144        Keyboard.Listen(Key.Left, ButtonState.Down, 
     
    6760    void LisaaVihollinen() 
    6861    { 
    69         PhysicsObject ukkeli = new PhysicsObject(40, 20); 
    70         ukkeli.Animation = ukkelianim; 
    71         ukkeli.Animation.Start(); 
    72         ukkeli.Animation.FPS = 5; 
    73          
    74             
    75  
    76         Add(vihu); 
     62            int n = 0; 
     63            while (n < 10) { 
     64             
     65        double x = RandomGen.NextDouble(Level.Right, Level.Left); 
     66        PhysicsObject ukkeli1 = new PhysicsObject(40, 60); 
     67        //ukkeli1.Shape = Shape.FromImage("ukkeliP"); 
     68        ukkeli1.Animation = juusto; 
     69        ukkeli1.Animation.Start(); 
     70        ukkeli1.Animation.FPS = 5; 
     71        ukkeli1.Tag = "vihollinen"; 
     72        PhysicsObject mies = new PhysicsObject(40, 60); 
     73        mies.Animation = miesa; 
     74        mies.Animation.Start(); 
     75        mies.Animation.FPS = 4; 
     76        mies.Tag = "vihollinen"; 
     77        ukkeli1.X = x; 
     78        mies.X = x; 
     79        ukkeli1.Y = Level.Bottom + 80; 
     80        mies.Y = Level.Bottom + 80; 
     81        Add(RandomGen.SelectOne (mies, ukkeli1)); 
     82        n++; 
     83                    } 
    7784    } 
    7885    
    79  
     86     
    8087       void TiputaPommi() 
    8188 
     
    9299        Add(pommi); 
    93100         
    94         AddCollisionHandler(pommi, "vihollinen", CollisionHandler.ExplodeTarget(200, true)); 
     101        AddCollisionHandler(pommi, "vihollinen", CollisionHandler.ExplodeTarget(20, true)); 
    95102        AddCollisionHandler(pommi, CollisionHandler.ExplodeObject(20, true)); 
    96103 
    97104 
    98105    } 
     106       
    99107    void KaannaPelaajaa(double kaannos) 
    100108    { 
     
    102110 
    103111         
    104     } 
     112        } 
     113 
    105114 
    106115 
     
    127136    void LiikutaPelaajaa(int suunta) 
    128137    { 
    129  
    130138        pelaaja.Push(Vector.FromLengthAndAngle(3000*suunta, pelaaja.Angle)); 
    131  
    132139    } 
    133140 
     
    137144        Level.Background.Image = maisema; 
    138145        Level.Background.FitToLevel(); 
    139         Surface alareuna = new Surface(Level.Width, 30, 50, 60, 10); 
     146        Surface alareuna = new Surface(Level.Width, 50, 20, 60, 60); 
    140147        alareuna.Color = Color.Green; 
    141148        alareuna.Bottom = Level.Bottom; 
     
    147154    { 
    148155        pelaaja = new PhysicsObject(150.0, 190.0); 
    149         pelaaja.Shape = Shape.FromImage(havusauruskuva); 
    150         pelaaja.Image = havusauruskuva; 
     156        pelaaja.Shape = Shape.FromImage(havusaurus); 
     157        pelaaja.Image = havusaurus; 
    151158        pelaaja.LinearDamping = 0.99; 
    152159        pelaaja.CollisionIgnoreGroup = 2; 
    153160        //pelaaja.MirrorImage(); 
     161        pelaaja.Animation = sauruksenLento; 
     162        pelaaja.Animation.Start(); 
     163        pelaaja.Animation.FPS = 3; 
    154164        Add(pelaaja); 
    155165       AddCollisionHandler(pelaaja, CollisionHandler.ExplodeObject(200, true)); 
     166       AddCollisionHandler(pelaaja,  "vihollinen", CollisionHandler.ExplodeTarget(50, true)); 
    156167        pelaaja.MaxVelocity = 600; 
    157168       Timer ajastin = new Timer(); 
  • 2013/30/VilleF/Lentokone/Lentokone/LentokoneContent/LentokoneContent.contentproj

    r4622 r4626  
    118118    </Compile> 
    119119  </ItemGroup> 
    120   <ItemGroup /> 
    121120  <ItemGroup> 
    122121    <Compile Include="ukkeliP.png"> 
     
    127126  </ItemGroup> 
    128127  <ItemGroup> 
    129     <Compile Include="ukkeli\Ukkeli01.png"> 
    130       <Name>Ukkeli01</Name> 
    131       <Importer>TextureImporter</Importer> 
    132       <Processor>TextureProcessor</Processor> 
    133     </Compile> 
    134     <Compile Include="ukkeli\Ukkeli02.png"> 
    135       <Name>Ukkeli02</Name> 
    136       <Importer>TextureImporter</Importer> 
    137       <Processor>TextureProcessor</Processor> 
    138     </Compile> 
    139     <Compile Include="ukkeli\Ukkeli03.png"> 
    140       <Name>Ukkeli03</Name> 
    141       <Importer>TextureImporter</Importer> 
    142       <Processor>TextureProcessor</Processor> 
    143     </Compile> 
    144     <Compile Include="ukkeli\Ukkeli04.png"> 
    145       <Name>Ukkeli04</Name> 
    146       <Importer>TextureImporter</Importer> 
    147       <Processor>TextureProcessor</Processor> 
    148     </Compile> 
    149     <Compile Include="ukkeli\Ukkeli05.png"> 
    150       <Name>Ukkeli05</Name> 
    151       <Importer>TextureImporter</Importer> 
    152       <Processor>TextureProcessor</Processor> 
    153     </Compile> 
    154     <Compile Include="ukkeli\Ukkeli06.png"> 
    155       <Name>Ukkeli06</Name> 
    156       <Importer>TextureImporter</Importer> 
    157       <Processor>TextureProcessor</Processor> 
    158     </Compile> 
    159     <Compile Include="ukkeli\Ukkeli07.png"> 
    160       <Name>Ukkeli07</Name> 
    161       <Importer>TextureImporter</Importer> 
    162       <Processor>TextureProcessor</Processor> 
     128    <Compile Include="blingbling.anim"> 
     129      <Name>blingbling</Name> 
     130      <Importer>AnimationImporter</Importer> 
     131      <Processor>AnimationContentProcessor</Processor> 
    163132    </Compile> 
    164133  </ItemGroup> 
Note: See TracChangeset for help on using the changeset viewer.