We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
week5-adam-orian/src/components/Enemy.jsx
Lines 23 to 28 in 1a1747b
Here's a fun trick for "looping" a value back around
setEnemyX((prevX) => (prevX + 2) % 80)
Using the remainder effectively resets any value past 80 back to 0. E.g. (80 + 2) % 80 is 2. (100 + 2) % 80 is 22
(80 + 2) % 80
2
(100 + 2) % 80
The text was updated successfully, but these errors were encountered:
Oh but I'm not criticising your solution at all: it's clear and easy to understand and it works. I just think the remainder thing is neat 😅
Sorry, something went wrong.
No branches or pull requests
week5-adam-orian/src/components/Enemy.jsx
Lines 23 to 28 in 1a1747b
Here's a fun trick for "looping" a value back around
Using the remainder effectively resets any value past 80 back to 0. E.g.
(80 + 2) % 80
is2
.(100 + 2) % 80
is 22The text was updated successfully, but these errors were encountered: