Changeset 7464
- Timestamp:
- 2016-06-19 15:47:43 (7 years ago)
- Location:
- 2016/25/PetteriR/Pang
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
2016/25/PetteriR/Pang/Pang/Pang/Pang.cs
r7451 r7464 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 3 5 using Jypeli; 4 6 using Jypeli.Assets; … … 9 11 public class Pang : PhysicsGame 10 12 { 13 14 PhysicsObject pallo; 15 11 16 public override void Begin() 12 17 { 13 // TODO: Kirjoita ohjelmakoodisi tähän 14 PhysicsObject pallo = new PhysicsObject(50, 50); 18 LuoKentta(); 19 AloitaPeli(); 20 21 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 22 } 23 24 void LuoKentta() 25 { 26 pallo = new PhysicsObject(40.0, 40.0); 15 27 pallo.Shape = Shape.Circle; 16 pallo.Color = Color.Gold;17 Add(pallo);18 28 pallo.X = -200.0; 19 29 pallo.Y = 0.0; 30 pallo.Restitution = 1.0; 31 Add(pallo); 32 33 LuoMaila(Level.Left + 20.0, 0.0); 34 LuoMaila(Level.Right - 20.0, 0.0); 35 36 Level.CreateBorders(1.0, false); 37 Level.Background.Color = Color.Black; 38 39 Camera.ZoomToLevel(); 40 } 41 42 void AloitaPeli() 43 { 20 44 Vector impulssi = new Vector(500.0, 0.0); 21 Level.Background.CreateGradient(Color.Black, Color.Blue);22 Level.CreateBorders();45 pallo.Hit(impulssi); 46 } 23 47 24 25 26 27 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 28 48 void LuoMaila(double x, double y) 49 { 50 PhysicsObject maila = PhysicsObject.CreateStaticObject(20.0, 100.0); 51 maila.Shape = Shape.Rectangle; 52 maila.X = x; 53 maila.Y = y; 54 maila.Restitution = 1.0; 55 Add(maila); 29 56 } 30 57 }
Note: See TracChangeset
for help on using the changeset viewer.