Need a bit of help with Load/Save

TouchTiltGamesTouchTiltGames Member Posts: 1,162
edited November -1 in Working with GS (Mac)
Banging my head over this one!

I've got 3 Worlds with 10 levels in each. The player can play any level but must play all 10 in order to unlock World 2, World 3.

I've got the Load/Save attribute setup properly so that each level is checked off if you beat it. But I can't seem to get the 2nd and 3rd World to unlock properly. Sometimes it works and sometimes it doesn't...I think I'm missing something. Here's what I have:

WORLD 1 LEVEL 1 (hidden actor on level screen)

game.level1 to 1 (to check the level was beat and place a graphic over the completed level in the menu)
game.world1 to game.world1 +1

Save: game.level1 key: level1ok
Save: game.world1 key: world1ok

WORLD SELECT SCREEN

WORLD 2 (button)

if game.world1 = 10
change scene - levelselect 2

Load key: world1ok - Attribute game.world1

---------
That's it really. Another question is where must one place the load and save attributes to work properly? I read that the load must be placed on the very first screen? I did try that and the above still didnt work for unlocking the other Worlds.

Appreciate the help.

Comments

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Do you have something stopping game.world1 from going beyond 10. or something keeping level 1 from continually adding 1 every time it is played, or level2 etc. try playing level 1 10 times and see if it unlocks world 2. you could also use the display text behavior and have it display what that attribute is set at so you can see what its doing when its not working.
  • TouchTiltGamesTouchTiltGames Member Posts: 1,162
    Hey Tenrdrmer

    Nah I don't have anything stopping it yet or nothing from keeping it from continually adding...could that be why sometimes it works?

    When using display text, do you just throw that in with the load attribute?
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    If your set to only unlock when game.world1=10 once it goes over it will be locked again. you'll want to setup a rule for each level that checks if the level has been completed already something like
    For level 1
    if game.world1 is less than 1
    game.world1+1

    That way playing level 1 over and over doesn't unlock what you want to be locked and then when they get to level 10 it wont add any more to game.world1 so world 2 should stay unlocked.
    Then if you want to be safe set world 2 to be unlocked as long as game.world1 is greater than 10

    You should just be able to put display text in your invisible actor and then click on the little e and select the attribute your wanting. I've never used it for that but it has an expression builder and i have seen others use it for that purpose.
  • TouchTiltGamesTouchTiltGames Member Posts: 1,162
    Yeah but if you STOP the preview from playing and start it up again in GS, doesn't that reset everything? Or does it still save until you quite GS and reopen it....
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Yeah It should. but either way your gonna run into problems when you build it. Have you tested at all on the phone?
  • TouchTiltGamesTouchTiltGames Member Posts: 1,162
    Oh yeah ive been testing this a lot on my ipad...it will sometimes unlock the worlds and sometimes not...and when it does unlock a world it IS remembering that state when I restart the game on the ipad.

    I had it working before where I tested it so as to beat two levels in World 1, it would unlock World 2, then I'd go play more or navigate to other screens and then the World would be locked again. :p

    So this could be because of what you described above....

    Perhaps I don't have the load attribute in the right place? I have it on the World Select Screen, which isn't the first screen you see when you start the game and isn't the first screen you see if you change levels from the level you are on...Could that affect it?

    Frustrating cause this is it before I publish my first game :D
  • TouchTiltGamesTouchTiltGames Member Posts: 1,162
    I guess I would need:

    if game.world1 is less than 1
    game.world1+1

    in addition to:
    game.world1 to game.world1 +1 that lives in the other Rule?
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Shizane said:

    Perhaps I don't have the load attribute in the right place? I have it on the World Select Screen, which isn't the first screen you see when you start the game and isn't the first screen you see if you change levels from the level you are on...Could that affect it?

    Yeah that may be it. I believe you should only have to load attribute when the game opens from there as long as your keys and save attribute happen right it remember where its at. Then the key is what save that state for the next time you open the game. It may be confusing itself when you load attributes thought the game
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Also since you have a level attribute and a wold attibute your using i think you would need to set your rule for each level to check if the level have been beat using something like this.

    if game.level1=0
    then game.world1+1

    It's a little different then what i was thinking because you have all levels available in any order. They way i said the first time would be if you are unlocking levels as you go.
  • TouchTiltGamesTouchTiltGames Member Posts: 1,162

    It's a little different then what i was thinking because you have all levels available in any order. They way i said the first time would be if you are unlocking levels as you go.

    Heh it's close...when I use your:

    if game.level1=0
    then game.world1+1

    then it unlocks the world but doesn't place a check graphic over the level.

    If I use

    if game.level1=1
    then game.world1+1

    then it locks the world and keeps the check graphic lol.
  • TouchTiltGamesTouchTiltGames Member Posts: 1,162
    Has anyone out there who has setup something similar with their game with level/world unlocks, care to share how they did it?
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    I've level unlocks but not separate from worlds.
    How does game.level1 get changed to 1. I'm assuming you start each level at 0 then when its beat it changes to 1 when you do that you will also have to run a check at each level to make sure that doesn't go above 1

    I would say theres a combination of all of it you will need to implement.
    They will all have to be setup on the correct actors too.

    When the level is complete

    if game.level=0
    and game.world=0
    then game.level+1
    and game.world+1

    Bumps is setup with world that unlock as you go so it's definitely doable.
    It's just gonna take some tweaking. Also if any of your actor instances are unlocked throughout the game the rules wont update when you change the prototypes. That may also be a very tedious thing you need to check
  • TouchTiltGamesTouchTiltGames Member Posts: 1,162
    Tendrmer & TSB, Thank you guys a lot for your help. Tendrmer - Your idea was almost working but it just seemed a bit too much maybe? I dunno.

    Tshirtbooth - Your simplified method works and even doesn't allow the player to play a level 10 times in order to unlock World 2 so that's great. :) ONLY problem I'm having now is that when I unlock World 2 and start navigating around the different menu screens and go back to the World Select screen, World 2 is locked again :( So somehow it's forgetting that I unlocked it.
  • TouchTiltGamesTouchTiltGames Member Posts: 1,162
    Yeah I've got 'em in there..just trying to figure out where the best place is to put them.

    I've got the load for checking that a level is complete (and places a checkmark) on each level itself and the save for this on each level's instance actor.

    Just having troubles saving the World state. I've got the Load World on the first screen...but where to put the Save?

    I've got your constrain attribute on the World screen...I guess it doesnt matter where that goes...
  • TouchTiltGamesTouchTiltGames Member Posts: 1,162
    Oh! Another question (sorry) is does your:

    constrain game.world1total to game.level1+game.level2+game.level3+game.level4 and so on

    save if I use:
    game.World1 Key: game.World1ok
    and
    load: game.World1ok to game.World1

    ?
  • PurplePandaGamesPurplePandaGames Removed Posts: 11
    Tshirt booth can you answer my question about publishing?
  • TouchTiltGamesTouchTiltGames Member Posts: 1,162
    Yeah no I typed that out wrong here...just weird...not sure where to put the load and save attributes as sometimes when i navigate around the different screens, the lock/unlock for the World will sometimes work...
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Put save attribute in the same rule right after you change the attribute. Then put all of your load attributes just on the load screen with the keys matching your save attributes. This should work fine as long you don't have it set up to where you have multiple saved games at the same time.
  • TouchTiltGamesTouchTiltGames Member Posts: 1,162
    Thanks, Tenr I'll try that tonight!
  • TouchTiltGamesTouchTiltGames Member Posts: 1,162
    Wholly crap I finally got this after 7-8 hours of fiddling with load/saves. Thanks a ton you two!
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Not a problem, Although i Think it was Tshirtbooth who got your main problem fixed. LOL I'll accept on his behalf.

    Hey did you do the graphics for the game yourself?
    If so and you have any interest in helping me with a few graphics email me

    tenrdrmer(at)yahoo.com

    Ive done most of my graphics but a couple i just cant get to look good and cant seem to find anyone with even any ideas of what it needs.
Sign In or Register to comment.