playMaker

Author Topic: Level loading  (Read 8287 times)

Elizeusz

  • Playmaker Newbie
  • *
  • Posts: 32
Level loading
« on: July 22, 2012, 11:31:13 AM »
Hi. I have done one scene where i have my menu ( texture buttons ) each one is coresponding with one level. Every level is the other scene. Only one button in menu is enable other are disable. I want to unlock each of them after finishing level. I do not now how to do this. I have bool variable wich i call win and i do not know what i can do with this. I never play with save and load then maybe some of You can help me ?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Level loading
« Reply #1 on: July 23, 2012, 03:58:55 AM »
Hi,

 Study this thread very carefully, it is a the very same problem only dealing with showing and hiding cubes. So in your case, once you grasp the logic behind managing the radio buttons, you can then apply it to your own case.

http://hutonggames.com/playmakerforum/index.php?topic=997.msg4102#msg4102

dont hesitate to come back if you need more infos.

bye,

 Jean

Elizeusz

  • Playmaker Newbie
  • *
  • Posts: 32
Re: Level loading
« Reply #2 on: July 23, 2012, 04:35:37 AM »
Thank You  for Your help :) I have one scene where i have my menu ( created by NGUI) i can enable disable buttuns by set property which is working fine for me. I have other scenes ( puzzle) when i finish and win i get bool variable ( i have fsm bool test which check if this one is 0 or 1 when is one then i load another level) . Now i want to send unlock event to first scene wher i have my NGUI menu and remeber this . Then if i finisch 2 level for example and i will come back to the game i can chose between them ( they will be unlock) not sure if this is good explanation....

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Level loading
« Reply #3 on: July 23, 2012, 05:05:27 AM »
Hi,

 ok, and where do you have an issue? sending that event to unlock the ngui button?

bye,

 Jean

Elizeusz

  • Playmaker Newbie
  • *
  • Posts: 32
Re: Level loading
« Reply #4 on: July 23, 2012, 05:07:20 AM »
Yes. And how to do that when i exit game and then enter again those changese will be there..

Elizeusz

  • Playmaker Newbie
  • *
  • Posts: 32
Re: Level loading
« Reply #5 on: July 24, 2012, 05:23:48 AM »
from 2.40 min i want to to something like this.. :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Level loading
« Reply #6 on: July 24, 2012, 10:34:52 AM »
Hi,

 Ok, I get it.

 Basically, one way that I would investigate is the following:

 Instead of a boolean variable you maintain an integer ( let's call it "Current Level Access", which represent the current level, so 4 would that the user  has unlock the first four levels, so anything level id above 4 would be locked.

so , are you able to create a prefab that does three things:

1: implements a int variable called "My level id" ( that you tick "show in inspector") that will tell that FSM which elvel it represents
2: have a global event "CHECK LEVELS ACCESS" that when fired compares "Current Level Access" and "My level id". If "My level id" is below "Current Level Access" then you enable the button, if not , you disable it.

Try this, if you are struggle, I'll make a working example.

bye,

 Jean
 

Elizeusz

  • Playmaker Newbie
  • *
  • Posts: 32
Re: Level loading
« Reply #7 on: July 25, 2012, 05:05:31 AM »
If You have time please make some simple example.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Level loading
« Reply #8 on: July 25, 2012, 10:43:04 AM »
Hi,

 ok, import that package attached to this post. It's a fully working sample with three level buttons,

use the level manager and its inspector interface to unlock levels, lock them alls. Click on the unlocked levels to callback the level manager with the name of the level to load, locked level will not callback the level manager,

so, pay attention as to how the prefab is made of for the level buttons, and how it all communicates. Note also that I do not make use of global variables, just to show that it's possible to get away with having to use too many global variables when it's not necessarly needed.

 if you have questions, don't hesitate. If everything is clear, I'll put it on the user wiki, I think it's a good sample.

EDIT: now with player prefs to save level.


bye,

 Jean,
« Last Edit: March 18, 2013, 09:11:59 AM by jeanfabre »

Elizeusz

  • Playmaker Newbie
  • *
  • Posts: 32
Re: Level loading
« Reply #9 on: July 26, 2012, 01:06:10 AM »
Thank You very much i will study this example :)

arilarikins

  • Playmaker Newbie
  • *
  • Posts: 9
Re: Level loading
« Reply #10 on: February 13, 2013, 08:15:38 PM »
Hi Jean...

I used this example and it's excellent - many thanks for adding this to the forum.

If you have time, could I just ask how to get it to store the results to the player preferences so that the same levels appear unlocked when the game is switched back on.

Also, how would a trigger event unlock the next level?

Thanks,
Harry
« Last Edit: February 13, 2013, 08:31:12 PM by arilarikins »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Level loading
« Reply #11 on: February 15, 2013, 02:30:37 AM »
Hi,

 I am really sorry, I am currently in sprint mode, as the project I am working on is going to release on the app store next week, so I am really unable to allocate time on this at the moment. Can you bump this end of february if noe one stepped in before?

 meanwhile, you will find a lot of examples of how to use the playerprefs on this forum and on the playmaker Sample. have you tried them?


bye,

 Jean

arilarikins

  • Playmaker Newbie
  • *
  • Posts: 9
Re: Level loading
« Reply #12 on: February 24, 2013, 05:06:03 PM »
Hi Jean...

Yes of course - I'll search the forum for any references. I understand you are a very busy person. Thank you so much for taking the time to answer, and for all the time you spend helping people in the forum.

Good luck with your with the release of your App.

Thanks,
Harry

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Level loading
« Reply #13 on: March 18, 2013, 09:10:46 AM »
Hi,

 ok, I edited the scene so that it nows saves and retrieves the currently accessible level from the player pref. so you can unlock a level, close the app, restart and it will go back to that unlocked level.

 as for triggering an unlock, this is simply a matter of firing the event "UNLOCK NEXT LEVEL", so you can use any kind of system to eventually fire that event.

bye,

 Jean