I'm a newbie who just started learning phaser.

I have created a tile map with Tiled.

It is composed of two tiled layer: background & collision.

In collision layer I put some walls.

And in the game code,

I have loaded tilemaps, create them, and they shows perfectly.

Then I set the collision, and sense the collision in update();

I think it should make the sprite collide with wall, but it didn't..

I tried adding "collison" properties in Tiled as I found from some tutorials, but it didn't work either..

Can someone help me?

Below is the critical part of the collision code.(And Also I have all my codes packed and you can download with below hyperlink.)

//load tilemaps in preload.
this.load.tilemap('zombieset', 'assets/tilemaps.json', null, Phaser.Tilemap.TILED_JSON);
this.load.image('tiles', 'assets/tileset.png');

//start physic systems

//create tiles, and it shows perfectly.
this.map = this.add.tilemap('zombieset');
this.map.addTilesetImage('tileset1', 'tiles');

//set collision.
this.layer = this.map.createLayer('background');
this.layer = this.map.createLayer('collision');

//sensor collison in update()
this.physics.arcade.collide(this.asuna, this.layer);

PS. I have my all code & img & json packed here... Thanks~



There is an isometric plugin for phaser with physics capabilities that can help you with collisions.

Here's the link:


Check out their physics sample.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.