Quote:
Originally Posted by cbkbud
For guns you would want something like this:
PHP Code:
function onTimeOut()
{
temp.k = keydown2( getKeyCode( "s" ), true );
if ( temp.k )
{
if ( ! this.isKeyPressed )
{
// the key is not being held down; has been pressed once.
}
else
{
// the key is being held down; not just pressed once.
}
}
this.isKeyPressed = temp.k;
setTimer( 0.05 );
}
Just an example.
|
I'm kinda new to gs2, why would you use a temp variable for that?