Jump to content

TileMap doesn't show correctly


jopcode
 Share

Recommended Posts

Hi!, i use tiled for create a map, but when i try show the map in the game, this doesn't show correctly

(the map in tiled)

Inmap.thumb.PNG.fa8c4f2e4f3f2e1e7791c6c5faaaf0e7.PNG

And the map in the game:

ingame.thumb.PNG.34b727fef0ed42cb28eedd88bc57a355.PNG

The main file:

class Main extends Phaser.State {

	create() {
		this.game.physics.startSystem(Phaser.Physics.ARCADE);
		
		this.game.add.sprite(0, 0, 'Sky');

		this.map = this.game.add.tilemap('Tilemap');
		this.map.addTilesetImage('Tiles', 'Tileset');

		this.layer = this.map.createLayer('Platforms');
		this.layer.resizeWorld();
		this.wrap = true; 
		this.cursors = this.game.input.keyboard.createCursorKeys();

	}

	update() {
		if (this.cursors.left.isDown)
    {
        this.game.camera.x -= 8;
    }
    else if (this.cursors.right.isDown)
    {
        this.game.camera.x += 8;
    }

    if (this.cursors.up.isDown)
    {
       this.game.camera.y -= 8;
    }
    else if (this.cursors.down.isDown)
    {
        this.game.camera.y += 8;
    }
	}

}

export default Main;

Any idea or solution?(sorry for my bad english)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...