catbug in the see through zone
loop() function is not really a loop, and instead requests that the browser call itself (
loop()) again when it's time to refresh the screen. The weird part is, if control flow is held by another function when that time comes, behavior is unpredictable. This means we must make sure that all functions have finished executing before the request to run
loop() again can be made. So instead of a simple loop with a chain of sub-functions, each taking care of its own logic, we have an if-else ladder or switch-case state-machine that handles the game logic, and most functions that would be loops in the C version have to be made into singleton classes that keep track of their states between 'loop' executions.
There is a
manifest.json file in place so that you can add the game to the home screen on your phone, but I haven't implemented caching service-workers yet for completely offline use on mobile.