# My Character moves faster in one direction based on the x position.

### Question

if my Character moves in -x, he moves slower to the right and the other way around.

Here is my code:

``````func _physics_process(delta):
if not is_on_floor() && gravityAllowed:
if velocity.y >= maxFallingVelocity:
if !timerRuns:
hardFallTimer.start()
timerRuns = true
elif hardFallTimer.is_stopped():
hardFall = true
velocity.y = maxFallingVelocity
else:
velocity.y += gravity * delta
hardFall = false
timerRuns = false

direction = Input.get_vector("left", "right", "up", "down").normalized()

if (direction != Vector2.ZERO):
if(direction.x > 0.65):
direction.x = 1
elif(direction.x < -0.65):
direction.x = -1
if(direction.y < -0.65):
direction.y = -1
elif(direction.y > 0.65):
direction.y = 1

if movementAllowed: #&& stateMachine.checkIfCanMove():
if (direction.x != 0):
if stateMachine.checkIfCanMove():
if sprinting:
velocity.x = move_toward(velocity.x, direction.x*(200), 60)
else:
velocity.x = move_toward(velocity.x, direction.x*(150), 60)
else:
if is_on_floor():
#60
velocity.x = move_toward(velocity.x, 0, 80)
else:
#60
velocity.x = move_toward(velocity.x, 0, 30)

move_and_slide()
#move_and_collide()
cornerCorrection(20, delta)
updateAnimationParameters()
``````