bobowitz Posted May 10, 2016 Share Posted May 10, 2016 Hi all, I'm new to using Phaser (have a few years of experience with Java and C++ for desktop game development). The way I made levels for my games in the past was by just creating a bunch of sprites (one per tile of the map) that build up the map in a sort of grid. I tried doing this in Phaser by making a group and adding sprites to it for each wall tile. My level is quite big, however, so there are over 3,000 wall tiles. This caused the game to lag quite a bit, even though only a hundred or so tiles are ever on screen at the same time. My question is, how should I go about structuring my tiles? Should I use a Group, or try to do something with Tilemaps, or some sort of plugin? Is making one Sprite per wall tile the wrong approach? Another thing is that I want to procedurally generate my levels at runtime, so loading the level from a file is not really an option. Thank you for reading. Link to comment Share on other sites More sharing options...
drhayes Posted May 10, 2016 Share Posted May 10, 2016 I would look at using Tiled and building out with tilemaps. I can't speak to the "one sprite per wall" because there's a lot of stuff at work there vs. a tilemap. It's something you should definitely check out. To dynamically create a tilemap level add the tilemap data directly into the cache via "game.cache.addTilemap('tilemapKeyNameHere', null, tilemapJsonYouGenerated, Phaser.Tilemap.TILED_JSON);". You should then be able to create it in-game. Link to comment Share on other sites More sharing options...
Recommended Posts