Need help with saving attribute.
riverbat1
Member Posts: 11
I've watched videos on how to save the score and stuff like that. But, lets say I quit on a certain scene ( no my game doesn't have levels ) is there a way I can save the screen so you can come back to that scene instead of restarting the whole game?
Answers
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
but, if you must know...
The attribute would be where your score is stored during gameplay (lets give it a name "score"). Its best practice to save your score often so incase the game crashes or the device runs out of battery, the players recent points won't get lost.
Do something like this when points need to be added:
1. Change Attribute Score to Score+[points to add] (add points to the current score)
2. Save Attribute Score to [Key Name] (Now save the score. A key name like "SavedScore" will do)
---------
On Scene Load:
1. Load Attribute [Key Name] to Score (Throw this behavior in one actor in the scene outside of a rule so it fires on scene load).
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Inside your rule to launch the scene would be something like:
1. Load Attribute [SavedScene]
2. Change attribute [StartSavedScene] = 1
3. If [StartSavedScene] = 1
Here's the sucky part, you have to insert a rule for each scene. No way to dynamically load a scene.
3a. If [SavedScene] = 1, load Scene 1
3b. If [SavedScene] = 2, load Scene 2
and so on...