Student Game Needs Help with Backgrounds


#1

The above game will not keep the one background when clicked on the sprite. We keep trying to switch the order of backgrounds but nothing is working. Please help!

Thanks!


#2

I’m not exactly sure what the student wants but it seems like the background is changing after the initial change when the first click on the sprite in the collectItems function. I pasted a bit of it.

function collectItems() {
  if (robot.isTouching(token)) {
    token.visible = false;
    score = score + 1;
  }
  if (robot.isTouching(flag)) {
    flag.visible = false;
    /// ******** . switches background to #2 here. ************
    background2();
  }

Which background should be showing during the game?


#3

She doesn’t know where to put background0 because the score is starting right away and just keeps increasing. Thank you!


#4

Hi Erin,

Can you explain how the student wants the game to work? Which backgrounds should be displayed when? What should be happening with the score? I’m having a little trouble understanding what the goal is.

The biggest problem with the game is that there is a function named “score” and a variable named “score”, so they are conflicting. If the student fixes that, it will be a big help.

Thanks,
Elizabeth