Skip to content

Commit

Permalink
Merge pull request #187 from candirugame/feat-keyboard-buttons-aim-an…
Browse files Browse the repository at this point in the history
…d-shoot

feat: keyboard controls for shooting and aiming
  • Loading branch information
AustinJMann authored Nov 29, 2024
2 parents 380df0a + ce793b3 commit 82204ed
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/input/InputHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,23 @@ export class InputHandler {
if(event.key === 'Tab' || event.key === "'"|| event.key === '/') event.preventDefault();
const key = event.key.toLowerCase();
this.keys[key] = true;

if (key === 'c') {
this.leftMouseDown = true;
} else if (key === 'z') {
this.rightMouseDown = true;
}
}

private onKeyUp(event: KeyboardEvent) {
const key = event.key.toLowerCase();
this.keys[key] = false;

if (key === 'c') {
this.leftMouseDown = false;
} else if (key === 'z') {
this.rightMouseDown = false;
}
}

private onMouseDown(event: MouseEvent) {
Expand Down

0 comments on commit 82204ed

Please sign in to comment.