Unit 3 Lesson 11 - Help please

I’m a former ELA teacher who is teaching Computer Science for the first time, so I’m learning as I go. I’m on CSD Unit 3 Lesson 11. I can’t figure out why my text is not showing on top. Please advise. Here is my code.

var planet = createSprite(200, 200);
planet.setAnimation(“planet”);

var alien_1 = createSprite(90, 290);
alien_1.setAnimation(“alien_1”);
alien_1.scale = 0.25;

var alien_2 = createSprite(310, 290);
alien_2.setAnimation(“alien_2”);
alien_2.scale = 0.25;

var alien_3 = createSprite(200, 290);
alien_3.setAnimation(“alien_3”);
alien_3.scale = 0.25;

var crown = createSprite(90, 220);
crown.setAnimation(“crown”);
crown.scale = 0.2;

var confetti = createSprite(200, 200);
confetti.setAnimation(“confetti”);
confetti.scale = 2;

drawSprites();

fill(“yellow”);
textSize(30);
text(“Miss Universe 2022”, 60, 80);

function draw() {
confetti.y = randomNumber(200,220);
crown.x = randomNumber (80, 100);

drawSprites();
}

@kristielinkous ,

If you could click on the share link and give us a link to the actual project, we can definitely help you out. What could be happening is that you might have a sprite covering the text, so when drawSprites is drawn, it covers the text. You could try putting the text inside the draw loop and have the text be created after drawing the Sprites and that may be the solution.

Mike

Thanks! Because the draw loop is a “forever” loop, it continues to draw your sprites over and over again (covering up the text). Your text is only drawn once because it isn’t inside the draw loop.

If you move the text blocks inside the draw loop (after the drawSprites) block, it should work!

Good luck!

Mike

Thank you so much. That worked!

1 Like