javascriptphaser-frameworktilesets

Can I an Identifier for a tile in Phaser.js


So, I've been making a sort of 2d minecraft, and i need a Phaser method/function to be able to identify each tile by their tileset number,

For example, when i place a tile from a tileset, i require its tile set no.

this.block = this.worldLayer.putTileAtWorldXY(
          6,
          this.worldPoint.x,
          this.worldPoint.y
        );
        this.block.setCollision(true);

that 6 is the tile number of a tile from my tile set, and i need a way to get that number from any tile when i click it, is there anyway to do this?

thanks in advance


Solution

  • I actually found a method that works at

    https://www.html5gamedevs.com/topic/9627-how-to-get-tile-index-property/

    use .getTileAt().index