- Timestamp:
- 2016-07-28 11:32:57 (7 years ago)
- Location:
- 2016/30/AleksiN/name/name/name
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
2016/30/AleksiN/name/name/name/name.cs
r8186 r8193 13 13 Image tire = LoadImage("tire"); 14 14 PhysicsObject bikePhysicsObject; 15 PhysicsObject leftTire; 16 PhysicsObject rightTire; 15 17 PhysicsStructure bike; 16 18 public override void Begin() … … 29 31 Camera.Follow(bikePhysicsObject); 30 32 31 Surface level = Surface.CreateBottom(Level, 200, 300, 200, 20);33 Surface level = Surface.CreateBottom(Level, 400, 700, 200, 250); 32 34 Add(level); 33 35 Gravity = new Vector(0.0, -800.0); … … 37 39 Timer smokeTimer = new Timer(); 38 40 smokeTimer.Interval = 0.1; 39 smokeTimer.Timeout += delegate { smoke.Position = bike.Objects[ 0].Position; };41 smokeTimer.Timeout += delegate { smoke.Position = bike.Objects[1].Position; }; 40 42 smokeTimer.Start(); 41 43 Add(smoke); … … 45 47 void AddPlayer() 46 48 { 47 PhysicsObjectleftTire = new PhysicsObject(57.5, 57.5, Shape.Circle);48 PhysicsObjectrightTire = new PhysicsObject(57.5, 57.5, Shape.Circle);49 leftTire = new PhysicsObject(57.5, 57.5, Shape.Circle); 50 rightTire = new PhysicsObject(57.5, 57.5, Shape.Circle); 49 51 bikePhysicsObject = new PhysicsObject(250.0, 200.0); 50 52 leftTire.X = -70.0; … … 57 59 rightTire.Image = tire; 58 60 bikePhysicsObject.Image = motorbike; 59 this.bike = new PhysicsStructure( rightTire, leftTire, bikePhysicsObject);61 this.bike = new PhysicsStructure(leftTire, rightTire, bikePhysicsObject); 60 62 bikePhysicsObject.IgnoresCollisionResponse = true; 61 63 Add(this.bike); … … 67 69 void Keys() 68 70 { 69 Keyboard.Listen(Key.Down, ButtonState.Down, Movement, null, new Vector(-3 000, 0));70 Keyboard.Listen(Key.Up, ButtonState.Down, Movement, null, new Vector(3 000, 0));71 Keyboard.Listen(Key.Down, ButtonState.Down, Movement, null, new Vector(-3500, 0)); 72 Keyboard.Listen(Key.Up, ButtonState.Down, Movement, null, new Vector(3500, 0)); 71 73 Keyboard.Listen(Key.Left, ButtonState.Down, ChangeAngle, null, 1.0); 72 74 Keyboard.Listen(Key.Right, ButtonState.Down, ChangeAngle, null, -1.0);
Note: See TracChangeset
for help on using the changeset viewer.