gridToWorldPosition problem

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]

Is this an Iso or Orthographic map? And what version of Lime are you using, there is a possibility the name of the function changed in an update but can’t remember now. [import]uid: 5833 topic_id: 10368 reply_id: 37835[/import]

Hi Graham,

It’s an orthographic using Lime_3_3_May_2011. [import]uid: 39538 topic_id: 10368 reply_id: 38111[/import]

Hmm, strange. Are you able to send your project, or a simple one demoing the problem, to support@justaddli.me for me to look at? [import]uid: 5833 topic_id: 10368 reply_id: 38249[/import]