Document.png This article or section needs additional citations for verification. Its information may not be accurate. Editors can help by adding references. (November 2018)
Document.png Please expand this article or section. You can help by adding more information if you are an editor. More information might be found in a section of the talk page. (November 2018)

This article provides a method for switching between backdrops.

Variables

First, create a variable called screen:

(screen)

This variable will store which backdrop is shown.

Scripts

Then, in every sprite that would transition, put this:

when green flag clicked
... //Code before loop
forever
if <(screen) = [backdrop]> then //checks if the screen variable is the same as the wanted screen for the sprites to be shown
show //If true, sprite is shown
... //Code for when it is shown
else
hide //If not true, sprite is hidden
... //Code for when it is hidden.
end
end

In short, the script checks whether the screen variable is the same as the screen for showing the sprites. If so, the sprites will show and do whatever is required. If not, it will stay hidden and run the blocks for when it is hidden.

Stage Transitioning

For the stage, put this:

when green flag clicked
... //whatever code is wanted before loop
forever
switch backdrop to (screen) //Switches the backdrop to the string stored in the variable
end

This script constantly switches the backdrop to the string stored in the variable (screen).

Music Transitioning

If music should change based on the screen, add the following script to the Stage (or the sprite playing the music if a sprite is playing the music):

when I receive [change music v]
stop all sounds // this method could also be used to stop the music
if <(screen) = [screen 1]> then
forever // so the music doesn't randomly stop
play sound [music 1 v] until done
end
end
if <(screen) = [screen 2]> then
forever
play sound [music 2 v] until done
end
end
...

Execute this broadcast every time the music needs to be changed.

Black Screen

To make a black screen, first create a variable called (next screen). Then, insert this into the black screen sprite:

when I receive [black screen v]
go to front
set [ghost v] effect to (100) // invisible
show
repeat (20)
change [ghost v] effect by (-5) // fade into view
end
set [screen v] to [] // nothing
broadcast [change music v] // stop the music
wait (1) secs
set [screen v] to (next screen) // the screen to switch to
broadcast [change music v] // change the music to the screen
repeat (20)
change [ghost v] effect by (5) // fade out of view
end
hide

Use this to execute the black screen:

set [next screen v] to [wanted]
broadcast [black screen v]