How do I differentiate between drag and click?

Just started using Construct 2? Post your questions here

Post » Sun Jul 09, 2017 12:51 pm

Hello there, tnx for your atention
I have an object with Drag&Drop behavior, when I begin to Drag him it makes a sound, and when I Drop him it makes another sound;
When I double-click him he rotates and make a third sound;
Problem is, when I double-click the object c2 thinks I am starting to drag him, and the sounds get in the way and go together.

How do I differentiate between drag and double-click the object, so I can double-click him without c2 thinks that I am draging?
Tiny little problem that I can't figure out
Thank you in advance
B
28
S
14
G
6
Posts: 86
Reputation: 5,479

Post » Sun Jul 09, 2017 7:05 pm

I would suggest starting a timer when the event On Drag & Drop start triggers, with a short duration of your preference. (Call it 'delay' if you want)

Only trigger the Drag sound when the timer finishes.
Stop the timer when a double-click has been triggered.
This will avoid triggering the drag & drop event when there was a double-click X seconds after the On Drag & Drop start event has been triggered. (replace X by your delay)

Might sound confusing, here is an example .capx that I made for you.
Hope this helps.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Mon Jul 10, 2017 11:48 am

@randomly you got it! Very clever approach, did help xD
Thank you very much, be blessed /\
B
28
S
14
G
6
Posts: 86
Reputation: 5,479


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest