I am trying to detect what tile my player is on, I have an actor called "bg" that has a tileMapRenderer it points to a tileMap with one layer "0 - Layer" here is the code I am trying and the error I am getting:
if (Sup.Input.isKeyDown("T")){ var tileMap = Sup.getActor("bg").tileMapRenderer.getTileMap(); Sup.log( tileMap.getTileAt(0, this.actor.getX(), this.actor.getY()) ); }
error: "Uncaught TypeError: Cannot read property '0' of undefined"
if (Sup.Input.isKeyDown("T")){ var tileMap = Sup.getActor("bg").tileMapRenderer.getTileMap(); Sup.log( tileMap.getTileAt(1, this.actor.getX(), this.actor.getY()) ); }
error: "runtime.js:336 Uncaught TypeError: Cannot read property 'data' of undefined"
I checked the data coming back from this.actor.getX() / this.actor.getY() and they are both always a float.
I am stumped, thanks for any help!