aaricpittman Posted January 27, 2021 Share Posted January 27, 2021 I'm struggling with getting Phaser to use my tilemap that I'm generating using Tiled. I have my game dimensions configured for 640 x 480. In Tiled my map dimensions are 80 x 30 tiles with a tile being 16 x 16. In Tiled things look correct but in the game my sky layer is offset for some reason. However, my ground layer is positioned correctly. I've attached a screenshot of what I'm seeing in the game. Below is my code for initializing the tilemap and its layers this.tileMap = this.make.tilemap({ key: `${this.levelKey}-map` }) this.physics.world.setBounds(0, 0, this.tileMap.widthInPixels, this.tileMap.heightInPixels) this.cameras.main.setBounds(0, 0, this.tileMap.widthInPixels, this.tileMap.heightInPixels) const skyTiles = this.tileMap.addTilesetImage('level1-sky', `${this.levelKey}-sky`) this.tileMap.createLayer('sky', skyTiles, 0, 0) const groundtiles = this.tileMap.addTilesetImage('level1-tileset', `${this.levelKey}-tileset`) this.groundLayer = this.tileMap.createLayer('ground', groundtiles, 0, 0) this.groundLayer.setCollisionByProperty({ collides: true }) this.platformLayer = this.tileMap.createLayer('platforms', groundtiles, 0, 0) this.platformLayer.setCollisionByProperty({ collides: true }) Link to comment Share on other sites More sharing options...
Recommended Posts