Student Issue-U3L22

I have a student having trouble getting his Score and Lives to show up on top of a set animation. Please advise, link below.

The problem is your student is calling drawSprites() after drawing the text. if he moves drawSprites() to before showLives() and showScore()

function draw() {
  // draw background
  background1();
  background2();
  background3();
  // update sprites
  changeBackground();
  controlPlayer();
  playerFall();
  drawSprites(); //drawSprites() called before text is drawn
  showLives();
  showScore();
  loopItems();
}
1 Like

Looks like @kookooloopdaking came up with the same thing I would have. I like to encourage students to always remember what needs to be drawn first and what needs to be drawn last. In this case, the score needs to be the top element, so it should be drawn last, so I would invite my student to see if they can figure out what is hiding the score and how they might be able to solve the problem (rather than just give them the answer).

Mike

Thank you all so much!

1 Like