Arcanorum Posted April 10, 2016 Share Posted April 10, 2016 I'm defining the collision bounds of my game world using rectangle objects in Tiled. Is there an easy way to convert rectangle objects made in Tiled on an objects layer into Arcade physics bodies? Link to comment Share on other sites More sharing options...
megmut Posted April 11, 2016 Share Posted April 11, 2016 In tiled, if you go and add attributes to those specific rectangle objects, then in phaser, you should be able to add it as a sprite / image. You'll have to double check this, as I haven't tried it yet, but it shouldn't be difficult. You should place any data associated with an object in tiled, into the objects tab. Maybe something along the lines of... //create a sprite from an object createFromTiledObject: function(element, group) { var sprite = group.create(element.x, element.y, element.properties.sprite); //copy all properties to the sprite Object.keys(element.properties).forEach(function(key){ sprite[key] = element.properties[key]; }); }, Read more about it here : https://gamedevacademy.org/html5-phaser-tutorial-top-down-games-with-tiled/ Link to comment Share on other sites More sharing options...
Arcanorum Posted April 11, 2016 Author Share Posted April 11, 2016 That's what I was thinking I would have to do. I was hoping for something like convertTilemap from P2 where it just adds physics bodies, but in Arcade. Oh well. Link to comment Share on other sites More sharing options...
Recommended Posts