Hi, I’m new to Corona SDK (trying out trial version), and starting work on a small game.
I want the user to be able to tap once on an image to make it rotate. That’s not a problem. What I am stuck on is getting two taps to rotate the image in the opposite direction without also triggering the single tap response. Right now two taps makes it rotate both ways, so it ends up back where it started.
(This way of rotating an object is the simplest interaction I could think of for rotation - similar to Bubble Ball but with the ability to rotate both ways. But I’m open to suggestions).
The issue is that two taps always *also* triggers the one-tap response. I tried adding a
“return true” (now commented out) after the first double tap conditional but a double tap still always re-triggers the single tap response – apparently a two-tap is broken into both a two-tap and one-tap events. So the whole if-then-elseif always runs twice for a double tap.
function myImage.tap(self, event)
if event.numTaps == 2 then
myImage:rotate( 5 )
– return true
elseif event.numTaps == 1 then
myImage:rotate( -5 )
end
end
myImage:addEventListener(“tap”, myImage)
Thanks,
Eric
[import]uid: 128346 topic_id: 23247 reply_id: 323247[/import]
