Rissk13 Posted July 3, 2018 Share Posted July 3, 2018 Hi there, new user to Phaser and Tiled so not sure if this is an issue with my code or a bug, but thought I'd try here first. I'm trying to create a tilemap with an exported Tiled json map. I'm using Parcel so when I import via import map001 from "assets/tilemaps/map001.json"; and console.log it out, everything looks right. {height: 64, infinite: false, layers: Array(7), nextobjectid: 28, orientation: "orthogonal", …} height:64 infinite:false layers:(7) [{…}, {…}, {…}, {…}, {…}, {…}, {…}] nextobjectid:28 orientation:"orthogonal" renderorder:"right-down" tiledversion:"1.1.5" tileheight:32 tilesets:(4) [{…}, {…}, {…}, {…}] tilewidth:32 type:"map" version:1 width:64 But then, when I create my tilemap this.map = this.make.tilemap("map001"); It only saves some of the config: Tilemap currentLayerIndex:0 format:null height:10 heightInPixels:320 imageCollections:[] images:[] layer:(...) layers:[] objects:{} orientation:"orthogonal" properties:{} scene:GameScene {sys: Systems, anims: AnimationManager, cache: CacheManager, plugins: PluginManager, registry: DataManager, …} tileHeight:32 tileWidth:32 tilesets:(4) [Tileset, Tileset, Tileset, Tileset] version:"1" width:10 widthInPixels:320 As you can see, height and width are 10,layer and layers are empty (not sure the difference), and more. I'm using Phaser 3.10.1 and Tiled 1.1.5 Link to comment Share on other sites More sharing options...
Rissk13 Posted July 3, 2018 Author Share Posted July 3, 2018 So I think I figured it out, if anybody else stumbles here for the same issues. I successfully created the tilemap, I had to change it to: this.map = this.make.tilemap({ key: "map001" }); I also had to mess around with creating the layers and ended up with: this.map.createStaticLayer("Ground", groundTileset); "Ground" is the name of my layer from Tiled, groundTileset is from: groundTileset = this.map.addTilesetImage("ground", "groundTiles") I didn't think I'd need to specify the Tileset since I embedded them into the map. I thought that was required if you use multiple tilesets per layer in Tiled, so I'm not sure if there's a way to do that in Phaser. I tried passing the name of the embedded tileset instead but that didn't work. Will follow up here if I figure that out too. Link to comment Share on other sites More sharing options...
samme Posted July 3, 2018 Share Posted July 3, 2018 I'm curious to see a Parcel project (working on my own). Link to comment Share on other sites More sharing options...
Rissk13 Posted July 6, 2018 Author Share Posted July 6, 2018 The parcel part was easy in comparison to learning Phaser 3/Tiled with no previous phaser/game dev experience Definitely thinking of posting a tutorial or at least my source code when it gets to a decent stage to share with others, I'll link it here when I do. samme 1 Link to comment Share on other sites More sharing options...
samme Posted July 6, 2018 Share Posted July 6, 2018 How did you handle the hot reloading? Did you compile to one script or two? Link to comment Share on other sites More sharing options...
Rissk13 Posted July 6, 2018 Author Share Posted July 6, 2018 Ah sorry, I haven't done anything special there yet, just reloading the page automatically for now: if (module.hot) { module.hot.accept(function() { window.location.reload(); }); } samme 1 Link to comment Share on other sites More sharing options...
Recommended Posts