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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT: Adds capability to save game state and load it #50

Merged
merged 3 commits into from
Oct 2, 2024

Conversation

gdsouza1992
Copy link
Contributor

@gdsouza1992 gdsouza1992 commented Oct 2, 2024

Issue #33

  1. Create a in memory state and also helper functions to access the localstorage state.
  2. Create a Proxy of the player state so that every time player props are updated the proxy setter is invoked and that inturn calls the save state.
  3. Maintain state props separately on player object for better visibility
  4. clearSavedGame function exposed to reset the saved data.

save

Testing instructions:
With player complete all prerequisites to go out of level one but dont go out, instead refresh the page.
App should load with saved state and then you should be able to go out without doing anything else.

Future work / improvements

  • clearSavedGame can be a feature in in itself to have ui component to restart the game from the beginning.
  • autosave indicator when saving is in progress.
  • saving can be made async

Copy link

🙏 Thanks for your pull request @gdsouza1992, The team will now review and merge this request. In the mean time why not check out some of the other opensource projects available, contributions are greatly appreciated!

Some of the most popular are


PR Statistics

#️⃣ PR Number: Line Additions: 🗑️ Line Deletions:
50 72 17
📑 Files Changed: Repo Stars: 🔱 Total Forks:
6 10 26

1 similar comment
Copy link

🙏 Thanks for your pull request @gdsouza1992, The team will now review and merge this request. In the mean time why not check out some of the other opensource projects available, contributions are greatly appreciated!

Some of the most popular are


PR Statistics

#️⃣ PR Number: Line Additions: 🗑️ Line Deletions:
50 72 17
📑 Files Changed: Repo Stars: 🔱 Total Forks:
6 10 26

Copy link

🥳 Congratulations 🎉

Congrats on making your first Pull Request in the Zero To Mastery Organization!
You have been sent an invitation to join the ZTM github organization, please check your emails for further details!

ZTM Profile Badge

If you'd like the ZTM Badge to show up on your profile, you will need to follow this guide!

Copy link

🙏 Thanks for your pull request @gdsouza1992, The team will now review and merge this request. In the mean time why not check out some of the other opensource projects available, contributions are greatly appreciated!

Some of the most popular are


PR Statistics

#️⃣ PR Number: Line Additions: 🗑️ Line Deletions:
50 72 17
📑 Files Changed: Repo Stars: 🔱 Total Forks:
6 10 26

3 similar comments
Copy link

🙏 Thanks for your pull request @gdsouza1992, The team will now review and merge this request. In the mean time why not check out some of the other opensource projects available, contributions are greatly appreciated!

Some of the most popular are


PR Statistics

#️⃣ PR Number: Line Additions: 🗑️ Line Deletions:
50 72 17
📑 Files Changed: Repo Stars: 🔱 Total Forks:
6 10 26

Copy link

🙏 Thanks for your pull request @gdsouza1992, The team will now review and merge this request. In the mean time why not check out some of the other opensource projects available, contributions are greatly appreciated!

Some of the most popular are


PR Statistics

#️⃣ PR Number: Line Additions: 🗑️ Line Deletions:
50 72 17
📑 Files Changed: Repo Stars: 🔱 Total Forks:
6 10 26

Copy link

🙏 Thanks for your pull request @gdsouza1992, The team will now review and merge this request. In the mean time why not check out some of the other opensource projects available, contributions are greatly appreciated!

Some of the most popular are


PR Statistics

#️⃣ PR Number: Line Additions: 🗑️ Line Deletions:
50 72 17
📑 Files Changed: Repo Stars: 🔱 Total Forks:
6 10 26

@r4pt0s
Copy link
Collaborator

r4pt0s commented Oct 2, 2024

@gdsouza1992: I love it. Good job.
Would you be so kind and update your PR to the latest version of the main branch?
Also, could you run npm run prettier:fix to fix the code style before pushing the changes?

Copy link

⚠️ MERGE CONFLICT DETECTED!

@gdsouza1992 A possible conflict has been detected, you will need to resolve this before your pull request can be merged. The most common reason conflicts occur, is when the contributor does not run git pull origin master before pushing their new changes.

Before we can merge the code, you will need to resolve the conflict, check out these videos by Aldo: How To Get Started With Open Source and How To Resolve Git Merge Conflicts. If you get stuck ask over on Discord.

1 similar comment
Copy link

⚠️ MERGE CONFLICT DETECTED!

@gdsouza1992 A possible conflict has been detected, you will need to resolve this before your pull request can be merged. The most common reason conflicts occur, is when the contributor does not run git pull origin master before pushing their new changes.

Before we can merge the code, you will need to resolve the conflict, check out these videos by Aldo: How To Get Started With Open Source and How To Resolve Git Merge Conflicts. If you get stuck ask over on Discord.

Copy link

⚠️ MERGE CONFLICT DETECTED!

@gdsouza1992 A possible conflict has been detected, you will need to resolve this before your pull request can be merged. The most common reason conflicts occur, is when the contributor does not run git pull origin master before pushing their new changes.

Before we can merge the code, you will need to resolve the conflict, check out these videos by Aldo: How To Get Started With Open Source and How To Resolve Git Merge Conflicts. If you get stuck ask over on Discord.

Copy link

🙏 Thanks for your pull request @gdsouza1992, The team will now review and merge this request. In the mean time why not check out some of the other opensource projects available, contributions are greatly appreciated!

Some of the most popular are


PR Statistics

#️⃣ PR Number: Line Additions: 🗑️ Line Deletions:
50 75 17
📑 Files Changed: Repo Stars: 🔱 Total Forks:
6 10 31

1 similar comment
Copy link

🙏 Thanks for your pull request @gdsouza1992, The team will now review and merge this request. In the mean time why not check out some of the other opensource projects available, contributions are greatly appreciated!

Some of the most popular are


PR Statistics

#️⃣ PR Number: Line Additions: 🗑️ Line Deletions:
50 75 17
📑 Files Changed: Repo Stars: 🔱 Total Forks:
6 10 31

@r4pt0s
Copy link
Collaborator

r4pt0s commented Oct 2, 2024

Thank you @gdsouza1992.
Merge it now🚀

Copy link

🙏 Thanks for your pull request @gdsouza1992, The team will now review and merge this request. In the mean time why not check out some of the other opensource projects available, contributions are greatly appreciated!

Some of the most popular are


PR Statistics

#️⃣ PR Number: Line Additions: 🗑️ Line Deletions:
50 75 17
📑 Files Changed: Repo Stars: 🔱 Total Forks:
6 10 31

@r4pt0s r4pt0s merged commit 663c824 into zero-to-mastery:main Oct 2, 2024
1 check passed
@r4pt0s r4pt0s linked an issue Oct 2, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Player props only work after page refresh
2 participants