The order in which your Sprites and Shapes are added to your program determines the overlay that will happen when sprites share a location on the stage.

stage.set_background_color("orange") # EXAMPLE 1 #The cat and Jack-o-lantern are hidden behind # the ghost because the ghost is added into the code last # and is the biggest sprite. cat = codesters.Sprite("blackcat") jack = codesters.Sprite("jackolantern") ghost = codesters.Sprite("ghost") # Code to explain the example ghost.say("Example 1") stage.wait(3) ghost.say("3 sprites should be displayed") stage.wait(3) ghost.say("Where is the cat and jack-o-lantern?") stage.wait(3) # Remove Sprites from the Stage for next example stage.remove_sprite(ghost) stage.remove_sprite(cat) stage.remove_sprite(jack) # EXAMPLE 2 # By changing the order in the program # the larger ghost is moved to the back and the # cat moved to the front. ghost = codesters.Sprite("ghost") jack = codesters.Sprite("jackolantern") cat = codesters.Sprite("blackcat") # Code to Explain the example ghost.say("Example 2") stage.wait(3) ghost.say("By changing the sprite order from largest to smallest") stage.wait(4) ghost.say("All of the sprites are visible") stage.wait(4) ghost.say("") # Remove Sprites from the Stage for Example Overview stage.remove_sprite(ghost) stage.remove_sprite(cat) stage.remove_sprite(jack) stage.set_background_color("white") #_________________________________________________ # # Example overiew of what you find in the program # #_________________________________________________ stage.wait(1) heading = codesters.Text("HOW TO LAYER SPRITES",0,175) heading.set_color("red") heading.set_size(1.5) text1 = codesters.Text("Look at the Code:",0,120) text1.set_color("#14a4dd") text1.set_size(1.25) text2 = codesters.Text("Example 1 - Largest sprite on top",0,80) text3 = codesters.Text("Example 2 - Sprites ordered from largest to smallest ",0,40)