1
Ask a Question / Is there a way to continue executed code from one scene through to another?
« on: January 13, 2022, 10:30:47 am »
I am not sure how to pose this question correctly - so I'll explain in brief.
Making a game that has a random event happen during scenes (A scene behaviour I attach to all scenes) This random event is a sequence of code that has a few "if then" & "do after X sec" & "play sound" blocks in it - so the whole code sequence takes about 2 to 3 seconds to execute completely.
It is basically a computer voice that is telling you what has happened based upon a sequence of random attributes being changed. For example: "Core Power Failure Detected" - "Core now operating at" - "XX%" (Each "" is a different audio file that plays in a sequence based upon the random event)
However - if the player switches away from the scene to another one before this code is fully executed - it obviously stops and the audio doesn't play through completely, and a few variables fail to get set properly.
So is there a way to allow code in one scene to finish executing, even if the scene has changed? The flow of the game won't be the same if this isn't possible.
Thanks in advance!
Making a game that has a random event happen during scenes (A scene behaviour I attach to all scenes) This random event is a sequence of code that has a few "if then" & "do after X sec" & "play sound" blocks in it - so the whole code sequence takes about 2 to 3 seconds to execute completely.
It is basically a computer voice that is telling you what has happened based upon a sequence of random attributes being changed. For example: "Core Power Failure Detected" - "Core now operating at" - "XX%" (Each "" is a different audio file that plays in a sequence based upon the random event)
However - if the player switches away from the scene to another one before this code is fully executed - it obviously stops and the audio doesn't play through completely, and a few variables fail to get set properly.
So is there a way to allow code in one scene to finish executing, even if the scene has changed? The flow of the game won't be the same if this isn't possible.
Thanks in advance!