Jump to content

How to find first non-zero element in tile layer in Tiled map


Recommended Posts

After much searching and not finding, I must ask:



I'm wanting to scan through a tilemap layer looking for the first non-zero tile element in that layer (happens to be the collision layer).  I know how to find the element in the JSON file, but I want to automate that in the game due to the fact reshuffling my tilesets causes the collision tile index to change.


When I try to use the Tilemap.searchTileIndex(....) function,


thusly,  var cID = game.map.searchTileIndex(<a tile index#>, 0, false, game.CollisionLayer)


I get an odd error "game.map.searchTileIndex is not a function"

Looking inside phaser.js I cannot find any reference to searchTileIndex at all.  Surely I'm missing something, but...
Any help would be appreciated.


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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