Jump to content

Map collision isn't working


Kobaltic
 Share

Recommended Posts

I can't get map collision to work for some reason. I assume the collide information is for the frame id and not the location on the map. Either way neither works. Here is my stuff

var layer;var player;function create(){ map = game.add.tilemap('town');    map.addTilesetImage('walls', 'walls');    map.addTilesetImage('broken', 'broken');    map.addTilesetImage('towers', 'towers');    map.addTilesetImage('house', 'house');    map.addTilesetImage('grass', 'grass');     map.setCollision(29); //This is frame id 29        grassLayer = map.createLayer('grass');    layer = map.createLayer('walls');}function update() {     game.physics.collide(player, layer);}
Link to comment
Share on other sites

After many hours of agony I found that the layer in the JSON file has to be the first one listed for the collision to work. It doesn't seem to matter for anything else about the layer as long as it is listed first. Although this also tells me that we don't have multi-layer collision.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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