[Resolved] Detecting "Dragging" through an object

How would I go about detecting when the player “drags” their finger through an object? Similar to Fruit Ninja, however after looking at the sample code I am unsure where they actually determine that the touch event was dragged through the object. I am very new to Corona so if someone could point me in the right direction that would be great!

PS: Im not trying to get the exact effect of Fruit Ninja, just the effect of the players finger touching an object while dragging…

Thanks in advanced! [import]uid: 141138 topic_id: 25798 reply_id: 325798[/import]

A touch event would fire when the person moved their touch over the object - you could listen for it in the event.moved phase to be more accurate.

You could also be checking how far the user had dragged but if the above is sufficient for your game it would be very simple :slight_smile:

Peach [import]uid: 52491 topic_id: 25798 reply_id: 104392[/import]

Hi Peach,

Thanks for your reply, and that is rather simple =P

However, after implementing this I noticed one thing… In my game objects move around and you have to touch them without lifting their finger in order to complete certain tasks…

Now the problem arises when the player has touched the screen and has their finger just sitting on the screen and an object moves under their finger…since the player is not moving
their finger when this happens the phase.moved does not fire and nothing happens… [import]uid: 141138 topic_id: 25798 reply_id: 104538[/import]

If you want something to happen you can avoid using if statements referring to phases - if you don’t want anything to happen in the scenario just use if event.phase == “moved”. :slight_smile: [import]uid: 52491 topic_id: 25798 reply_id: 104597[/import]

Awesome thank you so much peach for your time! I think my day job is making my brain slide away, this should have been obvious to me ><

Please feel free to mark this as resolved if you wish and thanks again for your time! [import]uid: 141138 topic_id: 25798 reply_id: 104660[/import]

No worries at all; marked as resolved.

It’s easy to miss stuff like this, don’t beat yourself it up - happens to all of us sometimes :slight_smile:

Peach [import]uid: 52491 topic_id: 25798 reply_id: 104819[/import]