Jump to content

TilemapLayer getTileX/Y is undefined


Todi
 Share

Recommended Posts

Hey guys!
 
So, always I try to get the real coordinates of my entities in the map, using <layer>.getTileX/Y, I get this error message: "getTileX/Y is not a funcition". Or, when I try to log the function in the console, I receive the message "undefined". What I am doing wrong?
 
var layer = this.map.layer;console.log(layer.getTile); // undefined
var layer = this.map.layers[0];console.log(layer.getTileX); // undefinedconsole.log(layer.getTileY); // undefined

Thanks!

Link to comment
Share on other sites

Ah yes so it is :)

 

In that case I think the problem is simply that you're using it as a property rather than a function. Should be `layer.getTileX(v)` where v is the pixel coordinate.

 

So, in the create method of the level, I got the createLayer return, that is a TilemapLayer, and now it works! What I done before, was get the layer (TilemapLayer) from <Tilemap>.layers[0] (my test path) but it didn't work, do you know why?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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