Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: unearthly on November 19, 2018, 04:13:44 PM

Title: Loading scenes[SOLVED]
Post by: unearthly on November 19, 2018, 04:13:44 PM
Hi,

I have a question about how to best move between scenes. I have say a dozen scenes (or levels) which I want to load consecutively, but with a mini-game scene to be loaded between each. So scene01, then the mini-game scene, then scene02, back to the mini-game scene again, then scene03 and so on.

Or isn't it necessary for resource management reasons to return to the one version of the mini-game? Should I just have a dozen copies of the mini-game scene, 01, 02, 03 and so on?

Thanks Charles 
Title: Re: Loading scenes
Post by: NinjaX on November 20, 2018, 02:22:41 PM
So what you can do my man is this:

Create your mini game scene and in it add the action to load the next scene via the NUMBER of the scene. You know based on how you arrange them in the BUILD SETTINGS.

Than use a GLOBAL INT VARIABLE to load whatever scene you want next.

So for instance: When scene 1 is done and you want to move over to the mini game, before you move over to that scene in your 1st scene you can decide what you want your INT VARIABLE to be (1,5,8, whatever) and based on that you can simply LOAD the mini game scene, PLAY it, and when it's done it will start too load the next scene based on the INT VARIABLE that you have decided.

I hope that makes sense, there are various ways to do things though.
Title: Re: Loading scenes
Post by: unearthly on November 21, 2018, 12:02:40 AM
Thanks NinjaX,

I thought I might be able to do something with the Build Setting scene numbers. So to reiterate what you said, in other words. Excuse me for doing this step by step.

I make an FSM with a Load Level Num Action using a Global Int Variable in my mini- game, (activated when the mini-game is finished).

In scene (1) I make an FSM to define it's value using a Set Int Value action using that Global Int Variable. Also use a simple Load Level Action to load the mini-game. And repeat those FSM's in the other scenes.

Have I got it right? I really didn't have a strategy for doing this.

Regards Charles
Title: Re: Loading scenes
Post by: djaydino on November 21, 2018, 07:17:43 AM
Hi.
You might want to look into 'scene load async' (scene management) or have a 'Level manager' with a don't destroy on load

This 'Manager' can then handle the level loading.
Title: Re: Loading scenes
Post by: NinjaX on November 21, 2018, 11:04:15 AM
Yes, Uneartly you got it perfect :D
Title: Re: Loading scenes
Post by: unearthly on November 21, 2018, 06:12:24 PM
Thanks very much guys.

Your suggestions are really getting this game happening. Got some other ideas now for using Global variables as well.

Regards Charles :) ;)
Title: Re: Loading scenes
Post by: djaydino on November 22, 2018, 01:23:39 AM
Hi.
Just a reminder, try to minimize using globals.

https://hutonggames.fogbugz.com/default.asp?W1462