Do I understand attributes and keys right? - trying to make High Scores
Hunnenkoenig
Member Posts: 1,173
What I want to do is following:
- player plays level 1
- player gets score (already working with game attribute score)
- player finishes level
- player gets a table where he sees:
1. actual score
2. score for collected bonuses
3. score for remaining lives
4. sum of all the scores
When he goes to next level, his score is saved and the new level score starts from 0 again.
When the game is finished by losing all lives or finishing all levels, his actual high score is displayed (sum of all scores from all leveles).
Actual high Score is saved in the High Score table.
----
Now, my question: do I understand right that attributes are reseted by closing the game and keys are permanently saved?
Should I save scores and high scores as attributes or keys?
How do I sum keys? Should I load them as attributes and sum the attributes?
Should I make an own attribute/key for every level or just a general one?
Should I use attributes on the game level or on the scene level?
---
Those are a bunch of questions, but maybe someone can give me advice... I am not a programmer and even if I understand programming logic to a certain level, I am not sure, how I should design it to be the best solution....
- player plays level 1
- player gets score (already working with game attribute score)
- player finishes level
- player gets a table where he sees:
1. actual score
2. score for collected bonuses
3. score for remaining lives
4. sum of all the scores
When he goes to next level, his score is saved and the new level score starts from 0 again.
When the game is finished by losing all lives or finishing all levels, his actual high score is displayed (sum of all scores from all leveles).
Actual high Score is saved in the High Score table.
----
Now, my question: do I understand right that attributes are reseted by closing the game and keys are permanently saved?
Should I save scores and high scores as attributes or keys?
How do I sum keys? Should I load them as attributes and sum the attributes?
Should I make an own attribute/key for every level or just a general one?
Should I use attributes on the game level or on the scene level?
---
Those are a bunch of questions, but maybe someone can give me advice... I am not a programmer and even if I understand programming logic to a certain level, I am not sure, how I should design it to be the best solution....
Comments
Save Attribute
game.totalCoinsCollected to Key: TOTALCOINSCOLLECTED
Load Attribute
game.totalCoinsCollected from Key: TOTALCOINSCOLLECTED
Should I save scores and high scores as attributes or keys? KEYS (same as above)
How do I sum keys? Should I load them as attributes and sum the attributes? SUM THE ATTRIBUTES, THEN SAVE THE KEYS
Should I make an own attribute/key for every level or just a general one? Depends. Are all levels locked? If so, you only need a 'currentlevelUnlocked' attribute or something like that
Should I use attributes on the game level or on the scene level? -you can have both. Scene attributes have access to the camera whereas game attributes do not.
That helps a lot!
Let say, you made score 40 in LVL 1 and you go to the next level. Now in LVL 2 you start from 0 and make 60. Both together count as a High Score of 100. It's cool. I can save it and display it.
But how would I save the 10 highest high score?
I would want to make a ranking list with all time best scores.
It's ok to save a high score in a key, but how do I give this key a dynamic number or name?
Let say I want to make something like "if key X doesn't exist, save high score in key X" and "if key X is smaller than actual high score, overwrite it"