Saving and Loading problems

TWEAmazingAppsTWEAmazingApps Member Posts: 219
edited July 2012 in Working with GS (Mac)
Hello

I am having a problem with loading my integers. I have 3 scenes and they all have the same point system. When actor collides with a coin it give 15 points to game.overallscore So say I got 1200 points in my game.overallscore. I then when game.levelcomplete is true I will make a rule stateing If game.overallscore is >(greater than or equal to) game.levelonehighscore then change attribute to game.levelonehighscore to game.overallscore. So now game.levelonehighscore has 1200 . I do this too all my 3 scenes. so its game.levelonescore , game.leveltwohighscore and game.level3highscore. They all in each of their scene take from game.overallscore. (of course I reset overallscore in eachscene so they dont get double points) I have a menu and they have custom numbers (I got it from a tutorial of T-shirtbooth) And they all represent each levels highscore. Like for levelone the score being displayed is from game.levelonehighscore and all of that works. Every last code I made. BUT here is my problem. When I save the attribute. Levelonehighscore. and leveltwohighscore and so on in there own scene. It seems when I load them (I got the loading tutorial from T-shirtbooth) They integers are all messed up some dont load and some just copy from the other level and make it their score instead. So I have level one have 1200 score and then Leveltwo copys that and makes it 1200 also. I dont get it. In the level for level one two and three. At the end of each level I put this rule up. for example for level one. I have (rule) When game.Levelonecomplete is true then (rule) if game.overallscore is (greater or equal to ) game.levelonehighscore then (change attribute) game.levelonehighscore to game.overallscore(So now it equals the amount made in game.overallscore. Then I have a next level or a reset button. If they push next level it will save the attribute. so when touch is pressed save attribute game.levelonehighscore to (key) L1highscore.. Then when I go to load this bad boy (in the first scene. I load attribute and it dosent work. instead it goes all nuts on me (Note I am also loading the others too) When is following the same steps...if I only do level one then when I load it level one works but if I try to do two levels or three it mixes numbers up. Is this a game salad bug or am I doing somthing wrong here. Thank you please help.

Comments

  • developer6810developer6810 Member Posts: 139
    The reason this happens is because you're using the same attribute (game.overallscore) for each level. So, when you save it, the computer can only pick one number and use that for each level. Try making three different attributes, like game.levelonescore, game.leveltwoscore, etc.
  • J_PANJ_PAN Member Posts: 140
    @developer6810, totally agree with you
  • JoVeJoVe Member Posts: 224
    Such as developer6810 says you must make one attribute a level. You can use this rule but you must use a different attribute for each level.
  • TWEAmazingAppsTWEAmazingApps Member Posts: 219
    Ah ok thanks guys. I actually found a new way to doit. I just used a table instead and saved it with that. And it works out perfectly. (didnt want to go through all the switching attributes with the custom numbers and levels so I got a walk around) But that truly makes sense. Next time ill definitely use that.
Sign In or Register to comment.