everything works except the max speed and I don't know why
Develop games in your browser. Powerful, performant & highly capable.
Have you looked in the debugger to see how the speed of the sprite changes after it is overlaid on the tile?