Rchristiani Posted May 20, 2014 Share Posted May 20, 2014 I have searched a few times on this forum for this issue, but I can't seem to fix it based on the results. I want to set up collision based on a polyline, so I add the infoGW.game.load.tilemap('collision', 'assets/ghost-wizard.json', null, Phaser.Tilemap.TILED_JSON);And then:GW.map = GW.game.add.tilemap('collision');GW.layer = GW.map.createLayer('collision');On the createLayer line it is throwing the error, 'collision' is the name of the layer as well as the tilemap. When I inspect the element sent to the createLayer method I notice that the layer property is a completely emptya array. I have not altered the tilted JSON info at all. I am using Phaser version 2.0.5 dev branch. Any tips to help figure this one out. Or let me know if you have if any other info is needed. Thanks Link to comment Share on other sites More sharing options...
Stucky Posted December 3, 2015 Share Posted December 3, 2015 I also had "Invalid layer ID given: null" problem and it took me a few hours on the internet trying to solve the problem.For me, changing the encoding to "CSV" instead of "base64" works. You might want to try that. Link to comment Share on other sites More sharing options...
jmp909 Posted December 3, 2015 Share Posted December 3, 2015 nope, you can't use createLayer on an Object layer, it's only for Tile layers if you're using p2 you can use convertCollisionObjectshttps://www.mvcodeclub.com/lessons/creating-enemies-and-collisions-in-phaser-and-tiledvar walls = game.physics.p2.convertCollisionObjects(map, "Collisions", true); for(var wall in walls) { walls[wall].setCollisionGroup(wallsCG); walls[wall].collides(playerCG); } Link to comment Share on other sites More sharing options...
Recommended Posts