do a final score

0 favourites
  • 12 posts
From the Asset Store
Alien Game
$59 USD
Set your thrusters to overdrive because we’re going to the final frontier, earthlings!
  • I have a game that is based off of the platform tutorial so it has a global gem value. that gets added to. So, within my game the player collects points doing various things (collecting gems, killing enemies). The game itself is a math game so I have various levels (Addition, subtraction, etc.) and I wanted levels within each math concept. Now, how do I make a final score within each math concept of the gems collects throughout those levels?

    Sorry if this is confusing! Let me know if you need any clarification!

    Thanks in advance!!

  • Hey, I'd put your total collected gems into an array and save/load your values using the Local Storage object. Each section (addition, subtraction etc.) can have it's own x location in your array (assuming you don't want to store multiple values for each section, in which case you could use a 3 dimensional array).

    When you want to display the values, you just set (or append) your text to the x (or x/y) location containing the value you saved.

    I hope this is helpful, but if I've misunderstood please let me know.

  • Thank you!!! And forgive me, i'm not quite sure how that all works.

    so for example I have "Global number GEM=0" at the top of the event sheet. Then, for example, I have player on collision with gem<system add 1 to gem. I also have on collision with bat and platform is falling<system add 2 to gem. So, all are going to one gem value. I'm newer to this so thank you for your time!!!!

  • Thank you!!! And forgive me, i'm not quite sure how that all works.

    so for example I have "Global number GEM=0" at the top of the event sheet. Then, for example, I have player on collision with gem<system add 1 to gem. I also have on collision with bat and platform is falling<system add 2 to gem. So, all are going to one gem value. I'm newer to this so thank you for your time!!!!

    Oh it's really my pleasure. As for using arrays and local storage, I think tutorials would probably be more helpful in teaching you how they work than anything I could write.

    1) https://www.scirra.com/tutorials/307/ar ... -beginners

    ---- This one is great and has capx's included so you can see what's going on if you feel like you aren't getting the results you'd like.

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

    ----- This tut on Localstorage also has a capx included.

    Please let me know if you need more help after looking at these tutorials

  • Thank you that does help! So, for this case the math concept would be the x value and the gem number would be the y value? But since that number is changing and always different, how can I set that value?

  • Thank you that does help! So, for this case the math concept would be the x value and the gem number would be the y value? But since that number is changing and always different, how can I set that value?

    Good question! You would want to determine where your math concepts would be (e.g. array.at(0,0) = Multiplication, Array.at(1,0) = Division). There are ways to do this on the fly but for the sake of argument, we'll assume you have everything predetermined in terms of X location (with a Y value of 0). Then all you're doing is updating Y=1 at those X locations (e.g. set value array.at(0,1) to 20. This would mean you have 20 gems for multiplication). You can save and load this data between play sessions using the local storage object. I hope that helps!

  • Thank you for all your help! This is way more complicated than I thought It would be.... Is there no way to use the local storage to save the gem value they obtain (as it would always be different) and then ask it to pull up that value when the final score layout plays?

  • Thank you for all your help! This is way more complicated than I thought It would be.... Is there no way to use the local storage to save the gem value they obtain (as it would always be different) and then ask it to pull up that value when the final score layout plays?

    I'm a bit confused but I think I know what you mean.

    So if you aren't concerned with saving gem values between playthroughs (i.e. they are set to 0 each time you play) then you don't need local storage. The arrays are global so they will have persistent values between layouts. That means you don't need anything fancy to set text from the array.

    However, if you want to save your array values and have them return when you play again, you'll want to use the Local Storage object. Local Storage loads asynchronously, so loading from it on the start of the layout you're hoping to use it's data for isn't always going to get you the desired result. Instead what you'd probably want to do is have your Local Storage load values into your array when the game first starts, and save those values at the end of your levels (for example, I'm not sure when would be best to update variables in your project, specifically). That way the array is ready by the time you get playing and can be updated without touching the Local Storage object. The Local Storage would only be used to get the array primed for play.

  • Thank you so much for all your time! I am very new to this and the array is confusing. I watched a tutorial on youtube where they made the final score a pop-up layer, initially invisible, and then just copy and pasted the score text into that layer. I think I may do this and abandon the idea of total score for multiple levels. hopefully I can figure this out in the future as I play more with all of this!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you can also make a global variable and add all your results you want in 1 number string.(ie. Totalscore=(LEVEL1Value(gems+score+etc))+(LEVEL2Value(gems+score+etc))+(LEVEL3Value(gems+score+etc))+etc) However that is working if you already have ur level 1 figured out or saved in a similar matter.

  • Thanks gamecorpstudio,

    So if I add the global number and say "totalscore=0" then I add the instance variable "Total score"? now would the number string be with the event sheet?

    Thanks!!

  • Hi everyone!!!

    I was working on those arrays some more! I was trying to just recall the value from one level first. I went and added an array and then said on start of layout set value x=0 then the value is the global gem variable. I then said when the final score layout is on the screen to set score text to array.at(0). I thought this would work but the number didn't change.... any advice??? Your amazing for helping me this far!!

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