Jump to content

Creating Arcade physics bodies from Tiled rectangle objects


Recommended Posts

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
        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


  • Recently Browsing   0 members

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