Jump to content

Add Collision for diffrent tile map layers


Recommended Posts

So I have not quite figured this out. But I am trying to set two diffrent collisions for two seprate tile map layers. For instance I have a ground layer that the player can run on and a obstacle such as spikes that a player will be able to run into. But I dont want it to overlap. So I have attempted something like this in the create function. 

map = game.add.tilemap('GroundTilePrototype');
		// Add the tileset to the map
		// Create the layer by specifying the name of the Tiled layer
		layer = map.createLayer('Tile Layer 1');
		// Set the world size to match the size of the layer
		// Enable collisions for the first tilset element

		layer2 = map.createLayer('Tile Layer 2');
		//set spike colosion

 And I thought I could do something like this in the update function. But It will only work for the first layer. Could any one point me toward the right direction?


Thanks for the help.

Link to comment
Share on other sites


  • Recently Browsing   0 members

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