Closed bjornstar closed 3 years ago
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/pmndrs/racing-game/6nWwHzDV96B1reEC3VEGzHNHF4w1
✅ Preview: https://racing-game-git-fork-bjornstar-fix-sounds-pmndrs.vercel.app
I noticed on a low end system the horn could get quite delayed. This PR attempts to improve responsiveness of the sound effects by separating them into individual components. The trade-off is more boilerplate.
useToggle
now accepts an array and all entries must be true to toggle it onuseToggle
for all instances of audio to prevent large component re-renders (the train would noticeably flicker when toggling sound)BoostAudio
stops when we run out of boostBrakeAudio
stops when we slow down enoughrpmTarget
is now on the mutation object and is calculated alongside speed