Skip to content

Commit 9148d56

Browse files
committed
Change 100 times per second to 100 degres per second
1 parent 45639db commit 9148d56

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

_chapters/asteroids.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Let’s say we want a left- or right-arrow keydown event to start the ship rotat
100100
```
101101
102102
So as promised, this function is setting the `transform` property on the ship, using the position and angle information stored in our local `state` object. We compute the new position by deducting or removing 1 (degree) from the angle (for a left or right rotation respectively) and simultaneously update the state object with the new angle.
103-
Since we specify 10-millisecond delay, the ship will rotate 100 times per second.
103+
Since we specify 10-millisecond delay, the ship will rotate 100 degrees per second.
104104
105105
We’re not done yet. We have to stop the rotation on keyup by calling `clearInterval`, for the specific interval we just created on keydown (using the `handle` we stored). To do this, we’ll use `document.addEventListener` to specify a separate keyup handler for each keydown event, and since we will be creating a new keyup listener for each keydown event, we will also have to cleanup after ourselves or we’ll have a memory (event) leak:
106106

0 commit comments

Comments
 (0)