You would need to have an attribute that records the scene a player is on, and a rule to save that attribute when the scene is entered. Then, you could have a button with an option to return to the last scene played when the game is relaunched.
Still working at this... How can I create a button with option to return to the last scene played when the game is relaunched?
I used "Change Scene", but there is no option for me to change to the last scene played before exiting. Only available options are previous scene and next scene...
gyroscopeI am here.Member, Sous Chef, PROPosts: 6,598
Hi ancch, you'll need a continue game button next to the new game button in your menu level. You'll have to decide if you want a Save button as part of the HUD on each level, or a save button on the menu level, and a return to menu button as part of the HUD, appearing on every level. Whichever is used, when Save is pressed, you need to use Save Attribute Behaviour to save the level as well as any other attributes that have changed.
Then in your continue game button, you use Load Attribute Behaviours, loading in all of the attributes saved at the last place in the game. Finally, Rules showing if attribute is Lev3, go to level 3, etc. This last bit you asked about only, but thought I'd give you more info in case you didn't know. Anyhow, hope it helps.
Taking advantage of the topic, when saved each attribute in a save key that worked. I tried to save several attributes in the same save key and has not worked. In my case the levels of the game.
gyroscopeI am here.Member, Sous Chef, PROPosts: 6,598
Hi Riffel, I think always use a different key for each and every Save Attribute.
To amend & clarify what I was trying to say above, I think you'll only need 1 Save Attribute for the level saved, called LevelSave for instance, any key you like. With the continue Button, Load LevelSave, and if it's 1 then go to level 1, if it's 2, then to level 2, etc. Before any of these, load in any other changed atributes as well.
Aside from making unlocked levels you can put a game attribute interger and call it something like current level continue. Start at 0 or 1 then at each level add 1 to the game attribute and save. Then at level screen aside from unlocked levels have a continue button and a load behavior so that when level 15 or 18 or whatever load scene whatever. Anyway I guess I saying the same thing everybody else is saying
It should be something like this. You first need to create a global attribute named SCENE. It needs to be an integer.
Each scene should have one actor with the rule:
Change attribute SCENE to 47 (or whatever the scene number is). Save attribute SCENE
You really don't need a button for the save part, just add it to the change rule, but make sure it comes after the change scene number attribute.
This will make sure you game is always saving the latest scene.
Now when someone relaunches the game, you could have a button actor that will take a player to the last scene played. It's will need a rule for each level, but you can copy and paste and then just change the number. It should look sort of like this:
If attribute SCENE is 1 Change scene to 1(or the whatever you have named your scene 1)
If attribute SCENE is 2 Change scene to 2(or the whatever you have named your scene 2)
Also, Saving and Loading of Attributes only works on the device itself. And only in a published App - either a Development Build or a Distribution Build.
It will not work in the GameSalad Preview or in the GS Viewer.
gyroscopeI am here.Member, Sous Chef, PROPosts: 6,598
Thanks for the info, QS. Excellent; sounds....excellent! Really, sounds very straightforward.
Right, I'd better get back to the neighbours' barbeque; only came back to feed and water the dog; then inevitably fell asleep for an hour and a half...no more burgers for me, then...
Comments
_______________
Nesen Probe http://itunes.apple.com/us/app/nesen-probe/id377766693?mt=8
Tickle Stones http://itunes.apple.com/us/app/tickle-stones/id363484260?mt=8
Food Fight! (free) http://itunes.apple.com/us/app/food-fight/id352646643?mt=8
I used "Change Scene", but there is no option for me to change to the last scene played before exiting. Only available options are previous scene and next scene...
Then in your continue game button, you use Load Attribute Behaviours, loading in all of the attributes saved at the last place in the game. Finally, Rules showing if attribute is Lev3, go to level 3, etc.
This last bit you asked about only, but thought I'd give you more info in case you didn't know. Anyhow, hope it helps.
:-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
www.marcosriffel.com
To amend & clarify what I was trying to say above, I think you'll only need 1 Save Attribute for the level saved, called LevelSave for instance, any key you like. With the continue Button, Load LevelSave, and if it's 1 then go to level 1, if it's 2, then to level 2, etc. Before any of these, load in any other changed atributes as well.
:-)
Edit: written much of what design219 said....
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
www.marcosriffel.com
Anyway I guess I saying the same thing everybody else is saying
It should be something like this. You first need to create a global attribute named SCENE. It needs to be an integer.
Each scene should have one actor with the rule:
Change attribute SCENE to 47 (or whatever the scene number is).
Save attribute SCENE
You really don't need a button for the save part, just add it to the change rule, but make sure it comes after the change scene number attribute.
This will make sure you game is always saving the latest scene.
Now when someone relaunches the game, you could have a button actor that will take a player to the last scene played. It's will need a rule for each level, but you can copy and paste and then just change the number. It should look sort of like this:
If attribute SCENE is 1
Change scene to 1(or the whatever you have named your scene 1)
If attribute SCENE is 2
Change scene to 2(or the whatever you have named your scene 2)
And on to 50.
There might be a simpler way, but this will work.
Best of luck!
_______________
Nesen Probe http://itunes.apple.com/us/app/nesen-probe/id377766693?mt=8
Tickle Stones http://itunes.apple.com/us/app/tickle-stones/id363484260?mt=8
Food Fight! (free) http://itunes.apple.com/us/app/food-fight/id352646643?mt=8
Actually maybe more of a shortcut to avoid having to put an instanced actor in every scene.
http://gamesalad.com/forums/topic.php?id=6824#post
http://gamesalad.com/forums/topic.php?id=6824#post
It will not work in the GameSalad Preview or in the GS Viewer.
Test your game on the GS Viewer - play it, shut it down etc.
Then go back into the GS Viewer, click 'recent games' - play the game you just tested.
Your attributes will work just fine.
Cheers,
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
That GS Viewer keeps getting cooler!
Thanks QS!
I have various iterations of my games - so
Project K 1-1
Project K 1-2
etc etc
as I add new features, I save as a different version.
Therefore, any save data is lost as you've effectively made a new game with each version.
Now, one way to keep checking the save variable changes across all versions would be to save out a copy of your game as a test.
So, I'm on Project K 2-3. I test it, get a certain way through, and it saves the data,
I then make Project K 2-4, and the save data is gone from 2-3.
So, save as Project K TEST - and you should retain all the save data from previous versions as you're always testing that version.
Make sense?
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
You just press the icon on your iPhone, and 'iPhone' graphic appears next to the big green arrow in GameSalad.
You just click that to send to your iPhone, and it's there in your hand.
Possibly one of the most wonderful things you'll ever see
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
Right, I'd better get back to the neighbours' barbeque; only came back to feed and water the dog; then inevitably fell asleep for an hour and a half...no more burgers for me, then...
:-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps