Student Assistance 2

Student can not get his cars to show up since he added his other two backgrounds to his code.

It looks like your student is creating the strip sprite twice (once at the top of the program and once in the background1 function). They are then creating strip2 inside the background2 function. When the drawSprites block is used, it draws the first created sprite first and then goes in order. Since the second strip and the strip2 sprites are being created after the cars are created, they will cover up the cars.

I would suggest creating all sprites at the beginning of the program (before the draw loop) with the cars being created last. You can make the strips invisible (strip.visible=false;) Then, rather than using the background functions, I would suggest using a conditional block to check the score and make the appropriate strip visible while making the other ones invisible when the desired score threshold is reached.

Let us know how it goes!

Mike

1 Like