playMaker

Author Topic: Loading scenes[SOLVED]  (Read 632 times)

unearthly

  • Junior Playmaker
  • **
  • Posts: 57
    • View Profile
Loading scenes[SOLVED]
« on: November 19, 2018, 02: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 
« Last Edit: November 21, 2018, 11:24:12 PM by jeanfabre »

NinjaX

  • Full Member
  • ***
  • Posts: 108
  • XCO is the ULTIMATE IOS Ninja!!
    • View Profile
    • XCOGAMES
Re: Loading scenes
« Reply #1 on: November 20, 2018, 12: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.
XCO is the ULTIMATE IOS Ninja, Beware for he sees Everything and Nothing all at once!

unearthly

  • Junior Playmaker
  • **
  • Posts: 57
    • View Profile
Re: Loading scenes
« Reply #2 on: November 20, 2018, 10:02:40 PM »
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

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4820
    • View Profile
    • jinxtergames
Re: Loading scenes
« Reply #3 on: November 21, 2018, 05: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.

NinjaX

  • Full Member
  • ***
  • Posts: 108
  • XCO is the ULTIMATE IOS Ninja!!
    • View Profile
    • XCOGAMES
Re: Loading scenes
« Reply #4 on: November 21, 2018, 09:04:15 AM »
Yes, Uneartly you got it perfect :D
XCO is the ULTIMATE IOS Ninja, Beware for he sees Everything and Nothing all at once!

unearthly

  • Junior Playmaker
  • **
  • Posts: 57
    • View Profile
Re: Loading scenes
« Reply #5 on: November 21, 2018, 04: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 :) ;)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4820
    • View Profile
    • jinxtergames
Re: Loading scenes
« Reply #6 on: November 21, 2018, 11:23:39 PM »
Hi.
Just a reminder, try to minimize using globals.

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