Text not showing Lesson 22


#1

Hello, My student wants text to show up when a player wins or loses. I cannot get the text to show. The text is in function gameOver and gameWin.

Thank you.


#2

This is a tricky one, because the text technically is there, but is too big to fit in the frame the student gave it. If you look at lines 165-166:

textSize(50);
text("Game Over!",50, 20, 80, 20);

The textSize(50) sets the text to be 50 pixels tall, but the final parameter of the text() command says that the text box will only be 20 pixels tall. I think the intuitive expectation here is that the text would just be cut off, and therefore the bug would be easier to identify (I’m going to sync with the engineers to see whether this change would be a possiblilty).

The easiest solution would be to just remove the final two parameters, which are optional, and the text will be allowed to take up as much space as it needs. Alternatively, the student could identify better values for the final two parameters to ensure there’s enough space for the text.