IntelliJ Java IDE
The moose likes Game Development and the fly likes checking for a double tap Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Game Development
Reply Bookmark "checking for a double tap" Watch "checking for a double tap" New topic
Author

checking for a double tap

Micah Pezdirtz
Greenhorn

Joined: Aug 14, 2006
Posts: 25
i wanted you guys' opinion of the best way to check for a double tap of an arrow key, because the way i have it now works, but only so. ive got a billion variables and im checking all sorts of conditions and its being a real pain but basically im checking for two taps in a row, and if the taps were less that x milliseconds apart, then call changeToRunning(). just wondering if this is the only way to go and i just have to bear with it or if theres a better way.
thanks guys!
Micah Pezdirtz
Greenhorn

Joined: Aug 14, 2006
Posts: 25
hey never mind guys, it suddenly hit me as i drank some mango juice (the fruit of the gods!!!) i found a way that works flawless and has easily understandable code. just had to set up a few booleans to check the state of what the current action is and what the last action was, and also a long for the last time that it was walking so is right is pressed and the last time of walking was say, 1/4 of a second ago, it should change to running.
 
 
subject: checking for a double tap
 
Threads others viewed
Is there an easy way to make UIs?
Suggestions for a Trip to Ireland
Confusion with using JSP expressions
Parachutes
golf problem !
MyEclipse, The Clear Choice