DecodersLord Posted June 12, 2017 Share Posted June 12, 2017 Hello, I am new to the Phaser and Tiled editor. I have created an platform with Tiled with following JSON data: { "height":15, "layers":[ { "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 29, 0, 29, 29, 0, 29, 29, 29, 29, 17, 17, 0, 17, 17, 0, 17, 17, 17, 17, 17, 17, 0, 17, 17, 0, 17, 17, 17, 17], "height":15, "name":"Tile Layer 1", "opacity":1, "type":"tilelayer", "visible":true, "width":10, "x":0, "y":0 }], "nextobjectid":1, "orientation":"orthogonal", "renderorder":"right-down", "tileheight":70, "tilesets":[ { "firstgid":1, "name":"pltfrm", "source":"pltfrm3.tsx", "image":"tiles_spritesheet.png", "imagewidth":914, "imageheight":936 }], "tilewidth":70, "type":"map", "version":"2017.05.26", "width":10 } I have written basic preload and create functions as follow, function preload(){ //this.game.load.spritesheet('player','Images/player_spritesheet.png',28,30,5,1,1); this.game.load.tilemap('tilemap','assets/platform101.json',null,Phaser.Tilemap.TILED_JSON); this.game.load.image('tiles1','assets/tiles_spritesheet.png'); } function create(){ this.game.physics.startSystem(Phaser.Physics.ARCADE); this.stage.backgroundColor = "#7ec0ee"; map = this.game.add.tilemap('tilemap'); map.addTilesetImage('pltfrm','tiles1'); //backGroundLayer = map.createLayer('Tile Layer 2'); groundLayer = map.createLayer('Tile Layer 1'); map.setCollision([1,100], true, 'Tile Layer 1',false); groundLayer.resizeWorld(); /*player = this.add.sprite(0,0,'player'); player.scale.setTo(1.5,1.5); player.animations.add('walk',[0,1,2,1],6,true); player.anchor.setTo(0.5,0.5); this.physics.arcade.enable(player); player.body.collideWorldBounds = true; this.game.camera.follow(player);*/ } I am using following spritesheet.with 70x70 and spacing as 2. I thing my Math is wrong here if someone can point that out. I am having Warning message as: "Phaser.Tileset - pltfrm image tile area is not an even multiple of tile size" and nothing is shown in the canvas. I have read some threads where people are able to load images with the warning but I can't see the same result. Link to comment Share on other sites More sharing options...
Recommended Posts