Changeset 3591 for 2012/27


Ignore:
Timestamp:
2012-07-05 14:37:22 (11 years ago)
Author:
lekopakk
Message:

Talletus.

Location:
2012/27/LeeviK/PhysicsBall/PhysicsBall
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • 2012/27/LeeviK/PhysicsBall/PhysicsBall/PhysicsBall/PhysicsBall.cs

    r3581 r3591  
    99public class PhysicsBall : PhysicsGame 
    1010{ 
     11    PhysicsObject Tynnyri6; 
     12    PhysicsObject este4; 
     13    PhysicsObject aloitus1; 
     14    PhysicsObject este3; 
     15    PhysicsObject Pelaaja3; 
    1116    PhysicsObject este2; 
    1217    PhysicsObject Tynnyri1; 
     
    231236        if (kohde.Tag.ToString() == "Magma") 
    232237        { 
    233             Pelaaja1.Destroy(); 
     238            Pelaaja1.X = -400; 
     239            Pelaaja1.Y = -100; 
    234240            MessageDisplay.Add("Kuolit!"); 
    235241 
     
    237243        else if (kohde.Tag.ToString() == "ESTE1") 
    238244        { 
    239             Pelaaja1.Destroy(); 
     245            Pelaaja1.X = -400; 
     246            Pelaaja1.Y = -100; 
    240247            MessageDisplay.Add("Kuolit!"); 
    241248        } 
     
    252259            MessageDisplay.Add("Tuhosit Tynnyrin!"); 
    253260            MessageDisplay.Add("Level3"); 
    254              
    255         } 
    256     } 
     261 
     262            Level3(); 
     263        } 
     264    } 
     265    void Level3() 
     266    { 
     267        ClearGameObjects(); 
     268 
     269        PhysicsObject Pelaaja3 = new PhysicsObject(50, 50); 
     270        Camera.Follow(Pelaaja3); 
     271        Add(Pelaaja3); 
     272        Pelaaja3.X = -400; 
     273        Pelaaja3.Y = -150; 
     274        Pelaaja3.Image = Pallo; 
     275        Camera.Follow(Pelaaja3); 
     276        Camera.Zoom(1.0); 
     277 
     278        Level.CreateBorders(); 
     279 
     280        ControllerOne.Listen(Button.DPadLeft, ButtonState.Down, 
     281LiikutaPelaajaa, null, new Vector(-300, 0), Pelaaja3); 
     282        ControllerOne.Listen(Button.DPadRight, ButtonState.Down, 
     283          LiikutaPelaajaa, null, new Vector(300, 0), Pelaaja3); 
     284 
     285        Keyboard.Listen(Key.A, ButtonState.Down, 
     286          LiikutaPelaajaa1, null, new Vector(-300, 0), Pelaaja3); 
     287        Keyboard.Listen(Key.D, ButtonState.Down, 
     288           LiikutaPelaajaa1, null, new Vector(300, 0), Pelaaja3); 
     289 
     290        PhysicsObject Aloitus1 = PhysicsObject.CreateStaticObject(200, 50); 
     291        Add(Aloitus1); 
     292        Aloitus1.X = -400; 
     293        Aloitus1.Y = -200; 
     294        Aloitus1.Image = startti; 
     295 
     296        PhysicsObject este3 = PhysicsObject.CreateStaticObject(40, 100); 
     297        Add(este3); 
     298        este3.X = -300; 
     299        este3.Y = -200; 
     300        este3.Image = BLOCK; 
     301        este3.Tag = "ESTE3"; 
     302 
     303        PhysicsObject este4 = PhysicsObject.CreateStaticObject(600, 50); 
     304        Add(este4); 
     305        este4.Tag = "ESTE4"; 
     306        este4.X = -30; 
     307        este4.Y = -250; 
     308        este4.Image = BLOCK; 
     309         
     310 
     311        PhysicsObject Tynnyri6 = PhysicsObject.CreateStaticObject(100, 100); 
     312        Tynnyri6.X = 200; 
     313        Tynnyri6.Y = -60; 
     314        Tynnyri6.Tag = "tynnyri6"; 
     315        Add(Tynnyri6); 
     316        Tynnyri6.Image = Barrel; 
     317 
     318        AddCollisionHandler(Pelaaja3, KasittelePallonTormays4); 
     319 
     320 
     321 
     322    } 
     323    void KasittelePallonTormays4(PhysicsObject Pelaaja3, PhysicsObject kohde) 
     324    { 
     325        if (kohde.Tag.ToString() == "ESTE4") 
     326        { 
     327            Pelaaja3.X = -400; 
     328            Pelaaja3.Y = -150; 
     329        } 
     330        if (kohde.Tag.ToString() == "tynnyri6") 
     331        { 
     332            kohde.Destroy(); 
     333            MessageDisplay.Add("Tuhosit tynnyrin!"); 
     334            MessageDisplay.Add("Level4"); 
     335            ClearGameObjects(); 
     336        } 
    257337  
    258     } 
     338         
     339    } 
     340 
     341 
     342    } 
     343 
    259344  
    260          
    261345  
    262  
    263  
    264  
     346         
     347  
     348 
     349 
     350 
Note: See TracChangeset for help on using the changeset viewer.