You should add a variable that contains the maximum speed that the player can reach, since now you can get infinite speed if you keep going in one direction.