I tried to make camera move in vertical direction by referencing ghost&monster code.
But I am confused about how to use transition.to API. I read the document but still do not understand well.
my transtion.to API does not call onComplete event.
How can I make the camera to move(smoothly) when player moved to some specific distance?
[lua]local physics = require(“physics”);
local player = require(“player”).new();
local camera = display.newGroup();
camera:insert(player);
physics.addBody(player,{density = 0.1, friction = 0.1, bounce = 0.1});
local times = 0;
function update()
if(player.y > -320*times)then
times = times +1;
transition.to(camera, { time=1000, y = -320*times, onComplete=listener1 } );
end
end
local listener1 = function( obj )
print( "Transition 1 completed on object: " … tostring( obj ) )
end
Runtime:addEventListener(“enterFrame”,update);[/lua] [import]uid: 65906 topic_id: 16415 reply_id: 316415[/import]
