Workshop › OutRun-style Racer › Step 20 of 44
Now the left and right arrows change playerX a little every frame. You may drive onto the grass, but not away from
the road: playerX stays between -2.5 and 2.5.
```js
const steer = (keys.ArrowRight ? 1 : 0) - (keys.ArrowLeft ? 1 : 0)
playerX += steer * 0.04
playerX = Math.max(-2.5, Math.min(2.5, playerX))
```steer is 1 when right is held, -1 when left is held, and 0 when both or neither are.playerX moves by 0.04 in that direction.playerX between -2.5 and 2.5, the same way we kept the speed in range.In update, above position += speed, write the three lines followed by an empty line.
Skills: Keyboard and mouse input
← Move the camera sideways No turning on the spot →