-
Notifications
You must be signed in to change notification settings - Fork 50
Updated Readme #29
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
base: master
Are you sure you want to change the base?
Updated Readme #29
Conversation
| let gameCounter = 0 | ||
| let gameStatus = "playing" | ||
|
|
||
| class Character { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What could be the drawbacks of big-sized Class including many methods?
|
|
||
| //appends to game board | ||
| addChar() { | ||
| let $char = $("<div>") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any problem if I change the line as const $char?
| } | ||
|
|
||
| if (this.type === "player") { | ||
| $body.on("keydown", e => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I suggest moving those eventListners to the outside of Class method moveChar(), where you want to put that?
| if (this.type === "player") { | ||
| //mouse targeting | ||
| shootSoundPlayer.play() | ||
| $gameBoard.on("mousemove", e => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this event listener is moved to the outside, what is the benefit?
| if (pause === false) { | ||
| return | ||
| } | ||
| for (key in enemyList) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check for-in vs for-of
| const shootSoundPlayer = new Audio("./assets/audio/shootSoundPlayer.wav") | ||
| const $startGame = $(".startGame") | ||
| let level = 1 | ||
| let enemyList = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the difference of let and const?
| @@ -1,0 +1,990 @@ | |||
| const $gameBoard = $(".gameBoard") | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will be the difference if you wrap the entire code with $(function() { ... }) ?
| } | ||
|
|
||
| spawnEnemy() | ||
| for (key in enemyList) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may try another iteration like .forEach().
| } | ||
|
|
||
| //60 fps | ||
| requestAnimationFrame(update) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any approach that makes your game loop looks slim?
|
Project Workflow: 4 / 5 GlowStrong mindset on difficult logic, ability to make the logic works. GrowYou may use more classes with slim methods. Things to look forTry functional method like |
No description provided.