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

Fixed issue#1: cannot restart game #3

Merged
merged 1 commit into from Dec 2, 2018

Conversation

Projects
None yet
2 participants
@coreyjjames
Copy link
Contributor

coreyjjames commented Dec 2, 2018

This pull request fixes issue #1.

In index.js:
For the restart to work, I found I needed to maintain the same instance of the world obj. When a reset happens I call the constructor on world to reset the game, then I call main again and I pass in the current world obj as a secondary parameter to main. In main I check if world is already defined, if it is I don't create a new world.

In world.js:
For the restart to work i needed to reset 2 variables
I was able to get the game to restart by resting the following variables on restart.

this.gameover = false;
this.gameStarted = false;

Note: This pull request also contains changes to babel. I needed these changes in order to get the async and await functions to work. I wasn't able to start the game without them.

@mklan mklan merged commit 0270138 into mklan:master Dec 2, 2018

@mklan

This comment has been minimized.

Copy link
Owner

mklan commented Dec 2, 2018

thank you for your pull request! may I ask how you came across this project?

@coreyjjames

This comment has been minimized.

Copy link
Contributor Author

coreyjjames commented Dec 2, 2018

I am a student taking an open source class. As part of a project I need to send Pull requests to open source projects. I found your project well I was searching for issues to work on.

I haven’t done to much game programming and I liked the look of your game, so it looked like something new and fun to work on. It was a great learning experience for me, it’s cool working on a game!

@mklan

This comment has been minimized.

Copy link
Owner

mklan commented Dec 2, 2018

Nice, I am glad you could learn something from my project. Keep up the good work and if you still need to contribute for your class, I have created a new issue :). The score is somehow not updating anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment