How do I improve mouse click reponsiveness?

Get help using Construct 2

Post » Sun Aug 02, 2015 3:45 pm

I'm making a strategy RPG and UI/mouse is going to be a big part of my project. I need to be able to differentiate between a click, a click+drag, and a double-click. Unfortunately, starting the drag still counts as a click and any slight mouse movement during the click-release counts as a drag.

I tried using "on any click set mousestartx , mousestarty to mouse.absolutex,mouse.absolutey" on one event with another for "while dragging" + "if 30 <= distance(mousestart,mouseend)" to prevent clicks from starting the drag event but it seems this condition is only checked once and then ignored because it's not true when it started.

I can probably edit the javascript on publication to change the mouse-click to mouse-release. But I still need to prevent the drag behavior from firing too easily.
B
10
S
2
G
2
Posts: 73
Reputation: 1,044

Post » Sun Aug 02, 2015 4:02 pm

Would it perhaps be easier in this case to use the touch object and the "on tap" "on double tap" and "on hold" events?

another way would be to use the timer behaviour to check how long the mouse button is clicked and how long the time is between two clicks..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Aug 03, 2015 3:05 am

@Mylon Well, that turned out to be a lot harder than I thought it was going to be!

I was going to say just use On any Click, then Left button Released... but it turned out to be a lot more complicated to make the type of interface you want.

So, take a look at my capx: http://www.rieperts.com/games/forum/MouseClickTest.capx

It can tell the difference between clicking, double clicking, and click-and-drag for both the left and right mouse buttons. The scroll wheel zooms in and out to where the mouse is pointed. Having a zoom feature made it even harder to have the mouse click and drag work properly to select units...

A double click always registers as a single click first, then a double click (if the second click happens within the threshold time, and within the threshold distance of the first click). That is pretty universal how mouse events fire. If you really wanted a double click to not count as a single click first then you would always have to wait until the threshold passes before you could process a single click. So, factor the order of events into your UI design. (a single click should select a unit, a double click would then select the unit and allow a secondary action to happen).
B
99
S
35
G
20
Posts: 438
Reputation: 17,910

Post » Tue Aug 04, 2015 2:09 am

I think the touch object covers click/doubleclick just fine. I haven't had any success getting the "on dragging" condition to not trigger during a click with slight mouse movement so hopefully your project file provides good insight. But! You're using v210 and I only have v206.
B
10
S
2
G
2
Posts: 73
Reputation: 1,044

Post » Tue Aug 04, 2015 2:40 am

@Mylon someone just recently posted a tutorial for how to edit a capx, so an older version of C2 can open it.

https://www.scirra.com/tutorials/4778/make-your-construct-2-project-backward-compatible

as long as the project isn't using any new features, it should work fine.
B
99
S
35
G
20
Posts: 438
Reputation: 17,910


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests