-
Notifications
You must be signed in to change notification settings - Fork 0
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
Turning in 5.4 on August 1 #1
base: master
Are you sure you want to change the base?
Conversation
<body> | ||
|
||
<div class="game"> | ||
<div class="start"></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.
These start
, battle
, and end
divs will be destroyed if you do $('.game').html(someVar)
.
$('.game').html(AppTemplates.start(heroes)); | ||
|
||
$('.start-name').click(function() { | ||
$('.start').html(AppTemplates.battle()); |
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.
Don't change the HTML of the ".start" div. change all of the ".game"
@@ -0,0 +1,28 @@ | |||
function Hero(name, health, ability, imgUrl, spriteUrl) { |
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 don't make your spriteUrl
public in your constructor... :(
You'll need to add this.spriteUrl = spriteUrl
.
// A User should see a start screen | ||
$('.game').html(AppTemplates.start(heroes)); | ||
|
||
$('.start-name').click(function() { |
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.
Change this to $('.start-name').on('click', function() {
... The click
function doesn't quite behave the same way that you would expect and can become confusing.
game.on('change', function() { | ||
if (game.gameWin()) { | ||
$('.game').html(AppTemplates.win(game)); | ||
} else { |
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.
Should this be if (game.gameWin()) else if(game.gameLose()) else
?
Right now you will always get a battle template
No description provided.