Save game after closing app completely [click & point game]

Hello guys, I'm having problem with saving game. New game, load game(continue) works good. but if I close app completely (double press home button) and tried to continue game but load game button vanished and game starts again as a new game.
I don't have "save attribute" inside each actor, I mean I didn't put additional "save attribute" bellow the each (boolean, real, integer) attributes.

I have 4 actors which manages starting, saving, loading process, they are: New Game button, Load Game button, Save Game and Save Scene.

New Game button.
Actor receives event touch pressed!
change attribute: // only change attributes inside New Game button
game.inventory to 0
game.take_silverkey to false
game.open_door to false
etc......
// Game starts as a new.

Load Game button.
// will be visible and in action after the game started. I called it like: game_started (boolean attribute)

Attribute game.game_started is true, Actor receives touch pressed

Timer: After 0 seconds // run to completion is not clicked.
Load Attribute: //
key: 2 attribute game.inventory
key: 3 attribute game.take_silverkey
key: 4 attribute game.open_door
etc.....
// game will starts from that scene and collected items and everything loads (it's fine)

Save Game.
// I have this actor in each scene. and has only following attributes

Timer: Every 10 seconds // run to completion is clicked.
Save Attribute:
attribute game.inventory key: (expression has removed)
attribute game.take_silverkey key: (expression has removed)
etc....


Save Scene.
//I also have this actor in each scene and opened from that scene

Change Attribute: game.scene numbers to 1
game.scene numbers to 2
etc........// this is a integer attribute. and numbers

Comments

  • alarm656alarm656 Member Posts: 291
    First was New Game button screen
  • alarm656alarm656 Member Posts: 291
    Load game button
  • alarm656alarm656 Member Posts: 291
    Save Game
  • -Timo--Timo- Member Posts: 2,313
    edited November 2013
    I would recommend using tables. you only need to use the save table behavior and everything inside the tables is saved and loads automatically
    why are the keys inside the save attributes empty? :/
  • alarm656alarm656 Member Posts: 291
    Hi timolapre1998 thank you. but I don't know how to use tables on it. I have used tables for messages with text attribute.
  • alarm656alarm656 Member Posts: 291
    Just create a TB Table
  • -Timo--Timo- Member Posts: 2,313
    you can keep your attribute but just change your attributes to the tables. when an attribute is changed you also change the table value (change table value behavior) to the attribute. and save table. when opening the app you change the attributes to table value.
    save and load attributes should also work...
  • alarm656alarm656 Member Posts: 291
    I have created Save TB Table and inside TB add 95 boolean attributes. Putting them in expression in Save Game actor
  • -Timo--Timo- Member Posts: 2,313
    maybe this can help you ;)
  • alarm656alarm656 Member Posts: 291
    maybe this can help you ;)
    I think so but it seems I have to add "Save Attribute" behavior in each actor where attributes in action. Will try to follow by this tutorial, thank you so much
    :\">
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited November 2013
    You're either going to be really happy or really upset by what I have to tell you. That's not how you save table data. You use a single Save Table behavior and select the table name from the drop-down menu. Whether you have 4 table rows or 400, you still use just a single Save Table behavior. There is no need to load tables because this happens automatically each time the app is opened.

    The Save Attribute behavior existed before tables were added to GameSalad but it still has some use for saving individual attributes.
Sign In or Register to comment.