Zaine,
If I may add, when a user presses a key with no restrictions on the command which is searching for the press, one keypress will turn into many per press, instead of one. To clarify, let's say that a user presses and holds the spacebar down for aproximately one second. Upon each runthrough of the code that the computer makes, which given a syncronization rate of 60 times/sec may be 60 times per second, the code that is within the IF statement for the keypress command, is executed. Therefore, creating unbearable uncontrolability, with the underlying code being executed at each syncronization point that the key is down.
There must be a way to control this, efficiently. Through many experimentations, I have come to what I believe is the most effiecient way to do this. The key is to switch a boolean variable to "true" the moment the key is pressed, and to not switch it back to "false" until the moment the key is let off of.
REM << note the 'norepeat' variable, its state intitally at 0
if spacekey() = 1 and norepeat = 0
REM << this is the boolean variable
norepeat = 1
REM << code needed to be executed once per "true" keypress goes here
endif
REM << create a seperate if then statement to swith 'norepeat' back to its initial state
if norepeat = 1 and spacekey() = 0 then norepeat = 0
+NanoBrain+