Changeset 1151 for 2010/27


Ignore:
Timestamp:
2010-07-07 14:54:44 (13 years ago)
Author:
paaaanro
Message:

smash cubes alkoi

Location:
2010/27/viaawipi/samsh cubes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 2010/27/viaawipi/samsh cubes/Peli.cs

    r1127 r1151  
    33using Jypeli.Widgets; 
    44using Jypeli.Assets; 
     5using Jypeli.Effects; 
    56 
    67 
    78class Tasohyppely : PhysicsGame 
    89{ 
     10    const int rulev = 50; 
     11    const int rukor = 50; 
    912    const double nopeus = 200; 
    1013    const double hyppyVoima = 3000; 
     
    2528 
    2629        // Zoomataan lähemmäksi 
    27         Camera.ZoomFactor = 1.0; 
    28  
     30        Camera.ZoomToLevel(); 
    2931        Camera.StayInLevel = true; 
    3032 
    3133        seuraavaKentta(); 
    32         MessageDisplay.Add("Etsi iso tähti!"); 
    3334    } 
    3435 
     
    5354    void luoKentta() 
    5455    { 
     56        TileMap ruudut = TileMap.FromFile("kentta.txt"); 
     57        ruudut['#'] = Luotaso; 
     58        ruudut.Insert(rulev, rukor); 
     59 
    5560        Level.CreateBorders(); 
    5661        Level.Background.CreateGradient(Color.White, Color.SkyBlue); 
    5762        Level.Background.Image = LoadImage("aa"); 
    58         lisaaTaso(-200, -350); 
    59         lisaaTaso(0, -400); 
    60         lisaaTaso(200, -350);  
    61         lisaaTaso(-400, -300); 
    62         lisaaTaso(50, -400); 
    63         lisaaTaso(400, -300); 
     63 
     64 
    6465        lisaaPelaajat(); 
    6566    } 
    6667 
    67     void lisaaTaso(double x, double y) 
     68    PhysicsObject Luotaso() 
    6869    { 
    69         PhysicsObject taso = PhysicsObject.CreateStaticObject(200, 100); 
    70         taso.Color = Color.Green; 
    71         taso.X = x; 
    72         taso.Y = y; 
    73         taso.Image = LoadImage("dd"); 
    74         Add(taso); 
     70        PhysicsObject taso = PhysicsObject.CreateStaticObject(50.0, 50.0); 
     71        return taso; 
    7572    } 
    7673 
     
    104101        Keyboard.Listen(Key.Right, ButtonState.Down, liikuta, "Liikkuu oikealle", pelaaja1, nopeus); 
    105102        Keyboard.Listen(Key.Up, ButtonState.Pressed, hyppaa, "Hyppää", pelaaja1, hyppyVoima); 
     103        Keyboard.Listen(Key.P, ButtonState.Pressed, poks1, "rajauta"); 
     104        Keyboard.Listen(Key.O, ButtonState.Pressed, poks2, "rajauta"); 
     105        Keyboard.Listen(Key.I, ButtonState.Pressed, HeitaKranaatti , "rajauta"); 
    106106 
    107107        Keyboard.Listen(Key.A, ButtonState.Down, liikuta, "Liikkuu vasemmalle", pelaaja2, -nopeus); 
     
    132132    } 
    133133 
    134     void PelaajaOsuu(PhysicsObject collidingObject, PhysicsObject otherObject) 
     134    void PelaajaOsuu(PhysicsObject collidingObject, PhysicsObject pum) 
    135135    { 
    136         { 
    137         } 
     136    
    138137    } 
     138    void poks1() 
     139    { 
     140        Explosion rajahdys = new Explosion(10.0); 
     141        rajahdys.Position = pelaaja2.Position; 
     142        rajahdys.X-=40; 
     143        rajahdys.Y -= 25; 
     144        rajahdys.Speed = 1000.0; 
     145        rajahdys.Force =50; 
     146        rajahdys.ShockwaveColor = Color.Cyan; 
     147        Add(rajahdys); 
     148    } 
     149         void poks2() 
     150    { 
     151        Explosion rajahdys = new Explosion(10.0); 
     152        rajahdys.Position = pelaaja1.Position; 
     153        rajahdys.Y -= 15; 
     154        rajahdys.Speed = 1000.0; 
     155        rajahdys.Force =50; 
     156        rajahdys.ShockwaveColor = Color.Red; 
     157        Add(rajahdys); 
     158    } 
     159         void pumpum () 
     160         { 
     161          PhysicsObject pum = PhysicsObject.CreateStaticObject(20.0, 20.0); 
     162          pum.Position = pelaaja2.Position; 
     163          pum.Shape = Shapes.Circle; 
     164          Add(pum); 
     165         } 
     166         void HeitaKranaatti() 
     167         { 
     168             ClusterGrenade kranaatti = new ClusterGrenade(4.0, 2); 
     169             kranaatti.X = pelaaja1.X; 
     170             kranaatti.Y = pelaaja1.Y; 
     171             Add(kranaatti); 
     172             Vector heittoVoima = Vector.FromLengthAndAngle(10, Angle.Degrees(0)); 
     173             kranaatti.Hit(heittoVoima);  
     174         } 
    139175} 
  • 2010/27/viaawipi/samsh cubes/samsh cubes.csproj

    r1127 r1151  
    8989    <Content Include="Game.ico" /> 
    9090    <Content Include="GameThumbnail.png" /> 
     91    <Content Include="kentta.txt" /> 
    9192  </ItemGroup> 
    9293  <ItemGroup> 
Note: See TracChangeset for help on using the changeset viewer.