forked from Chasmiccoder/acm-rpg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
99b289e
commit cb1ec4b
Showing
17 changed files
with
2,941 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.vs/ | ||
.vscode/ | ||
.vscode/ | ||
todo.txt |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// the way the game works is that if you press a button, to do the same thing, you need to | ||
// lift your finger and press again. | ||
// makes sense in the context of text messages. If you get a text message and press enter, | ||
// and then release enter, then it will resume the original state. | ||
|
||
class KeyPressListener { | ||
constructor(keyCode, callback) { | ||
let keySafe = true; // true if a key is not pressed. | ||
|
||
this.keydownFunction = function(event) { | ||
if(event.code === keyCode) { | ||
if(keySafe) { | ||
keySafe = false; | ||
callback(); | ||
} | ||
} | ||
}; | ||
|
||
this.keyupFunction = function(event) { | ||
if(event.code === keyCode) { | ||
keySafe = true; | ||
} | ||
}; | ||
|
||
// binding the event listeners | ||
document.addEventListener("keydown", this.keydownFunction); | ||
document.addEventListener("keyup", this.keyupFunction); | ||
} | ||
|
||
// unbind the event listeners | ||
unbind() { | ||
document.removeEventListener("keydown", this.keydownFunction); | ||
document.removeEventListener("keyup", this.keyupFunction); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.