Jump to content

Phaser - how to select a layer in a Tiled map as a collision layer


maowor
 Share

Recommended Posts

Hi, I'm quite new to using Phaser and the Tiled map editor and I'm currently making a platformer game using a Tiled map I made. I haven't been able to find any information in the Tiled or Phaser documentation, or in tutorials or forums on how to select a layer in my Tiled map to be a collision layer.

 

I have 3 layers plus one layer for objects. I've put all the tiles I want the player to be able to collide with such as the ground and platforms in one layer. I've read answers saying that you need to include the index of the collision tiles but I don't want to include individual tiles as there a lot of tiles used. I've seen Phaser/Tiled tutorials showing a layer as having collision set to true but I can't find information in the Tiled documentation on how to do this. Below is a screenshot of my Tiled map JSON file, the layer I want to make a collision layer is called "Tile Layer 2". I'm not sure if I need to mention this layer name in my Phaser code to make it a collision layer or if I need to somehow set the layer to collision: true in Tiled.

 

I'd really appreciate any suggestions on how to make this a collision layer. Thanks.

 

C7w9klh.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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