public void Update(GameTime gameTime, IInputService input) { _deltaTime = (float)gameTime.ElapsedGameTime.TotalMilliseconds; if (input.CheckMoveRight() && Velocity.X < 20) { Velocity += new Vector2(1, 0) * (_acceleration * _deltaTime) ; Facing = Events.MoveRight; } else if (input.CheckMoveLeft() && Velocity.X > -20) { Velocity -= new Vector2(1, 0) * (_acceleration * _deltaTime); Facing = Events.MoveLeft; } else if (Velocity.Equals(Vector2.Zero)) { Facing = Events.Idle; } else { if (Velocity.X > 0) // Resistance Velocity -= _resistance; else if (Velocity.X < 0) Velocity += _resistance; } // Maks grense for gravitasjonshastighet if (VelocityGravity.Y < 10) { VelocityGravity += _gravityDirection * _acceleration * _deltaTime; Velocity += VelocityGravity; } Position += Velocity; base.Update(gameTime); }