pmndrs / racing-game

🏎 Open source racing game developed by everyone willing
https://racing.pmnd.rs/
MIT License
2.13k stars 176 forks source link

[Boost] Turn yellow at 60% remaining, and red at 30% remaining #166

Closed bjornstar closed 3 years ago

bjornstar commented 3 years ago

The old numbers were based on boost levels that were between 50 and 100.

vercel[bot] commented 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/2CpBUCimL1UbKnoTJRe4QRgVkfmD
✅ Preview: https://racing-game-git-fork-bjornstar-fix-boost-colors-pmndrs.vercel.app

bjornstar commented 3 years ago

Looks great! but let's move the hardcoded values out of the ui and into the store?

I gave the values names, but I don't think they need to move into another file as they are only used in this one place.

njm222 commented 3 years ago

Looks great! but let's move the hardcoded values out of the ui and into the store?

I gave the values names, but I don't think they need to move into another file as they are only used in this one place.

Yes it is only being used here but it shouldn't be stored here, but rather passed to it via props or from the store, because it is a ui element and it should be able to change functionality from props. If the boost limits are in the store > vehicleConfig when we have more vehicles with different boost values (maxBoost, criticalLevel & warningLevel) it will work without having to change it again.

bjornstar commented 3 years ago

Yes it is only being used here but it shouldn't be stored here, but rather passed to it via props or from the store, because it is a ui element and it should be able to change functionality from props. If the boost limits are in the store > vehicleConfig when we have more vehicles with different boost values (maxBoost, criticalLevel & warningLevel) it will work without having to change it again.

Yes, but we don't have more vehicles with different boost values. When the need arises, it can be moved. There's no need to do it right now in this PR.