i have a control button left,right,up,down
and i want when i press any of these button to move an object from a point to point from that direction . but i want in the same time to prvenet any input to other direction till i reach that point
i am using this code
local function leftArrowMove(event) motionx = -speed end -- When right arrow is touched, move character right local function rightArrowMove(event) motionx = speed end local function upArrowMove(event) motiony = -speedy end -- When right arrow is touched, move character right local function downArrowMove(event) motiony = speedy end RightArrow:addEventListener("touch",rightArrowMove) leftArrow:addEventListener("touch",leftArrowMove) upArrow:addEventListener("touch",upArrowMove) downArrow:addEventListener("touch",downArrowMove) local function moveOrange5 (event) Orange5.x = Orange5.x + motionx Orange5.y = Orange5.y + motiony end Runtime:addEventListener("enterFrame", moveOrange5)
speed and speedy and motionx and y already defined .
now example .
i want to move the object from point .x1 to .x2 and if the user press any other key ( right,up,down ) while the object move it will not effect its direction till it reaches .x2