Hey guys, i just started today with Corona, i was used to work with Lua+Löve and wanted to take the jump on Android so i decided to use Corona.
I’ve had tons of problems as u would imagine beeing a newbie, but i found the answers for most of them, except this one, im trying to make a guy move in 4 directions when pressing and holding the side of the screen.
The thing is, when is “swipe” to the middle (outside the button) and release (i understand that’s a cancellation) it will keep moving, if i release the button on the button region it will stop perfectly, but if i swipe outside the area it will keep going until i come and tap again on the button.
It seems like cancelled is doing nothing, also i tried to “limit” the area to make it stop when the event.x(or y) is outside the event.target.x(or y) and it doesnt seem to work either.
Here’s a little piece of code for the Right side of the screen:
local function buttonR(event) if event.phase == "began" then buttonR = true elseif event.phase == "ended" or event.phase == "cancelled" then --if event.x\<event.target.x then print("OUTSIDE") end if event.phase == "cancelled" then print("CANCELLED") end if event.phase == "ended" then print("ENDED") end buttonR = false end return true end
The prints are my controls on the console, the ENDED prints perfectly, but so far i got 0 CANCELLED prints, am i doing something wrong?
I have no problem on posting the full code or the main.lua or .zip for you guys to try, i would like some tips to make it work, also i prefer the cancelled working than the region limitation, since cutting the movement as soon as u leave the region seems bad, instead allowing u to move it until u release (end or cancel) seems better.
Thanks for your help and excuse my english.
Happy coding
Edit: added the code into <code>