# Text not showing in Game Lab when a sprite is used as a background

**URL:** <https://forum.code.org/t/text-not-showing-in-game-lab-when-a-sprite-is-used-as-a-background/34380>\
**Category:** Coding and Debugging Help\
**Tags:** csd-unit-3\
**Created:** [March 11, 2021, 2:22pm UTC](https://forum.code.org/t/text-not-showing-in-game-lab-when-a-sprite-is-used-as-a-background/34380 "2021-03-11T14:22:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![clcheah](https://avatars.discourse-cdn.com/v4/letter/c/e480ec/32.png) [@clcheah](https://forum.code.org/u/clcheah)\
**Post date:** [March 11, 2021, 2:22pm UTC](https://forum.code.org/t/text-not-showing-in-game-lab-when-a-sprite-is-used-as-a-background/34380/1 "2021-03-11T14:22:09Z")

</div>

Dear friends,

When a sprite is used as a background, it seems that text is always below the level of the background sprite no matter how the code is arranged.

Any ideas please?

Thanks in advance!

Clement

**Link to the project or level:** [Code.org - Game Lab](https://studio.code.org/projects/gamelab/rZ_0Sg0kDm9kqSxWohS9FtcccVWZE-DJ02ayx0CWx9g)

**What I expect to happen:** Text to be displayed / change when laser touches an alien.

**What actually happens:** Expected action doesn’t happen

**What I’ve tried:** Placing text in various parts of the code (before Draw Loop, etc.)

---

<div class="post-metadata">

**Author:** ![edavis](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/edavis/32/4927_2.png) [@edavis](https://forum.code.org/u/edavis)\
**Post date:** [March 11, 2021, 3:53pm UTC](https://forum.code.org/t/text-not-showing-in-game-lab-when-a-sprite-is-used-as-a-background/34380/2 "2021-03-11T15:53:03Z")

</div>

Hi @clcheah,  
Could you please post the Share link to the project in question? I know this is a common issue people have had. Having the specific link will help us better find the issue causing the problem.

---

<div class="post-metadata">

**Author:** ![edavis](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/edavis/32/4927_2.png) [@edavis](https://forum.code.org/u/edavis)\
**Post date:** [March 11, 2021, 3:56pm UTC](https://forum.code.org/t/text-not-showing-in-game-lab-when-a-sprite-is-used-as-a-background/34380/3 "2021-03-11T15:56:19Z")

</div>

Also, here is a post from a previous question on the forum that may help.

> [@Text before some sprites but after others](https://forum.code.org/t/text-before-some-sprites-but-after-others/27135/6):
>
> Thank you for your reply but this does not work either.

---

<div class="post-metadata">

**Author:** ![mwood](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/mwood/32/4941_2.png) [@mwood](https://forum.code.org/u/mwood)\
**Post date:** [March 11, 2021, 6:20pm UTC](https://forum.code.org/t/text-not-showing-in-game-lab-when-a-sprite-is-used-as-a-background/34380/4 "2021-03-11T18:20:11Z")

</div>

@clcheah ,

I took a look at the project and the last action is to draw the sprites. Since the background is a sprite, it is drawn on top of the text. You might want to try to draw the text last (below the drawSprites block) as order matters, even inside the draw loop.

Good luck!

Mike

---

<div class="post-metadata">

**Author:** ![heffernanj](https://avatars.discourse-cdn.com/v4/letter/h/b77776/32.png) [@heffernanj](https://forum.code.org/u/heffernanj)\
**Post date:** [March 2, 2022, 5:50pm UTC](https://forum.code.org/t/text-not-showing-in-game-lab-when-a-sprite-is-used-as-a-background/34380/5 "2022-03-02T17:50:46Z")

</div>

I get this issue a lot. As Mike suggested, first thing to try is putting text command below drawsprites command in draw loop. However, sometimes that does not do what you want. I see this problem occur many times when trying to write text like “You WIN” or “You Lose” depending on the score. I suggest 2 things to students:

Take a background sprite and modify it to add the text you want, for example, WIN or LOSE. Note, for some reason, there is no text tool in the animation editor.

Second is only to drawsprites when game is not lost or won. Here’s a code example of that.

var main = createSprite(200, 200);  
var char = createSprite(200, 200);  
char.setAnimation(“virus02\_04\_1”);  
char.scale = 0.25;  
main.setAnimation(“abstract\_08\_1”);  
var score = 0;  
fill(“black”);  
textSize(32);  
function draw() {  
score = score + 1;  
if (score \> 50) {  
background(“white”);  
text(“WINNER!”, 100, 100);  
} else {  
drawSprites();  
text("Score: " + score , 21, 50);  
}  
}
