Project: canvas
Task (challenging): Refactor code, split into multiple files, use ES modules: index.html; style.css; main.js for init and game loop; constants.js for constants; render.js for drawing; store.js for store, keep state in 'window.store'; util.js; event.js for events; Add comments to explain code. Note: Avoid losing context between files; do not confuse assets resources with objects in the store, record assets in 'store.assets'; keep store in window; store dpr in the store; init store before anything; after updateStore, obtain the new store object to avoid using old data; Do not omit the code. Do not write game logic in the store; Remember to consider the method parameters when binding and unbinding events