Hi,
I am a newbie to Corona and Lime , but my company want to build a game with isometric tiled map. And then I start to learn Corona and Lime these days.
I try to follow the example “IsometricAndPlayer” which is included in Lime. I found it is useful, but i want to touch the screen to move the object. Then I added the following code :
local onTouch = function(event)
player.x = event.x;
player.y = event.y;
end
Runtime:addEventListener("touch", onTouch)
The object has moved but not the position I touch. Anyone know why it moved to position far away from my touching point.
After I try to convert the touching point to a grid position by using worldToGridPosition() and screenToGridPosition(), like this :
local onTouch = function(event)
local pos = lime.utils.screenToGridPosition(map, { x = event.x, y = event.y })
print(dump(pos))
local pos1 = lime.utils.worldToGridPosition(map, event)
print(dump(pos1))
end
Both pos and pos1 return [table]{}.
I hope somebody can help me to solve the problem. Thanks. [import]uid: 92989 topic_id: 16696 reply_id: 316696[/import]