Data Realms Fan Forums http://45.55.195.193/ |
|
Double Tapping a button http://45.55.195.193/viewtopic.php?f=73&t=27658 |
Page 1 of 1 |
Author: | Asklar [ Sun Dec 18, 2011 6:16 am ] |
Post subject: | Double Tapping a button |
Is there some command like UInputMan:KeyPressedTwice() or something like it to make something activate when I press a button twice, or do I have to mess around with more timers and extra ifs? |
Author: | Coops [ Sun Dec 18, 2011 10:26 am ] |
Post subject: | Re: Double Tapping a button |
Unfortunately no, there isn't. But making a double tap check isn't hard either. The way I'd do it is with two timers, A primer for when the button is pressed, and one for the second press. Code: self.TimerA = Timer() self.Primer = Timer() if cont:IsState(Controller.BODY_CROUCH) then self.Primer:Reset() end if not(self.Primer:IsPastSimMS(100)) then if not(cont:IsState(Controller.BODY_CROUCH)) then self.TimerA:Reset() end end if not(self.TimerA:IsPastSimMS(100)) then if not(cont:IsState(Controller.BODY_CROUCH)) then self.DoubleTap = true end end |
Author: | Asklar [ Sun Dec 18, 2011 8:36 pm ] |
Post subject: | Re: Double Tapping a button |
Did you have to code it for me? Thanks! |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |