Tilemap.tileat returns -1 if you use variables in the x and y values. if I change the x and y to just numbers it works as intended.
thanks
Luke
Variables seem to work fine on my end (see below). Is this what you're trying to do?
i'm trying to make so if i click on a tile that the player can walk on the character will move. but if the player can't walk on the tile it will stay put. but everytime i use tileat with a mouse action it sets it to -1
Develop games in your browser. Powerful, performant & highly capable.
okay i worked it out i was using x and y coords not the cell numbers. for example i was using 32 X 32 not 1 X 1
Ah OK — it took me a while to develop the habit of switching from x/y to tileX/tileY. The Tilemap.PositionToTileX / Tilemap.PositionToTileY expressions are really useful for converting them.
Good luck with your project!