playMaker

Author Topic: New Game, Load Game  (Read 2560 times)

Prototype_6492

  • Junior Playmaker
  • **
  • Posts: 50
New Game, Load Game
« on: May 25, 2015, 03:05:01 AM »
Hi there,

If once our data is saved. We restart the game, and click load game, what would we use to load the game? And if they want to start a new game, how do we clear playerprefs, to start a neW game?

This might have simple answers, but I'm confused. Haha.

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: New Game, Load Game
« Reply #1 on: May 25, 2015, 08:26:46 AM »
You can use "Load Level" to load the game- to clear the Player prefs you have a few options- use the "delete all" or "delete key" actions in the player prefs section to delete them or you could use set actions to set them to 0 or whatever you want-
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

Prototype_6492

  • Junior Playmaker
  • **
  • Posts: 50
Re: New Game, Load Game
« Reply #2 on: May 25, 2015, 10:34:37 AM »
Now how about for load the last save?
« Last Edit: May 25, 2015, 10:43:37 AM by Prototype_6492 »

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: New Game, Load Game
« Reply #3 on: May 25, 2015, 06:34:36 PM »
That depends on how you are doing your "save" and what you are saving- If lets say you want to load the last level/checkpoint a player got to- just use an int player pref for that- then every time the game launches it checks that int to see what level the game should start at and starts from there-

So if they get to checkpoint 2- set the int to 2- then when they start the game again it checks that int and takes them to level 2- thats a simple example
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

Prototype_6492

  • Junior Playmaker
  • **
  • Posts: 50
Re: New Game, Load Game
« Reply #4 on: May 25, 2015, 10:37:59 PM »
Now what if I want it to save, from where they last hit save or something. And load up their health and items and all that?

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: New Game, Load Game
« Reply #5 on: May 25, 2015, 11:55:14 PM »
When they hit save- you save the variables to player prefs for health, items etc

So lets say their health is a float called "health" when they hit save- you use Set player prefs float and set it using the "health" variable
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!