# I want to make an acceleration based movement

Attention Topic was automatically imported from the old Question2Answer platform.

I want to make a movement system where the player’s speed increases progressively until they get to top speed,so movement feels more natural.
However,instead of the player’s speed increasing progressively (although quickly) until top speed,the player reaches top speed almost instantly.

Basically,my intention was to create a system that adds the player’s speed to 10 units per frame until it got to the top speed,90 units per frame. However,the speed value goes instantly from 0 to 80 and from 80 to 90,instead of going from 0 to 10,10 to 20 and so goes on until it got to 90.

Any clue to why this happens?

The code:

var motion = Vector2()
var speed = 10
var stop_speed = 80
var top_speed1 = 90
var top_speed2 = -90
var input_left = false
var input_right = false
var input_up = false
var left
var right
var x_math
var x_direction = 1
const jump_power = -250
const gravity = 10
var shot_timer = 0

func _physics_process(delta):
motion = move_and_slide(motion,motion)

var input_left = Input.is_action_pressed(“Left”)
var input_right = Input.is_action_pressed(“Right”)

if input_left:
left = 1
motion.x -= speed
else:
left = 0
motion.x += stop_speed
if input_right:
right = 1
motion.x += speed
else:
right = 0
motion.x -= stop_speed

if !input_left and x_direction == -1 and motion.x < 0:
motion.x = 0
if !input_right and x_direction == 1 and motion.x > 0:
motion.x = 0

if motion.x > top_speed1:
motion.x = top_speed1
if motion.x < top_speed2:
motion.x = top_speed2

You need to incorporate the `delta` parameter in your calculations. Strictly speaking acceleration is change in velocity over time. That way the amount of acceleration will be modified by how long it has been between calls to the physics process.