MattGibney / DarkThrone

Lovingly re-creating the DarkThrone experience.
https://darkthronereborn.com
1 stars 0 forks source link

Fix next turn in timing #27

Closed fpopa closed 4 months ago

fpopa commented 4 months ago

https://github.com/MattGibney/DarkThrone/assets/13131778/804671d5-8931-477d-a615-0888026beac8

I'm not happy with the setInterval inside the useEffect, it sometimes runs two intervals in parallel, couldn't replicate again when I tried, but I don't have a good idea about how we can improve it yet.

The timing function logic is now simpler, tried to use suggestive variable names, I initially used a one-liner and comments, something like:

    const remainingSeconds = (60*30)-((minutes*60+seconds)%(60*30))