Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Nice algorithm for keypresses

Author
Message
Delfir
20
Years of Service
User Offline
Joined: 28th Aug 2004
Location:
Posted: 12th Mar 2005 14:47
do you have a game where you press a button on the keyboard to buy something, but when you press it, it buys more than one of the item because you left your finger on the button too long. Well, try this algorithm.



It's fullproof, with this code, you don't have to worry about buying 5 of something you only want one of, or on a title screen, you don't have to worry about accidentally going all the way down to options when you meant to go to load game.

Legendary>Heroic>Normal>Easy
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 12th Mar 2005 21:28
Other than the out-of-place endif at the end, that is foolproof.


CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 12th Mar 2005 22:16
Here is a better one and excuse my english as its not my native


Also you can set as many statements as you want with following changes, anytime you press the keystate(46) the statement will increase

P Schnell
19
Years of Service
User Offline
Joined: 13th Feb 2005
Location:
Posted: 13th Mar 2005 07:40
Looks OK to me, though I wouldn't call it an algorithm, more of a lock and key.

Login to post a reply

Server time is: 2024-11-23 13:52:31
Your offset time is: 2024-11-23 13:52:31