Jump to content

Phaser doesn't see first layer of TiledMap


Mickety
 Share

Recommended Posts

tl;dr

game.physics.startSystem(Phaser.Physics.ARCADE);

GameMap = game.add.tilemap('GameMap');
GameMap.addTilesetImage('TileSet', 'TileSet');

under = GameMap.createLayer('Underground');
layer = GameMap.createLayer('TileMap');
trees = GameMap.createLayer('Collideables');

GameMap.setCollision(7,true, "TileMap" ); // Deep water 1
GameMap.setCollision(17,true, "TileMap" ); // Deep water 2
GameMap.setCollision(27, true, 'Underground'); // Darkness
GameMap.setCollision(37, true, 'Collideables'); // Trees

game console.logs an error " No such layer name: TileMap"

So player doesn't collide with water in the begining of the game.

If I switch to layer "underground" with:

Quote

GameMap.setLayer("Underground")

Player begins collision with water as if everything is okay. I also don't receive any errors about layers like "Collideables" and "Underground". I've rechecked the names in the TiledMap multiple times but can't seem to pinpoint the source of this problem.

What is that all about?

 

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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