Sign in to follow this  
jopcode

TileMap doesn't show correctly

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)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.