team-thirtyfour / js13kgame

Glitch or die trying
https://team-thirtyfour.github.io/js13kgame/
1 stars 1 forks source link

'level' is not defined in Renderer.js #50

Closed Adel closed 8 years ago

Adel commented 8 years ago

dirty fix:


let storedLevel= null;

const init = (level) => {
    storedLevel = level;
    draw(canvasMovable, level.entities.filter((e) => e.isMovable));
    draw(canvasStatic, level.entities.filter((e) => !e.isMovable));
};
//...
window.addEventListener('resize', () => {
    canvasStatic.width = window.innerWidth * 0.8;
    canvasStatic.height = window.innerHeight * 0.8;
    canvasMovable.width = window.innerWidth * 0.8;
    canvasMovable.height = window.innerHeight * 0.8;
    init(storedLevel);
}, false);
manland commented 8 years ago

What about put a simple flag let drawStatic = true in the renderer. And in the next loop Renderer.render() { if(drawStatic) {...} drawMovable(); !?

It smel better !?