-
-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Frogger-game #55
Frogger-game #55
Conversation
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.
@DaniaB24 well done!
A couple of improvements and we're done.
P.S. Please also remove comments.
document.getElementById('score').innerHTML = | ||
` | ||
<div> | ||
<p>Score:<span>${count}</span></p> | ||
</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.
The class shouldn't be aware of the specificity of the environment it operates in.
The game engine doesn't offer an appropriate method to us. Let's define a global function for this and pretend it is a part of the game engine.
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.
thanks for review! I already fix)
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.
@DaniaB24 well done.
Check the comment below re "magic numbers" and take this a learning for similar cases you may deal with.
enemy1 = new Enemy(-100, 60, 100, player), | ||
enemy2 = new Enemy(-100, 143, 25, player), | ||
enemy3 = new Enemy(-100, 228, 77, player), |
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.
Always add some semantics to "magic numbers". I guess, all -100
and 100
can be effetively replaced with -CELL_WIDTH
and CELL_WIDTH
. Remaining numbers remain mysterious. As a peer developer I would love to understand the logic behind them to be able to add more enemies easily wuthout trying to decipher the logic behind calculations.
frogger-game
Demo |
Code base