Spawn actor based on number of button presses and time?
RondoRocket
Member Posts: 411
Does anyone know if it's possible to spawn an actor based on how quickly and number of times a button is pressed? For example: If 3 quick taps of a button result in failure but 3 slow taps of the button result in success.
Thanks for any help.
Thanks for any help.
Twitter:rondorocket
Web: rondorocket.com
Comments
Make an attribute "interval1"
Make an attribute "interval2"
Make an attribute "interval3"
Make an attribute "times.tapped"
Make an attribute "sum1"
Make an attribute "sum2"
Make an attribute "sum3"
Make an actor;
Every 1 second change att. "timer" to "timer +1"
Button actor:
When touch is pressed
change att. "times.tapped" to 1
change att. "interval1" to "timer"
When touch is pressed
if "times.tapped = 1" change att. "interval2" to "timer"
change att. "times.tapped" to 2
When touch is pressed
if "times.tapped = 2" change att. "interval3" to "timer"
change att. "sum1" to
"interval3 - interval2"
change att. "sum2" to
"interval2 - interval1"
change att. "sum3" to
"sum1+ sum2"
Now according to what you want it will be something like this:
if attr. "sum3" < "2" (2 means he pressed 3 times with 1second intervals etc.") spawn actor "fail"
I'm sure there is an easier way of doing this but that is how I would do this :D
Twitter:rondorocket
Web: rondorocket.com