I have created a 2D camera system that works by using Corona’s built in animation API to move all of my game objects. The values that are animated are the x and y of each graphics object in a table. If you need a better understanding, this is the code:
[lua]function setCameraPos(x,y,time)
local dx = x - cameraX
local dy = y - cameraY
local distance = math.sqrt(dx^2 + dy^2)
cameraMoving = true
local function doneMoving() cameraMoving = false; end
for k,v in ipairs(gameGraphics) do
local depth = v.depth or 1
transition.to(v, {time=time or 500, x=dx*depth, y=dy*depth,
transition=time or easing.inOutQuad, delta=true,
onComplete=doneMoving()})
end
cameraX = x
cameraY = y
end[/lua]
However, while the x and y of the graphics objects are being animated, the physics movement is frozen (but is unfrozen when my animation stops).
Is there anything I can do so my animation can be combined with the physics movement?
EDIT:
Unlike what I previously thought, the physics movement is not frozen. It is just not being shown until after the animation, which then the objects jump to the actual physics position (the physics world is still stepping). [import]uid: 7581 topic_id: 6282 reply_id: 306282[/import]