Is there any way I could track the player's keyboard inputs (specifically, those of the arrows, B, A, and Enter) to put a Konami Code easter egg in my game? I want it to do the following.
- Track the keyboard inputs of the player while they are in the game window and follow the sequence of keys pressed
- If the player presses "up, up, down, down, left, right, left, right, B, A, Enter" in that order, display a picture, show text reading "The Code" earned! and set variable $code to 1
- If the player presses anything other than the next key in the sequence (for example, up, up, down, down, G) reset the sequence so they have to start over
I'm assuming I'll have to use Javascript for this, because I don't see any Harlowe commands that make use of the keyboard. I'm not sure if this will be possible, seeing as how the only way to input text in Harlowe that I have found requires a lengthy and complicated block of code split into two parts. Any help with this would be greatly appreciated!
Comments
I am 100% sure that input screens don't exist in Harlowe.
Yeah they do. I use them all the time in my games.
EpicMario99 seems to be referring to a native input method which is backed by an input element, not a prompt() analogue, which is what (prompt:) happens to be.
I suppose it's also possible that they simply didn't realize what (prompt:) does.
Uhhh... Sure, why not?
https://www.viget.com/articles/breaking-the-konami-code-adding-an-easter-egg-to-your-site
https://www.simoahava.com/gtm-tips/add-konami-code-to-your-site/
Alright, the problem here seems to be that I don't know crap about Javascript. Even with the in-depth explanations on the pages, I have no idea what any of those scripts do. I think my only hope for this would be for someone to just make the script for me so I can copy/paste it into my story, but I don't think that's happening. Oh well.
Thanks for the help anyway, everybody!