- Timestamp:
- 2010-06-14 16:05:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/24/timisahe/Pong/Peli.cs
r807 r825 5 5 6 6 public class Peli : PhysicsGame 7 7 8 { 8 9 PhysicsObject pallo; 10 PhysicsObject maila1; 11 PhysicsObject maila2; 9 12 10 protected override void Begin 11 12 13 protected override void Begin() 14 { 15 //TODO: Alusta peli tässä 13 16 14 17 15 { 16 //TODO: Alusta peli tässä 17 18 19 20 LuoKentta (); 21 Vector impulssi = new Vector(1000.0, 550.0); 18 19 LuoKentta(); 20 Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "Poistu"); 21 Vector impulssi = new Vector(1000.0, 550.0); 22 22 pallo.Hit(impulssi); 23 24 23 AsetaOhjaimet(); 24 25 25 } 26 26 void LuoKentta() 27 27 { 28 28 29 LuoMaila(Level.Left + 20.0, 0.0); 30 LuoMaila(Level.Right - 20.0, 0.0); 31 29 32 pallo = new PhysicsObject(50.8, 50.8); 30 33 pallo.Shape = Shapes.Circle; … … 32 35 pallo.X = -200.0; 33 36 pallo.Y = 0.0; 34 Level.CreateBorders(1.0, false);37 Level.CreateBorders(1.0, false); 35 38 pallo.Restitution = 1.0; 36 39 Level.BackgroundColor = Color.Pink; 37 Camera.ZoomToLevel() 40 Camera.ZoomToLevel(); 38 41 Add(pallo); 39 42 } 43 void LuoMaila(double x, double y) 44 { 45 46 PhysicsObject maila = PhysicsObject.CreateStaticObject(20.0, 100.0); 47 maila.Shape = Shapes.Rectangle; 48 maila.X = x; 49 maila.Y = y; 50 maila.Restitution = 1.0; 51 Add(maila); 52 53 return maila; 54 55 } 56 57 void AsetaOhjaimet() 58 { 59 Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "Poistu"); 60 Keyboard.Listen(Key.A, ButtonState.Pressed, LiikutaMailaaYlos, "Pelaaja 1: Liikuta mailaa ylös"); 61 Keyboard.Listen(Key.A, ButtonState.Released, PysaytaMaila, null); 62 63 } 64 65 void LiikutaMailaaYlos(PhysicsObject maila) 66 { 67 68 } 69 70 71 40 72 41 73 } 74 75
Note: See TracChangeset
for help on using the changeset viewer.