playasophy / wonderdome

Codebase for the Playasophy Wonderdome project
The Unlicense
10 stars 1 forks source link

Konami code is finnicky #17

Open greglook opened 10 years ago

greglook commented 10 years ago

See this output of the button press events and the value of matched-prefix-len:

:button/press :up
1
:button/press :up
2
:button/press :up
:button/press :up
1
:button/press :down
:button/press :up
1
:button/press :up
2

Basically, the first 'wrong' button doesn't count as the first matched button, even if it's the correct one ('up' in this case). Probably the right approach here is to add a generic handler middleware which keeps a buffer of the last n button presses, which further control-code middlewares could use to match against the codes they're configured with.