Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

js game solution #1013

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

js game solution #1013

wants to merge 2 commits into from

Conversation

galenwood
Copy link

Copy link

@volodymyr-soltys97 volodymyr-soltys97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job 👍
Add a favicon on the page
image

Comment on lines 80 to 92
case 'ArrowUp':
e.preventDefault();
game.moveUp();
break;
case 'ArrowRight':
e.preventDefault();
game.moveRight();
break;
case 'ArrowDown':
e.preventDefault();
game.moveDown();
break;
case 'ArrowLeft':

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a variables for event key words and use it here

Copy link

@etojeDenys etojeDenys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good job in general

document.addEventListener('keydown', (e) => {
switch (e.key) {
case KEY_UP:
e.preventDefault();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can write it only one time before the switch/case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants