Need help with saving attribute.

riverbat1riverbat1 Member Posts: 11
edited July 2012 in Miscellaneous
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

  • riverbat1riverbat1 Member Posts: 11
    Yup. Thanks!
  • riverbat1riverbat1 Member Posts: 11
    Dang it, sorry, but what do I put in the attribute?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    It sounds like you're wanting to save the scene # or name. Because the Change Scene behavior has a drop-down menu instead of an expression field, you can't simply plug in an attribute with the scene name, but you can use a rule so that When game.currentScene="Level 1" --> Change Scene [Level 1]. You'd need to save the current scene name during gameplay.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • ericzingelerericzingeler Member Posts: 334
    Well, now that editing tables is possible, I would suggest using tables to store data.

    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).
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    @eezing, his [/her] initial comment is that he watched videos about scoring but is needing help with saving/loading the current scene itself.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • riverbat1riverbat1 Member Posts: 11
    Yeah, Tatiang is right, I need help saving/loading the scene itself. I will re-read your first comment, but yes, i need to know if I need to make a new attribute or not. I will try and do what you said your first comment. Because if I get this down I will have smooth sailing and hopefully be able to publish it when i'm finished with it. :) Thanks!
  • riverbat1riverbat1 Member Posts: 11
    And yes i'm planning on just having whoever is playing to save the scene they are on.
  • ericzingelerericzingeler Member Posts: 334
    Oh ok, sorry... I read that wrong. You would have to create and save a Game attribute that stores a value corresponding to that scene.

    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...
  • riverbat1riverbat1 Member Posts: 11
    Oh ok, sorry... I read that wrong. You would have to create and save a Game attribute that stores a value corresponding to that scene.

    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...
    Hmm... This will take me a while to try and figure out, but thanks this will probably help me later on.
Sign In or Register to comment.