Changeset 556


Ignore:
Timestamp:
2010-06-08 14:56:35 (13 years ago)
Author:
paaaanro
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2010/23/juhkuska/Pong/Peli.cs

    r539 r556  
    88    public class Peli : PhysicsGame 
    99    { 
     10        PhysicsObject maila1; 
     11        PhysicsObject maila2; 
    1012        PhysicsObject pallo; 
    1113        protected override void Begin() 
    1214        { 
    1315            LuoKentta(); 
     16            Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "poistu"); 
    1417            Aloitapeli(); 
    1518 
     
    2427            pallo.Restitution = 1.0; 
    2528            Add(pallo); 
    26             LuoMaila(Level.Left + 20.0, 0.0); 
    27             LuoMaila(Level.Right - 20.0, 0.0); 
     29            maila1 = LuoMaila(Level.Left + 20.0, 0.0); 
     30            maila2 = LuoMaila(Level.Right - 20.0, 0.0); 
    2831            Level.CreateBorders(0.8, false); 
    2932            Level.BackgroundColor = Color.Pink; 
     
    3639        } 
    3740 
    38         void LuoMaila(double x, double y) 
     41        PhysicsObject LuoMaila(double x, double y) 
    3942        { 
    4043            PhysicsObject maila = PhysicsObject.CreateStaticObject(20.0, 100.0); 
     
    4447            maila.Restitution = 1.0; 
    4548            Add(maila); 
     49            return maila; 
    4650 
    4751 
     52        } 
     53        void AsetaOhjaimet() 
     54        { 
     55            Keyboard.Listen(Key.A, ButtonState.Pressed, LiikutaMailaaYlos, "Pelaaja 1: Liikuta mailaa ylös"); 
     56            Keyboard.Listen(Key.A, ButtonState.Released, Pysaytamaila, null); 
     57            Keyboard.Listen(Key.Escape, ButtonState.Pressed,Exit, "poistu"); 
    4858        } 
    4959 
Note: See TracChangeset for help on using the changeset viewer.