How do I improve mouse click reponsiveness?

0 favourites
  • 5 posts
From the Asset Store
Click! Click! 136 click sounds for your video games or media projects
  • 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.

  • 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..

  • 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).

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)