Load/Save Attributes Not working

GameLabs222GameLabs222 Member Posts: 197
edited February 2014 in Working with GS (Mac)
I have options set up in my air hockey game to enable the player to change the color of their paddles. I save the color change with the 'save attribute' function and turn all other colors to false and save those as well. While playing this works perfectly.

But if the match is over/you quit the match/or leave the app weird things start to happen. When the game loads the title actor loads all the save attributes, except it doesn't work. Sometimes when I exit the app and go back, all colors get switched to true, or none are true and they reset to the default colors.

My quit button resets the game, but as far as I'm aware that doesn't reset saved attributes. Nor do I have any other coding that could switch all colors to true unless you pressed the button for the specific color in the options menu which would then turn the other colors to false and save them. It seems like my save and load code is straightforward but it is doing everything it's not coded to do.

Comments

  • CodeMonsterCodeMonster ACT, AustraliaMember Posts: 1,078
    Ur doing something wrong,
    I have over 30 load and save attributes in my game and Load and saves work fine for me.
    Maybe this might help:

    1))So when the game is over and it changes scene, make sure your save attributes happen before you change scene otherwise this can cause problems.

    2))make sure your load and save attributes are the same! Capitals and everything. It's very easy to misplace a letter

    3))best to make a little intro scene before your menu scene
    In the intro scene is where you load your attributes.

    4))basically like option 1, make sure you save your attributes before anything els. The save attribute must sit above the change scene or whatevs.


    Basically what I'm trying to say is, gamesalad doesn't have errors like this, it's just how you code it.
  • colandercolander Member Posts: 1,610
    edited February 2014
    Try putting your Load attributes in an actor positioned of screen on their own with nothing else on the first scene/landing scene of the game. Make sure it is at the bottom of your Scene Layers in the Inspector, GS loads everything from the bottom up and you want to load your saved attributes (Load Attributes) first.
  • GameLabs222GameLabs222 Member Posts: 197
    I know its my fault, just can't tell where. Thanks for the tips , I'll see what happens.
  • GameLabs222GameLabs222 Member Posts: 197
    Thanks for the tips guys! Got it working.

    I also read that you're not suppose to use the expression editor and just type straight into the key field. I changed that and tweaked the timers.
  • slowcutslowcut Member, PRO Posts: 164
    @Brenton222
    I also read that you're not suppose to use the expression editor and just type straight into the key field.
    If you want to use the expression editor, you have to use quotes for your strings. You can decide which way you use, but make sure to stick to one method and don't mix them up. I always use the
    Expression editor for all my actions, not only for save and load.
Sign In or Register to comment.