Stephen304 Posted January 25, 2014 Share Posted January 25, 2014 We have a terrain generator that generates csv tilemaps that we need to load side by side so the player can walk continuously from one to the other infinitely. Is there an easy way to do this in 1.1.3 or are there any useful features of 1.1.4 that would help? Link to comment Share on other sites More sharing options...
irc- Posted January 26, 2014 Share Posted January 26, 2014 I've been having this same problem! I've maxed out tilemaps around 4000x1000, but I need to work with a much larger world, and splitting it into many, smaller tilemaps seems to be the way to go, but I don't know how to do this - if something needs to be patched/tweaked for this to work, I'd love to contribute back to phaser. Thanks! Link to comment Share on other sites More sharing options...
rich Posted January 27, 2014 Share Posted January 27, 2014 This is harder to achieve than it sounds, so I'm open to suggestions on how to do it. Say you've got 4 tilemaps each 5000px wide. The way the camera and moving around the tilemap works now is that they are mapped to world coordinates, so when you're at x: 4500 in the world, you're at 4500px in the tilemap too. To support chaining one map onto another I would need to add a 'world offset' to the map, so that instead of being 0 to 5000, map 2 would start at 5000 and go to 10,000. Otherwise any sprites that you spawn say based on map coordinates would be in the wrong place. I'm not sure if this is a great solution though. The need for an infinite terrain means needing the ability to modify the contents of the map data directly (which you've already got), but in such a way that the camera never thinks it has reached the end of the map / world. I'm open to suggestions on how best to achieve this. Link to comment Share on other sites More sharing options...
Stephen304 Posted January 29, 2014 Author Share Posted January 29, 2014 Is it possible to load in 2 tilemaps? The idea I have is to load the main one and then the next one with an x offset but I haven't been able to get it to work (nothing happens or the second one isn't visible). I tried:layer = game.add.tilemapLayer(0, 0, winW, winH, tileset, map, 0);layer2 = game.add.tilemapLayer(80, 0, winW, winH, tileset, map, 0);Because the test map is 80 blocks wide, but the second layer doesn't show up. Link to comment Share on other sites More sharing options...
Recommended Posts