# Horizontal movement, acceleration, and max speed

**URL:** <https://forum.defold.com/t/horizontal-movement-acceleration-and-max-speed/66115>\
**Category:** Questions\
**Created:** [August 21, 2020, 12:24am UTC](https://forum.defold.com/t/horizontal-movement-acceleration-and-max-speed/66115 "2020-08-21T00:24:34Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [August 21, 2020, 6:27am UTC](https://forum.defold.com/t/horizontal-movement-acceleration-and-max-speed/66115/5 "2020-08-21T06:27:06Z")

</div>

> [@mako](#):
>
> I’ve been testing this with and without delta time.

If you are doing calculations in update() and don’t factor in delta time you will in a matter of frames (ie fractions of a second) end up at max speed.

I see that you’ve discarded the code from [this post](https://forum.defold.com/t/movement-tutorial-velocity-cap/29142/8) and I don’t really understand what you are doing with speed1 and speed2 in the snippet of code you shared. speed2 seems to be the be the horizontal max speed and speed1 is the current speed with movement factored in somehow.

BTW I created an example from the previous post where we discussed accelerating speed up to a max speed: [https://defold.com/examples/basics/movement\_speed/](https://defold.com/examples/basics/movement_speed/)

---

_[View the full topic](https://forum.defold.com/t/horizontal-movement-acceleration-and-max-speed/66115)._
