Changeset 4070
- Timestamp:
- 2013-06-11 14:56:50 (10 years ago)
- Location:
- 2013/24/OnniV
- Files:
-
- 54 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
2013/24/OnniV/pong/pong/pong/pong.cs
r4050 r4070 9 9 public class pong : PhysicsGame 10 10 { 11 Vector nopeusYlös = new Vector(0, 200); 12 Vector nopeusAlas = new Vector(0, -200); 13 11 14 PhysicsObject pallo; 15 16 PhysicsObject maila1; 17 PhysicsObject maila2; 12 18 13 19 public override void Begin() … … 31 37 pallo.Restitution = 0.8; 32 38 Level.BackgroundColor = Color.Black; 33 luomaila(Level.Left + 20.0, 0.0);34 luomaila(Level.Right - 20.0, 0.0);39 maila1 = luomaila(Level.Left + 20.0, 0.0); 40 maila2 = luomaila(Level.Right - 20.0, 0.0); 35 41 Camera.ZoomToLevel(); 36 42 … … 45 51 pallo.Hit(impulssi); 46 52 } 47 voidluomaila(double X, double Y)53 PhysicsObject luomaila(double X, double Y) 48 54 { 49 55 PhysicsObject maila = PhysicsObject.CreateStaticObject(20.0, 100.0); … … 53 59 maila.Restitution = 1.0; 54 60 Add(maila); 61 return maila; 55 62 } 56 63 57 64 void asetaohjaimet() 58 65 { 66 Keyboard.Listen(Key.A, ButtonState.Down, AsetaNopeus, LiikutaMaila1Ylös, "pelaaja1: liikuta mailaa ylös", maila1, nopeusYlös); 67 Keyboard.listen(Key.A, ButtonState.Released, AsetaNopeus, PysäytäMaila1, null, maila1, Vector.Zero); 68 Keyboard.Listen(Key.Escape, ButtonState.Pressed); 69 59 70 60 Keyboard.Listen(Key.A, ButtonState.Down, LiikutaMaila1Ylös, "pelaaja1: liikuta mailaa ylös"); 61 Keyboard.listen(Key.A, ButtonState.Released, PysäytäMaila1, null); 62 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 71 72 73 63 74 } 75 void AsetaNopeus() 76 { 77 maila1.Velocity = nopeus; 78 maila2.Velocity = nopeus; 79 } 80 81 82 83 84 } 85 } 64 86 65 } 87 66 88 67 89
Note: See TracChangeset
for help on using the changeset viewer.