How Can I Save Player Progression (collectable Don't Appear Again)

Discussion in 'How Can I...?' started by Bllaaa, Sep 3, 2018.

  1. Bllaaa

    Bllaaa Boxer

    Joined:
    Jul 26, 2018
    Messages:
    68
    Likes Received:
    9
    Hi Boxers, need your help. ^^
    In my game, when the player dies, I would like to save his progress by passing checkpoints. When he passes one, his progress is saved. So all the collectables he has collected are also saved and don't reappear when he restart (after a death for example).

    Currently, I use "Set checkpoint" to do this. But it only saves his new start position.

    I Hope someone has the solution.^^
    Thanks for the help
     
  2. Tars Tarkas

    Tars Tarkas Avid Boxer

    Joined:
    Jul 17, 2018
    Messages:
    253
    Likes Received:
    186
    I dont fully understand what you are trying to do.
    After you press restart you want the character to continue from the last checkpoint he reached?
    If that is hat you want. you have to make an action with set checkpoint and place it in the scene. and another action set as restart checkpoint.(give it another name). then on the game over menu. the restart button set it to the action with the restart checkpoint.
    here is a video on youtube I found:
     
  3. Bllaaa

    Bllaaa Boxer

    Joined:
    Jul 26, 2018
    Messages:
    68
    Likes Received:
    9
    Thanks, @Tars Tarkas.

    I already used this method and it works. When my player dies he restarts from the checkpoint. But all the objects (gems, coins...) he has picked up before reaching the checkpoint aren't saved.
    What I would is all the objects collected by the player when he reaches the checkpoint are already collected when he restart from the checkpoint.

    For example. My player is a ship (O).
    1- He moves to the right and collects 2 coins (+).
    O >>---------+----+
    ----------------------------------|||-----------------------
    2- When he collects those coins, they disappear.
    ---------------------------O >>
    ----------------------------------|||-----------------------
    3- Next, he reaches a checkpoint (|||) and passes it.
    -----------------------------------O
    ----------------------------------|||-----------------------
    4- Then he falls in lava and dies.
    you lose
    ----------------------------------|||----°-------------------
    5- The game restart and the player appears on the checkpoint.
    -----------------------------------O
    ----------------------------------|||-----------------------
    6- The coins he has already collected are no longer there (-)
    -----------------------------------O
    ----------------------------------|||-----------------------
    0- When I use the method above, when the player restart from the checkpoint, the coins are already there
    -------------------+-----+------O
    ----------------------------------|||-----------------------
     
    Last edited: Sep 3, 2018
  4. Tars Tarkas

    Tars Tarkas Avid Boxer

    Joined:
    Jul 17, 2018
    Messages:
    253
    Likes Received:
    186
    so you want the gems that he collected not to appear in the scene when you restart?
    I don't think it's possible. sorry. maybe somebody else knows a way.
     
  5. Bllaaa

    Bllaaa Boxer

    Joined:
    Jul 26, 2018
    Messages:
    68
    Likes Received:
    9
    Damn :/
    I really hope, someone knows a way. I think others people will find it useful.
    Anyway thanks a lot for all your priceless help. :]
     
  6. Shashank Varshney

    Shashank Varshney Boxer

    Joined:
    Feb 22, 2020
    Messages:
    15
    Likes Received:
    2
    Ok so you are saying your collectibles are showing zero when u dies and replay from last checkpoint.
    If this is the case you can save those collectibles during checkpoint save.
    For example if u collect (n)keys and save it in global variable (Settings.keys) you can write code in checkpoint save node:

    checkpoint.keys = Settings.keys;




    And then in 2D/3D world add node
    checkpoint loader and in that you must write:

    Settings.keys = checkpoint.keys;

    That will save your keys during the game play ...
     
  7. Shashank Varshney

    Shashank Varshney Boxer

    Joined:
    Feb 22, 2020
    Messages:
    15
    Likes Received:
    2
    But i am also have a trouble here...
    If u want to save those keys forever (example: like when you quit your app and start it over again these keys should still be saved) likewise BestScore & GlobalCoins. i couldn't have any clue how to save those keys permanently so that they still got saved forever. With the above stated method we can save keys just for a single session of app... But in 2nd session the data will lost!
     

Share This Page