How might I go about locking the screen from backwards movement? As everyone probably knows, I have a moveCamera function, but what i’d like to do is like in doodle jump when you go up, the screen doesn’t follow you back down. [import]uid: 147322 topic_id: 27867 reply_id: 327867[/import]
Resolved! Sorry, didn’t think before I posted. For anyone who needs it, here’s an idea:
local limit=256 --set to your character's x (or y), for this example, it is a sideways device
function limitSet() -- function to make a new limit
if me.x\>limit then -- 'me' is just your character
limit=me.x -- reset limit
end
end
Runtime:addEventListener("enterFrame", limitSet)
local function moveCamera()
if (me.x \> 512 ) and (me.x \>= limit) then -- only if character is not behind limit
scrollGroup.x = -me.x + 512
end
end
Runtime:addEventListener( "enterFrame", moveCamera )
binc [import]uid: 147322 topic_id: 27867 reply_id: 112799[/import]
Thanks for updating and including your solution, always a great thing to do as it tends to help others who encounter similar issues in the future
[import]uid: 52491 topic_id: 27867 reply_id: 112875[/import]