Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Set Damping for realistic movement
- this.mf_Body.LinearDamping = 5f;
- // Set movement speed and max speed.
- this.mec_movementSpeed = FarseerConvertUnits.ToSimUnits(new Vector2(10, 10));
- this.mec_maxSpeed = FarseerConvertUnits.ToSimUnits(new Vector2(50, 50));
- // Example movement code
- public void IncreaseSpeedX()
- {
- this.mf_Body.ApplyLinearImpulse(new Vector2(this.mec_movementSpeed.X, 0));
- this.mf_Body.LinearVelocity = new Vector2(Math.Min(this.mf_Body.LinearVelocity.X, this.mec_maxSpeed.X),
- this.mf_Body.LinearVelocity.Y);
- }
- public void IncreaseSpeedY()
- {
- this.mf_Body.ApplyLinearImpulse(new Vector2(0, -this.mec_movementSpeed.Y));
- this.mf_Body.LinearVelocity = new Vector2(this.mf_Body.LinearVelocity.X,
- Math.Min(this.mf_Body.LinearVelocity.Y, this.mec_maxSpeed.Y));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement