Changeset 4062 for 2013/24/BenjaminT/Pong/Pong/Pong/Pong.cs
- Timestamp:
- 2013-06-11 10:08:45 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
2013/24/BenjaminT/Pong/Pong/Pong/Pong.cs
r4046 r4062 9 9 public class Pong : PhysicsGame 10 10 { 11 Vector nopeusYlos = new Vector(0, 200);12 Vector nopeusAlas = new Vector(0, -200);11 Vector nopeusYlos = new Vector(0, 200); 12 Vector nopeusAlas = new Vector(0, -200); 13 13 14 15 16 14 15 16 17 17 PhysicsObject pallo; 18 18 19 19 PhysicsObject maila1; 20 20 PhysicsObject maila2; 21 21 22 22 public override void Begin() 23 23 { … … 40 40 Add(pallo); 41 41 42 maila1 =LuoMaila(Level.Left + 20.0, 0.0);43 maila2 =LuoMaila(Level.Right - 20.0, 0.0);42 maila1 = LuoMaila(Level.Left + 20.0, 0.0); 43 maila2 = LuoMaila(Level.Right - 20.0, 0.0); 44 44 45 45 46 46 47 47 48 48 … … 75 75 76 76 77 PhysicsObject LuoMaila(double x, double y)77 PhysicsObject LuoMaila(double x, double y) 78 78 { 79 79 PhysicsObject maila = PhysicsObject.CreateStaticObject(20.0, 100.0); … … 84 84 Add(maila); 85 85 return maila; 86 87 88 89 }86 87 88 89 } 90 90 91 91 92 92 void AsetaOhjaimet() 93 93 { 94 95 94 96 Keyboard.Listen(Key.A, ButtonState.Down, LiikutaMaila1Ylos, "Pelaaja 1: Liikuta maila ylös"); 97 Keyboard.Listen(Key.A, ButtonState.Released, PysaytaMaila1, null); 95 96 Keyboard.Listen(Key.A, ButtonState.Down, AsetaNopeus, "Pelaaja 1: Liikuta maila ylös" , maila1, nopeusYlos); 97 Keyboard.Listen(Key.A, ButtonState.Released, AsetaNopeus , null, maila1, Vector.Zero); 98 98 99 99 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 100 100 } 101 101 102 voidaAsetaNopeus(PhysicsObject maila, Vector nopeus)102 void AsetaNopeus(PhysicsObject maila, Vector nopeus) 103 103 { 104 104 105 105 maila.Velocity = nopeus; 106 107 108 } 109 110 }
Note: See TracChangeset
for help on using the changeset viewer.