return to scene ?

  • #1, by magiclightWednesday, 22. August 2018, 14:49 A year ago
    Lets say I can enter a scene from different places and I would like to return back to the same scene as I came from, is there anyway to do that ?

    Newbie

    13 Posts


  • #2, by afrlmeWednesday, 22. August 2018, 14:59 A year ago
    You mean the previous scene you were on, or the current scene that you are already on?

    Imperator

    6775 Posts

  • #3, by magiclightThursday, 23. August 2018, 11:07 A year ago
    The previous scene, say I make some kind of settings scene the user can goto with a key press or something, after finished there I want to return to the scene where the user was before that.

    Newbie

    13 Posts

  • #4, by afrlmeThursday, 23. August 2018, 11:22 A year ago
    If the playable character was on the previous scene then you can use the "change to scene of character" action part - alternatively, you could store the current scene into a Lua variable before changing to the menu scene, then use that variable to go back to the previous scene.

    For example...

    execute a script >
    prev_scene = game.CurrentScene
    1
    show scene/menu "menu"

    Now to go back to the previous scene when done you can use the execute a script action part & just inverse the script you wrote above, like so...
    game.CurrentScene = prev_scene
    1

    It should take you back to the scene you stored in the prev_scene Lua variable you created.

    Imperator

    6775 Posts

Write post