Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

checking for a double tap  RSS feed

 
Micah Pezdirtz
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!