SoulBeaver Posted November 2, 2014 Share Posted November 2, 2014 Hello, I've recently acquired some sprites from Oryx and have attempted to load the sample Tiled file contained within. I'm able to load the assets just fine in my Preloader: loadAssets() { this.load.tilemap("oryx_tilemap", "assets/tilemaps/maps/oryx_test.json", null, Phaser.Tilemap.TILED_JSON); this.load.image("oryx_creatures", "assets/tilemaps/tiles/oryx_creatures.png"); this.load.image("oryx_items", "assets/tilemaps/tiles/oryx_items.png"); this.load.image("oryx_tiles", "assets/tilemaps/tiles/oryx_tiles.png"); this.load.image("oryx_world", "assets/tilemaps/tiles/oryx_world.png"); this.load.image("oryx_world2", "assets/tilemaps/tiles/oryx_world2.png"); } However, as soon as I attempt to "do" anything with the map, it crashes: create() { this.game.stage.backgroundColor = "#ffffff"; this.map = this.game.add.tilemap("oryx_tilemap"); // Error here this.map.addTilesetImage("oryx_world", "oryx_world"); this.map.addTilesetImage("oryx_creatures", "oryx_creatures"); this.map.addTilesetImage("oryx_items", "oryx_items"); this.map.addTilesetImage("oryx_world2", "oryx_world2"); this.layer = this.map.createLayer("background"); this.layer.resizeWorld(); } With the following error message: Uncaught TypeError: Cannot read property '2' of undefined Phaser.TilemapParser.parseTiledJSON Phaser.TilemapParser.parse Phaser.Tilemap Phaser.GameObjectFactory.tilemap InGame.create Phaser.StateManager.loadComplete Phaser.StateManager.preUpdate Phaser.Game.update Phaser.RequestAnimationFrame.updateRAF You can find the entire .json in this pastebin snippet. I'm not aware that I'm messing something up, judging from the tilemap example. What could I be doing wrong? Is the tilemap using any properties that are unsupported by Phaser? Link to comment Share on other sites More sharing options...
lastnightsparty Posted November 4, 2014 Share Posted November 4, 2014 Hi SoulBeaver, I encountered this error also a few weeks ago. The simple fix for me was to make sure that no tiles in Tiled used 'rotation'. Phaser doesn't seem to recognize rotation in Tiled. It's best to create a new rotated file and add it to the tile set. Vyara, fatboyarming and SoulBeaver 2 1 Link to comment Share on other sites More sharing options...
SoulBeaver Posted November 9, 2014 Author Share Posted November 9, 2014 Hello lastnightsparty, thank you for your input! It steered me in the right direction. First, Tiled does not export the transparent background color. If your tiles have a black background, Tiled will respect that in the editor but not export it. Phaser will then pick up the tiles and render them with a black background. Secondly, and this is largely my mistake, I used the wrong tileset image. Oops Thanks for the help! lastnightsparty 1 Link to comment Share on other sites More sharing options...
lastnightsparty Posted November 10, 2014 Share Posted November 10, 2014 Ahh, thank you. I'm having some other little glitches and this may point me in the right direction too... Link to comment Share on other sites More sharing options...
Vyara Posted October 9, 2018 Share Posted October 9, 2018 @lastnightsparty Thank you so much... I am having trouble with this the whole day. Literally spended more than 5 hours cheking my JSON file for anything. On 11/4/2014 at 5:16 PM, lastnightsparty said: Hi SoulBeaver, I encountered this error also a few weeks ago. The simple fix for me was to make sure that no tiles in Tiled used 'rotation'. Phaser doesn't seem to recognize rotation in Tiled. It's best to create a new rotated file and add it to the tile set. Saved my party later :) Link to comment Share on other sites More sharing options...
Recommended Posts