Workshop › Doodle Jump-style Climber › Step 13 of 24
The higher you climb, the harder it should get. difficulty turns a world height into a number from 0 (the start) to 1
(10 000 pixels up).
```js
const START_Y = 500 // world y of the first platform
// 0 at the start, growing to 1 after climbing 10000 pixels.
function difficulty(y) {
return Math.min(1, (START_Y - y) / 10000)
}
```START_Y - y is how far above the first platform the height y is.Math.min(1, ...) stops it at 1.SPEED, write START_Y.keydown listener, write the comment and difficulty.Skills: Functions
← Lines on the wall Endless platforms →