Jump to content

Polygon Object in Tiled Object Layer for Collisions


ltruelove
 Share

Recommended Posts

Is it currently possible to use a polygon object in a Tiled object layer for collision detection? The file I'm playing with is here: https://github.com/ltruelove/bunnygame/blob/master/resources/hill.json. All the other files needed to look at it in Tiled are in the same folder.

 

I've been reading through the forums and the closest thing I could find was a post talking about the map having a collisionLayer property but when I try to console.log that out of the map and layer objects they're both undefined. Maybe I'm doing it wrong?

 

I'm trying to make a level where the player has to run uphill. I can get the tiles to work as blocks like I've seen in most of the examples, but I've not been able to figure out what I need to do to tell it to use my "Collision" layer.

Link to comment
Share on other sites

  • 2 months later...

I've added support for Tiled objects (rect, circle, polygon) to be converted to native Phaser geometry when parsed, but you will absolutely have to handle collision against those yourself.

 

Hey Rich, is there an example of how to do this?  I have an Object layer with poly's drawn for collision areas, how do i set this up in Phaser?

 

Thanks very much - have loved Phaser so far!  

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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