Thread: Finding Killer
View Single Post
  #9  
Old 09-16-2009, 05:16 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by Gambet View Post
Don't check if the player presses the 's' key, use the keydown() value just in case the player alters their default control configuration (via the F3 menu).


Also, what I said a few posts above still holds merit. Send a triggerAction() when the player swings their sword and have whoever they hit catch the action and work from there.
I would rather use onKeyPressed and compare the keyname with the keyname(#) function, then running a constant timeout checking for keydown(#).

Good:
PHP Code:
function onKeyPressed(keynamekeycode)
{
  
// keyname(6) checks if the Grab button is pressed, default A on Qwerty.
  
if (keyname == keyname(6).lower()) {
    
// stuff
  
}


Bad:
PHP Code:
function onCreated()
  
setTimer(.05);

function 
onTimeOut()
{
  
// keydown(6) checks if the Grab button is pressed, default A on Qwerty.
  
if (keydown(6)) {
    
// stuff
  
}
  
setTimer(.05);

__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote