- Timestamp:
- 2010-06-08 11:27:33 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/23/juhkuska/Pong/Peli.cs
r511 r539 8 8 public class Peli : PhysicsGame 9 9 { 10 PhysicsObject pallo; 10 11 protected override void Begin() 11 12 { 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(); 26 15 27 16 //TODO: Alusta peli tässä … … 29 18 void LuoKentta() 30 19 { 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(); 31 31 } 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 32 52 } 33 53 }
Note: See TracChangeset
for help on using the changeset viewer.