Changeset 848
- Timestamp:
- 2010-06-15 11:32:19 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/24/maiilomo/pong/Peli.cs
r818 r848 2 2 using Jypeli; 3 3 using Jypeli.ScreenObjects; 4 using Jypeli.Assets;5 4 6 5 public class Peli : PhysicsGame 7 6 { 7 PhysicsObject pallo; 8 8 9 protected override void Begin() 9 { 10 //TODO: Alusta peli tässä 11 PhysicsObject pallo = new PhysicsObject(50, 50); 12 pallo.Shape = Shapes.Circle; 13 pallo.Color = Color.Green; 14 Vector liike = new Vector(900, 45); 15 pallo.Hit(liike); 16 Add(pallo); 17 18 Level.CreateBorders(1.0, false); 19 Level.BackgroundColor = Color.Blue; 20 PhysicsObject palloo = new PhysicsObject(55, 55); 21 palloo.Shape = Shapes.Circle; 22 palloo.Color = Color.Yellow; 23 Vector mennä = new Vector(700, 300); 24 palloo.Hit(mennä); 25 palloo.X = 300; 26 Add(palloo); 10 { 11 LuoKentta(); 12 Keyboard.Listen( Key.Escape, ButtonState.Pressed, Exit, "Poistu" ); 13 AloitaPeli(); 14 Asetaohjaimet(); 27 15 } 28 16 29 17 void LuoKentta() 30 18 { 19 pallo = new PhysicsObject( 40, 40 ); 20 pallo.Shape = Shapes.Circle; 21 pallo.X = 0.0; 22 pallo.Y = 0.0; 23 pallo.Restitution = 1.0; 24 pallo.Color = Color.Green; 25 Add( pallo ); 26 27 LuoMaila( Level.Left + 20.0, 0.0 ); 28 LuoMaila( Level.Right - 20.0, 0.0 ); 29 30 Level.CreateBorders( 1.0, false ); 31 Level.BackgroundColor = Color.Black; 32 33 Camera.ZoomToLevel(); 34 } 35 36 void AloitaPeli() 37 { 38 Vector impulssi = new Vector( 500.0, 0.0 ); 39 pallo.Hit( impulssi ); 40 } 41 42 void LuoMaila( double x, double y ) 43 { 44 PhysicsObject maila = PhysicsObject.CreateStaticObject( 20.0, 100.0 ); 45 maila.Shape = Shapes.Rectangle; 46 maila.X = x; 47 maila.Y = y; 48 maila.Restitution = 1.0; 49 maila.Color = Color.Red; 50 Add( maila ); 51 } 52 53 void asetaohjaimet() 54 { 55 31 56 32 57 } 33 58 } 59
Note: See TracChangeset
for help on using the changeset viewer.