How can i make it so that you cant hold down a key and the action keep going over and over?
Kind of like the sword swing.
You hit 'S' and you swing ur sword, but if you hold it down nothing happens. And you release it and hit it again, and it swings again.
I need this so that i can make something scroll differently, i have tried many ways and here is one of them:
PHP Code:
//Check for Keydown
if (keydown(0)) {
if (this.keyd==0 && this.fruit<=5) {
this.keyd = 1;
this.fruit++
}
}else{this.keyd = 0;}
if (keydown(2)) {
if (this.keyd==0 && this.fruit>=0) {
this.keyd = 1;
this.fruit--;
}
}else{this.keyd = 0;}