Coding -- does anyone know how to . . .?


#1

My students have been creating games and one of the tasks that has been puzzling us is . . . how do you “make the game end”? The games go on and on and it would be nice to be able to “end” the game because either time has run out or you have reached a certain score. Any suggestions would be appreciated!!


#2

@geri_hamada

The easiest option is to create a background for the end of the game and a function to draw it. Then, you can use a conditional to draw the background based on the score.
if (score > 10)
endBackground();
else
playBackground();

Use sprite.visible to show/hide different sprites.

Hope that helps,
Andrea