1 decade ago by subelsky
My game has a top-down 2D view (RPG-style). I'd like to implement a "zoom" feature but it looks like ig.system.resize does not resize all of the background layers. Here's my code:
That keeps the canvas a constant size but changes the zoom level so a wider area of the map can be viewed. The problem is, only the background map that is tiled gets resized. Everything else is displayed full-size.
I just noticed that if I turn off preRender for the non-repeating map, this problem is fixed, but then the other map layers don't pull the right tiles out of the tileset (e.g. something seems screwed up with the way the tiles are sliced out of the sprited image).
Am I using the right approach here or am I missing something? Impact has been a joy to work with so I assume it's a problem on my end!
var zoomFactor = (localStorage.getItem("zoom") || 100) / 100; ig.system.resize(Math.round($(window).width() / zoomFactor),Math.round($(window).height() / zoomFactor),zoomFactor);
That keeps the canvas a constant size but changes the zoom level so a wider area of the map can be viewed. The problem is, only the background map that is tiled gets resized. Everything else is displayed full-size.
I just noticed that if I turn off preRender for the non-repeating map, this problem is fixed, but then the other map layers don't pull the right tiles out of the tileset (e.g. something seems screwed up with the way the tiles are sliced out of the sprited image).
Am I using the right approach here or am I missing something? Impact has been a joy to work with so I assume it's a problem on my end!