Closed akarle closed 7 years ago
I haven't looked into this yet in depth but you might be able to reset the timer with window.clearTimeout
and then starting it again... Or is the problem more complicated than that?
It's slightly more complicated, BUT, I thought of a potential solution:
Each Location
has the ability to know it's HTML ID ("rowxcol"), so instead of making the timeout a general thing that the method triggers, each Location should have a timeout property which gets reset each time a location is touched!
Boom, we win. I think.
So I guess, with this new update to fog, (#53), really Location.fog is no longer a true/false questions, its more of a "when is it coming back" question, ya feel?
I branched and plan to remove all fog true/false-ness for this update. It will involve each Location having a setTimeout at which point the fog gets turned back on.
In other words, we shouldn't directly set fog (except for maybe a safe room) and instead we should reset the timer. Ill make a function to reset the timer every time you touch a square.
If you end up in your fog tail (or rather visibility tail) before its timeout gets executed and it is deleted, you will be obscured...
Need to add safeguards for the current position of the character... Or maybe have a sort of way to reset the timer?