I want to dash by holding 1 of the 4 movement buttons (Left, Right, Up, Down) and then double-tapping the screen to activate the mechanic. Using the code in the picture, its does work, however, I’m also able to dash by double-tapping the movement button. (Ex: If I want to dash left, I should hold left while double-tapping the screen, however, I can also just double-tap the left button to do this) Is there a way to remove that? Thanks in advance!
So this is like a multi-touch situation?
I don’t think the actions and conditions you are using are granular enough to detect what you what.
You’ll probably have to enhance the “double click” extension to not count clicks that are touching your controls… so create a group called “CantBeDoubleClicked” add all your relevant objects to that, and modify the extension to ignore click using the “Point inside object” with Mouse(X,Y) condition.
It’s an interesting problem to solve for multi-touch
Hi, I understand the gist of what you have said, but I’m not experienced in coding to actually apply it to my project. Can you be a little more detailed in the instructions. Thanks in advance!
The closer I look at this problem the more I think you will need to redo the extension. The extension for double click is pretty mouse oriented, and your problem is very multi-touch centric. You’ll have to write a more complicated version using “A touch has ended” and checking if that touch id is inside of the objects you don’t want to consider using “TouchX(…)” and “TouchY(…)”
This is not a trivial problem… OR I just don’t have enough multi-touch experience to give you a better answer.
No need to worry about that, I was able to fix that problem by replacing all the mouse-related conditions (Ex: Mouse Button pressed) with touch conditions (Ex: A new touch has started) and it works like a charm on mobile. The only problem for me now is how to ignore the double-taps from the movement controls as you stated previously.
I believe you can fix that by toggling a variable when the touch is held.
- if touch is not held on ControlButtons, variable = 0
- if variable = 1 + dash trigger, dash actions
- if touch is held on ControlButtons, variable = 1
That way, a one-frame hold is needed. You can also use a timer to customize the hold duration.
On a side note, using a custom behavior should allow you to target one button versus the other buttons of the same ControlButtons group, and avoid a big copy-pasta mess.