ltruelove Posted January 20, 2014 Share Posted January 20, 2014 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 More sharing options...
rich Posted January 20, 2014 Share Posted January 20, 2014 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. ltruelove 1 Link to comment Share on other sites More sharing options...
jerome Posted January 20, 2014 Share Posted January 20, 2014 If you really need to test polygon collisions (or circles, or even rotated boxes), you can easily use this very light library : http://jriecken.github.io/sat-js/docs/SAT.html http://jriecken.github.io/sat-js/ ltruelove 1 Link to comment Share on other sites More sharing options...
ltruelove Posted January 24, 2014 Author Share Posted January 24, 2014 Thanks!!! Link to comment Share on other sites More sharing options...
jerome Posted January 29, 2014 Share Posted January 29, 2014 here is a example : http://jerome.bousquie.fr/SAT/rotating polygons with some trigonometry calculation, same as Phaser Point.rotate(), I guess Link to comment Share on other sites More sharing options...
neoRiley Posted April 18, 2014 Share Posted April 18, 2014 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! valueerror 1 Link to comment Share on other sites More sharing options...
Recommended Posts