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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thursday July 30, 2015 #1

Closed
wants to merge 32 commits into from
Closed

Thursday July 30, 2015 #1

wants to merge 32 commits into from

Conversation

cbotwell
Copy link
Owner

馃搨 Starting Project

currentEnemy = game.enemy;
turn = game.turnNumber;

newBattle();
Copy link

Choose a reason for hiding this comment

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

The point of having a game object is so that it stores and manages your hero, enemy, turn number, etc.

Try to pass your game as an argument to the newBattle function and this will clear up the currentHero, currentEnemy variables everywhere.

game.turnNumber++;
});

if (game.turnNumber % 2 === 1) {
Copy link

Choose a reason for hiding this comment

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

Line 57 through 68 will only run once when newBattle if run, if you want the turn stuff to run each time the player clicks on attack, my advise would be to put this inside of the on('click' that starts on line 48.

@cbotwell cbotwell closed this Nov 30, 2022
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.

None yet

2 participants