Multitouch input

I have searched for a way to implement double click / touch but have not found anything. What is the best way to implement this? :confused:

Object variable with increment on each tap/click, i think it’s the best way.

The object is clicked => +1 to var “click_counter”

When clic counter is >= 2 then do something

It could be nice to prevent multiple click/tap when the player is holding, maybe using chronos or timedelta() between the two increment of your var.

We must take into account that a double click is not just make two clicks (over an object?), but make two clicks within a short time without clicking other objects between. If this is the behavior you want, read this:
Instead a variable for the number of clicks you need one with the time since the last click. For example a variable “ClickTime”, make it positive when you make a click (the time you have to make another click as double click) and always decrease it, finally when you make a click check if the variable is positive, if so, you made a double click :slight_smile:

[code]Conditions: Mouse button Left is pressed
Cursor is over Button
Trigger once
Actions: Do = 0 to variable “JustClick” //A helper variable to run just one of the two sub-events
Conditions: Variable “TimeClick” of Button is <= 0
Actions: Actions for first click here…
Do = 0.3 to variable “TimeClick” of Button //You have 0.3 seconds to make another click
Do = 1 to variable “JustClick” //Now the next sub-event will not run

                Conditions: Variable "TimeClick" of Button is > 0
                            Variable "JustClick" = 0
                Actions: Actions for double click here...
                         Do = 0 to variable "TimeClick of Button

Conditions: No conditions
Actions: Do -TimeDelta() to variable “TimeClick” of Button[/code]
An action to reset the time of every Button when any other is clicked can be easily achieved, and a lot of improvements can be made.
I can upload a GD events image, or even make an example if you need it (read a lot of events in plain text can be tedious) :smiley:

The “Trigger once” condition was made for this :wink:

Thanks for the help, I’ll have a go and let you know where I end up :slight_smile: