I've got a problem with a keypress
event. I have a function that returns true
or false
on a keypress
like this: (simplified a bit)
onkeydown (keycode == 88) xKey = true;
onkeyup (keycode == 88) xKey = false;
if (xKey == true && bombs > 0)
{
this.bomb;
bomb -= 1;
}
Now, when you press the key, it decrements the variable to long, minimal 2 counts which doesn't add to the gameplay of course, I'm not using jQuery which has an unbind attribute and I don't want to add jQuery either, what's the old-school way? I cant find any relevant information on this but I guess I'm not the first to encounter this problem.