Workshop › Angry Birds-style Slingshot › Step 4 of 47
The shot is decided by two numbers: an angle (where the bird will fly) and a pull (how far the band is
stretched). We keep them in aim, set up by a reset function.
```js
let aim // { angle, pull }
function reset() {
aim = { angle: -0.6, pull: 50 }
}
reset()
requestAnimationFrame(loop)
```let aim declares a variable whose value will change; the comment says what it will hold.Math.PI (about 3.14). 0 points right; because y grows downwards,
negative angles point up. -0.6 (about 34°) aims up and to the right.reset() is called once before the loop starts.SLING line leave an empty line and write let aim and the reset function.reset() above requestAnimationFrame(loop).Skills: Game states
← Draw it again and again A bird in the sling →