End a game by either time up or you win



A student is trying to make a game that ends when either the timer runs out or you win. We can get one or the other to work - but not both at the same time. Any help is appreciated!



I think I found it under another topics - thanks to Josh. Use a variable to check the World.seconds along with his gameOver variable.

function draw() {
textAlign(CENTER, CENTER);

var time = 10 - World.seconds;
if (time > 0) {
text(time, 200, 200);
} else {
text(“Time’s Up!”, 200, 200);