Changeset 539 for 2010/23


Ignore:
Timestamp:
2010-06-08 11:27:33 (13 years ago)
Author:
paaaanro
Message:
 
File:
1 edited

Legend:

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

    r511 r539  
    88    public class Peli : PhysicsGame 
    99    { 
     10        PhysicsObject pallo; 
    1011        protected override void Begin() 
    1112        { 
    12             PhysicsObject pallo = new PhysicsObject(40.0, 40.0); 
    13             Add(pallo); 
    14             pallo.Shape = Shapes.Circle; 
    15             pallo.X = 300.0; 
    16             pallo.Y = -50.0; 
    17             Vector impulssi = new Vector(350.0,220.0); 
    18             pallo.Hit(impulssi); 
    19             Level.CreateBorders(0.8, false ); 
    20             pallo.Restitution = 0.8; 
    21             Level.BackgroundColor = Color.Pink; 
    22             Camera.ZoomToLevel(); 
    23              
    24  
    25  
     13            LuoKentta(); 
     14            Aloitapeli(); 
    2615 
    2716            //TODO: Alusta peli tässä 
     
    2918        void LuoKentta() 
    3019        { 
     20            pallo = new PhysicsObject(40.0, 40.0); 
     21            pallo.Shape = Shapes.Circle; 
     22            pallo.X = 300.0; 
     23            pallo.Y = -50.0; 
     24            pallo.Restitution = 1.0; 
     25            Add(pallo); 
     26            LuoMaila(Level.Left + 20.0, 0.0); 
     27            LuoMaila(Level.Right - 20.0, 0.0); 
     28            Level.CreateBorders(0.8, false); 
     29            Level.BackgroundColor = Color.Pink; 
     30            Camera.ZoomToLevel(); 
    3131        } 
     32        void Aloitapeli() 
     33        { 
     34            Vector impulssi = new Vector(350.0, 220.0); 
     35            pallo.Hit(impulssi); 
     36        } 
     37 
     38        void LuoMaila(double x, double y) 
     39        { 
     40            PhysicsObject maila = PhysicsObject.CreateStaticObject(20.0, 100.0); 
     41            maila.Shape = Shapes.Rectangle; 
     42            maila.X = x; 
     43            maila.Y = y; 
     44            maila.Restitution = 1.0; 
     45            Add(maila); 
     46 
     47 
     48        } 
     49 
     50 
     51 
    3252    } 
    3353} 
Note: See TracChangeset for help on using the changeset viewer.