Difference between revisions of "IsKeyPressed2"

Jump to navigation Jump to search
448 bytes added ,  16:33, 14 May 2009
another key-trapping code example
imported>Haama
(→‎Notes: Tapped keys)
imported>Tekuromoto
(another key-trapping code example)
 
Line 23: Line 23:
   ; do stuff
   ; do stuff
   set curKey to <keyCode>
   set curKey to <keyCode>
endif</pre>
* The following works without using a Return, in case you need code below your keypress block to continue executing on subsequent frames even if the key is still down:
<pre>short MyKey
short KeyDown
if (IsKeyPressed3 MyKey) && (Keydown == 0) ; first frame with key pressed
set Keydown to 1
;
; do stuff, once per keypress...
;
elseif (IsKeyPressed3 MyKey == 0) && Keydown ; wait til key released then toggle flag
set Keydown to 0
endif</pre>
endif</pre>


Anonymous user

Navigation menu