Closed xiaoli closed 11 years ago
The counting combos are kind of their own thing that is different from a sequence combo; they aren't able to mix. A counting combo requires that a key is held down the entire time (as on the demo page) , it's kind of a strange functionality that you probably don't need (I just wanted it for my game). What you want to do is very simple though:
var cheat_code_count = 0;
{
"keys" : "up up down down left right left right b a enter",
"is_exclusive" : true,
"is_counting" : true,
"is_sequence" : true,
"is_ordered" : true,
"on_keydown" : function(e) {
cheat_code_count += 1
switch (cheat_code_count) {
case 1:
console.log('Want 30 lives? Please try again :)');
break;
case 2:
console.log('No luck still. One more time? :D');
break;
case 3:
default:
console.log('Tried 3 times already.');
break;
}
return false;
}
}
It's very easy to track that count yourself. The counting combos are for a very specific case which would be very complex for someone to track without the help of the library.
Thanks for the kind words though, and good luck with your project!
oh, i see. thanks for that.
Great work once again.
code below:
I can't get the count of the combo. Am I missing something here?
Thanks for the great work of this library, save me a lot of time :)