playMaker

Author Topic: Help With Storing Level Values  (Read 2372 times)

Kinger61

  • Playmaker Newbie
  • *
  • Posts: 5
Help With Storing Level Values
« on: October 30, 2013, 08:32:42 AM »
Im having some problems with playmaker to get it to do what I want and not sure how to go about doing it !

Im making a comic. The way it is set up is that each page is created in a seperate scene! I have a main menu and have a button called "Continue"! I want to be able to store the scene that was last viewed and store it so that when a user clicks the continue button it will put them directly into the scene they last viewed and continue as normal instead of having to start all over again!

Any suggestions and help would be really appreciated! Thanks in advance :)
« Last Edit: October 30, 2013, 08:35:49 AM by Kinger61 »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Help With Storing Level Values
« Reply #1 on: October 30, 2013, 08:39:17 AM »
Hi,

 simply use PlayerPrefs. It stores anything you want and will persists even if the user quits the game.

 Also, you can use a global variable if you only need this during playtime and not when the user starts the game.

bye,

 Jean

Kinger61

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Help With Storing Level Values
« Reply #2 on: October 30, 2013, 09:01:53 AM »
I have used the 'playerprefs set int' at the start of the pages but is it best to name each scene with a different key? or is it better to use the one key and just delete the set 'int' on the previous scene ?

and when you click on the button what playerpref would you use to actually get the int value and go about loading that scene, because the load level option means you have to specify which scene to load but it to load the last viewed scene ?!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Help With Storing Level Values
« Reply #3 on: October 31, 2013, 03:52:58 AM »
Hi,

 if you want to know the last leve, then you should maintain only one key with that level id.

if you want to know where the user left on a given level, then you should have a key per level expressing where the use left, so you can track all levels and know where the user stands in each levels.

bye,

 Jean

Kinger61

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Help With Storing Level Values
« Reply #4 on: October 31, 2013, 06:59:02 AM »
see once you use the 'playerprefs get int' to determine which scene you want to load, what do you use to load the level ? because none of the load options searches for the 'key' you have entered ?

thanks :) !?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Help With Storing Level Values
« Reply #5 on: October 31, 2013, 07:16:17 AM »
Hi,

 I think you are getting mixed up with terms and what playerprefs are.

-- to load a level, you use the action "load level Num"
-- to know the level to load, you use the action "Player Prefs Get Int"

you are responsible to decide the playerPref key for the level num, let's assume you choose "Last Level"

so when your use reaches the end of a level and move to next level, you use the action "Player Prefs Set In", and use "Last Level" as the key and the int represent the level num.

Then, you have your logic in place, to retrieve the last level loaded and load it if necessary.

you should study one of the sample provided with ArrayMaker, it's a check point system very much like what you want to achieve in terme of logic.

http://hutonggames.com/playmakerforum/index.php?topic=3546.msg16317#msg16317

bye,

 Jean