hoe does save attribute work?
-Timo-
Member Posts: 2,313
hey
I have a shop in my game and I want it when you bought you have it for ever. I think I have to use save attribute but I dont know how it works.
can someone explain it for me? would really appreciate it
-Timo
I have a shop in my game and I want it when you bought you have it for ever. I think I have to use save attribute but I dont know how it works.
can someone explain it for me? would really appreciate it
-Timo
Best Answer
-
Braydon_SFX Posts: 9,273Hi there,
A save attribute will, and I know this is self explanatory, 'save' the current state of an attribute. For example, if I passed level 3 in a game, I'd make sure to save that information so that when player reboots the device, or closes the app in multitasking, it will remember which level that player was one before the app closed.
When you decide to use the save attribute behavior, make sure to play it BELOW the attribute that your changing. For example, if I was saving the high score, this is what it'd look like:
Rule:
if game.Score is greater then game.Highscore:
change attribute game.Highscore to game.Score.
save attribute: game.Highscore. Key: score
If you save an attribute before you change it, it will only load back as the value that you saved it as.
The key is like a password, kinda. :P
It's important to remember the key for a save attribute so that you can input that into the load attribute. The load attribute will load back that value that was saved. The key is like a bridge. So the key needs to be exactly the same as in the change attribute.
Hopefully this answers your question, let me know if you have any problems or any additional questions!My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Answers
✮ FREE templates at GSinvention ✮
✮ Available for hire! support@gsinvention.com ✮
✮ FREE templates at GSinvention ✮
✮ Available for hire! support@gsinvention.com ✮