I’m trying to use gridToWorldPosition but get error:
“attempt to call field ‘gridToWorldPosition’ (a nil value)”
Scanning through all the lime lua modules the only place I can see this function is where it is called by createTileAt in lime-tileLayer.lua but it doesn’t seem to be defined anywhere.
What I’m trying to do is convert an x, y into a gridPosition and then turn that gridPosition back into an x,y. The idea being that I start with an x,y that is at a random place within a grid position but I want an x,y that is in the correct place within the grid such that I can place a tile.sprite using this new x,y and the tile will then be placed correctly in the grid.
-- get grid position from x, y
local gridPosition = lime.utils.worldToGridPosition(map, {x=event.x, y=event.y})
-- convert gridPosition to worldPosition
local worldPosition = lime.utils.gridToWorldPosition( map, gridPosition, {x=0, y=32})
Anyone any ideas what I’m doing wrong?
[import]uid: 39538 topic_id: 10368 reply_id: 310368[/import]