- Timestamp:
- 2010-08-03 14:57:25 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/31/jomaveij/Pong/Peli.cs
r1532 r1573 6 6 public class Peli : PhysicsGame 7 7 { 8 PhysicsObject pallero; 9 Vector yhaylosyrittaa = new Vector(0, 200); 10 Vector maanalainen = new Vector(); 11 8 12 protected override void Begin() 9 13 { 10 PhysicsObject pallero = new PhysicsObject(39.9, 40.0); 14 Kentta(); 15 Ohjustukikohta(); 16 Alota(); 17 PingPong(Level.Left + 20, 0.0); 18 PingPong(Level.Right - 20, 0.0); 19 } 20 21 void Kentta() 22 { 23 pallero = new PhysicsObject(39.9, 40.0); 11 24 pallero.Shape = Shapes.Circle; 12 25 pallero.Y = 100.82346277835; 13 26 Add(pallero); 27 pallero.Restitution = 1.0; 28 Level.CreateBorders(1.0, true); 29 Level.BackgroundColor = Color.ForestGreen; 30 Camera.ZoomToLevel(); 31 } 14 32 15 Vector newton = new Vector(1000.5, -500.2); 33 void Alota() 34 { 35 Vector newton = new Vector(1000.0, 500.0); 16 36 pallero.Hit(newton); 37 } 38 void PingPong(double x, double y) 39 { 40 PhysicsObject pong = PhysicsObject.CreateStaticObject(20.0, 50.0); 41 pong.Position = new Vector(x, y); 42 pong.Restitution = 1.0; 43 Add(pong); 44 } 17 45 18 Level.CreateBorders(); 46 void Ohjustukikohta() 47 { 48 Keyboard.Listen(Key.A, ButtonState.Down, LiikutaMailaaYlos, "Pelaaja 1: Liikuta mailaa ylös"); 49 Keyboard.Listen(Key.A, ButtonState.Released, PysaytaMaila, null); 50 Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "Poistu!!!"); 51 } 52 53 void Vauhdikkuus(PhysicsObject pong, Vector vauhti) 54 { 55 pong.Velocity = vauhti; 19 56 } 20 57 }
Note: See TracChangeset
for help on using the changeset viewer.