"touch" and "tap" firing simultaneously?

Quick question:

Is it possible to have a tap register on a button at the same time that a finger is swiping (“touch”) on the screen? I have it set it so that the entire background is the “touch” area for dragging around a targeting reticle (the code is in my other thread for those so inclined) and I have a fire button as well.

Both work just fine on their own, but I find that I have to lift my finger off the screen (ending the “touch”) in order for the “tap” on the button to properly fire. I am using layers and the button is on a GUI layer above the background but it doesn’t seem to matter. Is there a way to mask the area of the background where the button sits so that these two actions can fire at the same time? Basically what I need to do is say something like "if the button is tapped, override the “touch”.

If not possible, no huge deal-breaker. The game works fine as-is, it’s just a bit annoying to have to lift the finger from aiming to fire the weapon.

Thanks guys! [import]uid: 36682 topic_id: 27726 reply_id: 327726[/import]

I’m not totally sure what you are trying to do so if my answer is a #fail be sure to let me know :wink:

Q; Is there a way to mask the area of the background where the button sits so that these two actions can fire at the same time? Basically what I need to do is say something like "if the button is tapped, override the “touch”.

A: You seem to be asking how to only do the tap AND how to do the tap and the touch. The default would be to do both, so add [lua]return true[/lua] to the end of the (tap) function if you only want the tap to fire.

As to being able to swipe and tap the button at the same time, do you have multitouch enabled?

Peach :slight_smile: [import]uid: 52491 topic_id: 27726 reply_id: 112502[/import]

Hi Peach,

Thanks for the reply and my apologies for not being clear in what I was asking. It’s a little tough to explain without the device in your hands, but imagine that you are holding the phone/tablet in landscape mode, using your right finger to drag the target around the screen and using your left thumb/finger to tap the fire button when the target is over the enemy.

I’ve tried both with multitouch enabled and disabled and I get two different (yet equally not-what-I’m-looking-for) results: With multitouch disabled, the “tap” on the fire button won’t fire at all unless the right “dragging” finger is lifted from the screen first. I assume this to be standard. With multitouch enabled, however, tapping the fire button immediates jerks the target over to where the tap just occured, so that’s no good either.

I haven’t used your return true statement so I think that might be the ticket. I’ll give it a shot and let you know.

Thanks once again! [import]uid: 36682 topic_id: 27726 reply_id: 112635[/import]

Ah I understand - enable multitouch and right before the [lua]end[/lua] of the tap function put [lua]return true[/lua]. I believe that should work as you want it to but indeed, please do let me know :slight_smile:

Peach [import]uid: 52491 topic_id: 27726 reply_id: 112739[/import]