playMaker

Author Topic: memory  (Read 1891 times)

Victor

  • Playmaker Newbie
  • *
  • Posts: 9
memory
« on: July 03, 2014, 01:01:14 AM »
Hello,

In my game there is a "levels" scene. In this scene there are 4 levels. I want this: The player when open the game at first time. other levels must be locked. just level one is unlocked.
After that the player when goes to level 02 than level 02 lock will be unlock. How can i do this in unity playmaker?
« Last Edit: July 03, 2014, 02:54:51 AM by Victor »

bizilux

  • Full Member
  • ***
  • Posts: 171
Re: memory
« Reply #1 on: July 03, 2014, 07:05:55 AM »
playerPrefs

either booleans (true, false) or strings (locked, unlocked) or integers (0,1)

im not 100% sure you can use booleans, but you can use other two im sure, and then you just do string compare for example.


Victor

  • Playmaker Newbie
  • *
  • Posts: 9
Re: memory
« Reply #2 on: July 03, 2014, 07:09:31 AM »
ok i'm going to choose string for that! than what should i do?

bizilux

  • Full Member
  • ***
  • Posts: 171
Re: memory
« Reply #3 on: July 03, 2014, 07:26:20 AM »
i suggest you go with playerPref Integer

its really simple.  you only need to have 1 playerPref int... lets say we name it "CurrentLevel"

you give it value 1 by default.

so when you load level selection scene, you have FSM there, that checks value of CurrentLevel.

for example:

if that value is 1, you unlock only first level.
if value is 2, you unlock first and second... and so on.

and when player completes level, you use set playerPref int, to the number of next level.  so if he completed level 2, you need to set that playerPref to value 3, so that when loading scene checks which level to unlock, it will see that value is 3, so it will unlock 1,2,3 levels.

with string it is similar concept, you just need to use string compare instead of intiger compare