Quote:
Originally Posted by Gambet
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(keyname, keycode)
{
// 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);
}