Sprites as backgrounds



How can my students use images as backgrounds with out the image covering up the other sprites? We are in Lesson 22 creating our own games.


Thank you for your help.


I think this is the right answer, but someone may correct me if I’m wrong. If you create the background first, it should be on the bottom layer… here’s a link to a project I made and I declared the “stars” variable (the background sprite) before the platforms. https://studio.code.org/projects/gamelab/00AogJC4atcHhdbGvbBIu7CIlOB1lCV383TerKiAtS0


This has helped tremendously, thank you! However, now the score doesn’t show up. Is there a fix for that? Also, how do they then change the background to a new background sprite?
Thanks for any help you can provide!



Hi Robyn,

showScore() and showLives() need to come after drawSprites() in the draw loop. Otherwise, the background sprite will cover up the text that they draw.


That makes perfect sense. Thank you, we’ll try it out in class today.