Need help with adding all collected stars together!

0 favourites
From the Asset Store
Kids Game
$49 USD
New Sounds Added Update: 115 new sound effects added for no additional cost!
  • 1. Make a global variable Totalstarscollected = 0.

    2. When Level 1 ends, add a system Event to add TotalStars variable's number to Totalstarscollected.

    3. When Level 2 starts, reset TotalStars variable.

    4. When Level 2 ends, add a system Event to add TotalStars variable's number to Totalstarscollected.

    5. When level 3 starts, reset TotalStars variable and so on.

    6. After all the levels are cleared, Player will be able to see how many stars were collected in total, by observing the Totalstarscollected variable.

    What if I want the player to be able to replay levels and get the same stars without adding stars that they already got?

  • The star status then must be stored via LocalStorage plug-in.

    https://www.scirra.com/tutorials/1461/h ... age-plugin

    The player won't need to play the levels played previously, nor need to collect all the stars again; even after closing the game and re-opening it later.

  • The star status then must be stored via LocalStorage plug-in.

    https://www.scirra.com/tutorials/1461/h ... age-plugin

    The player won't need to play the levels played previously, nor need to collect all the stars again; even after closing the game and re-opening it later.

    In my game, you play a level and get all the stars you find, then go to the goal. The level select shows you how many stars that you've gotten on each stage, so you know where you missed some. If I use localstorage, will I be able to make it so that any stars you get will be gotten, forever, even without using something like the persist behaviour?

  • Yes, because the Localstorage plugin will save data just the way how our usual save games are stored.

    However, if the data is saved locally, they'll disappear once user deletes cache. (I'm not sure if cache is the correct term, but locally saved game files always disappear whenever we go to web browser's privacy section to remove cache and other details.)

    That means the user will have to start from the beginning again, after the local files get wiped out.

    If the game is going to be an epic scale, I would recommend you to store the data remotely on a server, so users can access their saved data no matter what happens to their local save files.

    Setting up a remote save feature will need other things such as finding a good web hosting provider, setting up a database, handling configurations, etc.. though.

    And that's a.. completely different beast. <img src="{SMILIES_PATH}/icon_cry.gif" alt=":cry:" title="Crying or Very Sad">

    https://www.scirra.com/tutorials/4839/c ... sql/page-1

    local-storage-through-mobile-browser_t165787

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yes, because the Localstorage plugin will save data just the way how our usual save games are stored.

    However, if the data is saved locally, they'll disappear once user deletes cache. (I'm not sure if cache is the correct term, but locally saved game files always disappear whenever we go to web browser's privacy section to remove cache and other details.)

    That means the user will have to start from the beginning again, after the local files get wiped out.

    If the game is going to be an epic scale, I would recommend you to store the data remotely on a server, so users can access their saved data no matter what happens to their local save files.

    Setting up a remote save feature will need other things such as finding a good web hosting provider, setting up a database, handling configurations, etc.. though.

    And that's a.. completely different beast. <img src="{SMILIES_PATH}/icon_cry.gif" alt=":cry:" title="Crying or Very Sad">

    https://www.scirra.com/tutorials/4839/c ... sql/page-1

    local-storage-through-mobile-browser_t165787

    I think I've finally figured out what I need to do!

    Thanks, Gmoney! You've been a big help!!! I am eternally grateful! <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green"> <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green"> <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green">

  • You're always welcome, Aquanex2. Please continue to ask anything when you need an assistance. I'll be there.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)