Change scene with keep player position

  • #10, by TinTinMonday, 20. November 2017, 16:19 3 years ago
    ok replace game.FadeTime in the update_player_pos function with a custom time. Try using a custom value instead, say 1000 or so. 1000 = 1 second in milliseconds.
     There is no "game.FadeTime" in your codes. Did you mean "game.FadeDelay" ?
     
    I write
    if getTime() >= 1000 then .... and doesn't work .



    Forum Fan

    193 Posts


  • #11, by afrlmeMonday, 20. November 2017, 16:42 3 years ago
    Yes I did mean that, sorry. It's really strange. Changing the scene hides the character for some reason, whereas you can change the scene & teleport the character to the new scene with just...
    game.CurrentCharacter.Scene = Scenes["example"]
    1

    However, it will automatically position the character & won't immediately update the character position if you try to force it afterwards as it seems to wait until the scene is loaded before it updates the position & then after updating the position it scrolls the scene over to where the character is rather than snapping to it immediately. So much hassle for something that should be so simple.

    Maybe Simon could create an action part for changing to a new scene while retaining current position?

    Imperator

    6842 Posts

  • #12, by TinTinTuesday, 21. November 2017, 07:08 3 years ago
    OK. I think another tip will be good at the moment. So is it possible toggle change background and change way borders and points with a click on a switch in the same scene? ( with fade in-0ut too)

    Forum Fan

    193 Posts

  • #13, by afrlmeTuesday, 21. November 2017, 12:57 3 years ago
    Yes. You can add background images as scene objects. Use conditions/values to hide them. You can use Lua script to fade the scene brightness very easily with...
    game.CurrentScene:to(500, {SceneBrightness = 0}) -- fade to black over 500ms
    1

    &
    game.CurrentScene:to(500, {SceneBrightness = 100}) -- fade back to normal over 500ms
    1

    So you could fade out, toggle the condition that shows the new background, use the change way system action part, then fade back in. Only issue will be the scene objects if the scene change is for a light/dark state. You would need to setup various conditions to determine what to show, what's been picked up already by the player character & so on.

    Imperator

    6842 Posts

  • #14, by TinTinTuesday, 21. November 2017, 16:49 3 years ago
    Great!!.It work perfect.  Thanks a lot. Yes, I just have to manage objects in the scene carefully.

    Forum Fan

    193 Posts

Write post