Search the Community
Showing results for tags 'paste'.
-
I'm working on an endless runner than uses multiple tilemaps as segments in order to achieve a procedurally generated effect. I'm copying tile data from a buffered tilemap (not being rendered) and pasting that data to another tilemap (currently being rendered) but not all the tiles show up. I copy and paste the tiles in three separate batches. The first batch works fine. The second and third batch of tiles don't render at all, but the collision tiles still work. All the tiles are copied from the same tilemap. Attached is the relevant file. Runner.js
-
In my quest to have a dynamically loading tilemap, I am trying to use the copy/paste function provided by the tilemaps to copy tiles from one map to a distinct map (the original one is not rendered, it simply serves as a "tile data store" for now (later on it'll handled by a server)). For some reason, I can copy data from my first tilemap to the second one, but the location where it is pasted is not right at all. I even have to provide negative numbers in the paste function to align them correctly var cellSize = 4; map = game.add.tilemap('map'); // Loaded from JSON above /* Map renderer */ renderedMap = game.add.tilemap(); renderedMap.addTilesetImage('magecity', undefined, undefined, undefined, undefined, undefined, 1); // I want the GID to start at 1 renderedMap.setCollisionByExclusion([2, 237, 335]); ground = renderedMap.create('ground', 3 * cellSize, 3 * cellSize, 32, 32); ground.resizeWorld(); cells = map.copy(0, 4, cellSize, cellSize); renderedMap.paste(0, 0, cells, ground); //Here the data pasted is NOT at (0,0) (It looks like it was pasted at (0,8)) As usual, thanks ! .