3.19-Activity 11



My students and I are having some trouble with Activity 11. When we put the suggested code (If score<10, simple background, else crazy background) in the draw loop with backgrounds that are sprites, the background covers up the bunny and coin. Some more instructions on how to do this one would be helpful.


Yikes!! @bcunningham would you be able to share a link so we can take a look at the code?



Hi, I made it into a project. Here’s the link: Function Bunny Collector


I think it is because your backgrounds are pictures/variables. It works if you are using fill colors and shapes and background under the draw tool.



What Kimberley said is right, but you can also do it with sprites. You just have to do it a little differently. Your sprites show up in the order that you create them, with the ones that you create first in the back, and the ones that you create last in the front. When you call your simpleBackground and crazyBackground functions, you are creating new sprites, so they are going to show up on top of everything else. What you should do instead is create a single background sprite at the top of your code, before you create any other sprites. Then, in your function, only set the background sprite’s animation to the image you want, rather than making an entirely new sprite.