it seems like you’ve resolved your issue however you didn’t account for stopping the player from jumping after the game has finished allowing them to keep playing even though they died
// Variables
var score = -1;
// Create Sprites
var platform = createSprite(200, 200);
platform.setAnimation("platform");
platform.velocityY = 1;
platform.y = 0;
platform.x = randomNumber(50, 350);
var platform2 = createSprite(200, 200);
platform2.setAnimation("platform");
platform2.velocityY = 1;
platform2.y = 200;
platform2.x = randomNumber(50, 350);
platform.visible = false;
platform2.visible = false;
var star1 = createSprite(randomNumber(10, 390), randomNumber(-30, -100));
star1.setAnimation("star");
star1.velocityY = 3;
star1.visible = false;
var star2 = createSprite(randomNumber(10, 390), randomNumber(-30, -100));
star2.setAnimation("star");
star2.velocityY = 3;
star2.visible = false;
var player = createSprite(200, 0);
player.setAnimation("alien");
player.visible = false;
var isOver = false;
function draw() {
// draw the background
if (score > 25) {
background2();
} else if ((score > -1)) {
background1();
} else {
startBackground();
}
if (keyWentDown("space") && !isOver) {
score = score + 1;
platform.visible = true;
platform2.visible = true;
star1.visible = true;
star2.visible = true;
player.visible = true;
player.y = 0;
}
showScore();
// update the sprites
loopPlatforms();
loopItems();
playerFall();
playerControl();
playerLands();
collectItems();
drawSprites();
gameOver();
}
// Functions
function background1() {
background("darkBlue");
noStroke();
fill("yellow");
ellipse(randomNumber(0, 400), randomNumber(0, 400), 3, 3);
ellipse(randomNumber(0, 400), randomNumber(0, 400), 3, 3);
ellipse(340, 50, 60, 60);
fill("darkBlue");
ellipse(320, 30, 60, 60);
}
function background2() {
background("coral");
noStroke();
fill("yellow");
ellipse(randomNumber(0, 400), randomNumber(0, 400), 3, 3);
ellipse(randomNumber(0, 400), randomNumber(0, 400), 3, 3);
ellipse(340, 50, 60, 60);
fill("darkBlue");
ellipse(320, 30, 60, 60);
}
function startBackground() {
background("white");
fill("black");
textSize(40);
text("Platform Jumper!!!",25, 200);
textSize(20);
text("Use the arrows to move the alien ",25, 250);
text("and collect the stars.", 25, 275);
fill("red");
textSize(30);
text("Press 'space' to start!", 25, 315);
}
function showScore() {
fill("white");
textSize(20);
text("Score: ",10, 10, 80, 20);
text(score, 70, 25);
}
function loopPlatforms() {
if (platform.y > 400) {
platform.y = 0;
platform.x = randomNumber(50, 350);
}
if (platform2.y > 400) {
platform2.y = 0;
platform2.x = randomNumber(50, 350);
}
}
function loopItems() {
if (star1.y > 400) {
star1.y = randomNumber(-30, -0100);
star1.x = randomNumber(10, 390);
}
if (star2.y > 400) {
star2.y = randomNumber(-30, -100);
star2.x = randomNumber(10, 390);
}
}
function playerFall() {
player.velocityY = player.velocityY + 0.1;
}
function playerControl() {
if (keyDown("up")) {
player.velocityY = player.velocityY - 0.7;
}
if (keyDown("left")) {
player.x = player.x - 3;
}
if (keyDown("right")) {
player.x = player.x + 3;
}
}
function playerLands() {
player.collide(platform);
player.collide(platform2);
}
function collectItems() {
if (player.isTouching(star1)) {
score = score + 1;
star1.y = randomNumber(-30, -0100);
star1.x = randomNumber(10, 390);
playSound("sound://category_achievements/lighthearted_bonus_objective_2.mp3", false);
}
if (player.isTouching(star2)) {
score = score + 1;
star2.y = randomNumber(-30, -0100);
star2.x = randomNumber(10, 390);
playSound("sound://category_achievements/lighthearted_bonus_objective_2.mp3", false);
}
}
function gameOver() {
if (player.y > 400) {
background("black");
if (!isOver) {
playSound("sound://category_male_voiceover/mission_failed_male.mp3", false);
isOver = !isOver;
}
}
}
here is my revised code hope this helps