move a grid ?

Hi,

my problem is a little special…i have a grid and a character. i would like that my character could move on my grid. 

So i thought that with the perspective.lua i could make this.

I thought that the camera move around the scene without change the coordinate of the objects inside the scene.  but it’s not the case. Here is a example of my snippet :

what is the good way to make this ? 

display.setStatusBar( display.HiddenStatusBar ) -------------------------------------------------------------------------------- -- "Local" -------------------------------------------------------------------------------- local widthscreen = 320 local heightscreen = 480 local require = require local perspective = require("perspective") ------------------------------------------------------------------------------ -- Build Camera ------------------------------------------------------------------------------ local camera = perspective.createView() -------------------------------------------------------------------------------- -- "Local" -------------------------------------------------------------------------------- local myRand = math.random  local myRound = math.round local widthscreen = 320 local heightscreen = 480 -------------------------------------------------------------------------------- -- "Grid" -------------------------------------------------------------------------------- local gridGame = {} local row = 9 local cell = 14 local rectx = 30 local recty = 30 local gridscaley = 0.35 local gridscalex = 0.35 local space = 2 local spaceleft =40 local spacetop = 20 local divx=widthscreen/(row\*2) local divy=heightscreen/(cell\*2)     for i = 1, cell do         gridGame[i] = {};         for k = 1, row do             gridGame[i][k] = display.newCircle(100,100, 30)             gridGame[i][k].yScale=0.35             gridGame[i][k].xScale=0.35             gridGame[i][k].alpha = 1             gridGame[i][k].x = (k - 1) \* (rectx + space) + spaceleft             gridGame[i][k].y = (i - 1) \* (recty + space) + spacetop             camera:add(gridGame[i][k], 2)     end end -------------------------------------------------------------------------------- -- "Character" -------------------------------------------------------------------------------- local character = display.newCircle( 160,400, 20) character.x=160 character.y=400 character.xScale=0.4 character.yScale=0.4 character:setFillColor(1,0,0) -------------------------------------------------------------------------------- -- "Event on Grid" -------------------------------------------------------------------------------- gridGame.touch = function ( self, event )         if event.phase == "began" then                  print("event.x",event.x, "event.y", event.y)         xend=myRound((row\*event.x)/(widthscreen-spaceleft))                  sp=(spacetop\*0.5)+spacetop         yend=myRound((cell\*event.y)/(heightscreen-sp)) -------------------------------------------------------------------------------- -- "Move" --------------------------------------------------------------------------------                                 local function move()                                         transition.to(character, { time=50, x=xend, y=yend})                                                                                       end                                                                      move() end end Runtime:addEventListener( "touch", gridGame ) camera:add(character, 1) camera.damping = 10 -- A bit more fluid tracking camera:setFocus(character) -- Set the focus to the player camera:track() -- Begin auto-tracking  -------------------------------------------------------------------------------- -- "End"------------------------------------------------------------------------- ---------------------------------------------------------------------------------    

You should really check out the different tile engines that already exist for Corona. Both Million Tile Engine and Dusk handle most of what you’ve been asking about, without needing to re-invent the wheel.

hi Alex@PaNc,

Thanks

What library you recommend me the most ?

is there yet another library that I must know ? except :

You should really check out the different tile engines that already exist for Corona. Both Million Tile Engine and Dusk handle most of what you’ve been asking about, without needing to re-invent the wheel.

hi Alex@PaNc,

Thanks

What library you recommend me the most ?

is there yet another library that I must know ? except :