How do I make a coin carry on to a map level selector

  • Hi. So this is a long term plan for my game but I want to be able to carry currency over the game, not just for each level/layouts. I ll try to explain what I need and hopefully someone can point me out the direction.

    I will take one of my favourite games to explain this. Spyro the Dragon from PSX.

    You collect gems on each level, and each level has different amount 100, 200, 400.. so you will see how many you have left in each level 80/100 lv1| 66/200 lv2 and so on. The gems carry over with you all game long, so you end up with over 10.000 gems and you use them to be able to travel worlds.

    So basically I want to storage the total gems picked up and carry them all over the game layouts and track how manu do I have left in each layout to be indicated in a menu layout.

    Does this sound possible? Thanks

  • Shouldn't a global variable to store the amount do the job?

  • Shouldn't a global variable to store the amount do the job?

    Yeah that's my thought but is not that simple. I figured a global variable will storage it, problem is how to set it up and how can you track each level...

  • I guess that you can use a data dictonary to store each level's amount and use local storage to save/load this value when changing layout.

    Take a look at this: https://www.scirra.com/manual/188/local-storage

  • I think you can connect it the way that your HUD displays to show it in-game or just make a separate layout with the information of gems. I think you can read it out with text (change looks later if wanted) and connect it to your global variable but for each level I think you need different variable.

    I hope i helped with it.

  • If i understand correctly, you can use 2 arrays: one for amount on char, other for amount on the map. Each map/layout would be an index on your arrays. On your first array, the total variables is the total on your char.

  • That sounds something hard to do. Could anyone provide a tutorial or example capx around?

  • Bump. Hoping someone could help me out

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • use a global variable, and never reset the global variables to default. also you can look into local storage for coins/valuables that should stack when you leave game. look for that in tutorial section.

  • I guess I will try to investigate further. Thanks

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