My student's code isn't turning back into blocks

Does anyone know why it isn’t converting back into blocks?

it was mainly two encapsulation issues your student compensated an { brace for one at the end which the program has no idea how to deal with so i revised it, you’ll have to compare the two if you want to really understand though anyway

function draw() {
  if (mousePressedOver(easy)) {
    bosshealth = 100;
    idk = 95;
    Idk = 90;
    IDK = 85;
    startscreen.visible = false;
    easy.visible = false;
    normal.visible = false;
    hard.visible = false;
  }
  if (mousePressedOver(hard)) {
    startscreen.visible = false;
    easy.visible = false;
    normal.visible = false;
    hard.visible = false;
  }
  if (mousePressedOver(normal)) {
    bosshealth = 150;
    idk = 145;
    Idk = 140;
    IDK = 135;
    startscreen.visible = false;
    easy.visible = false;
    normal.visible = false;
    hard.visible = false;
  }

  if (startscreen.visible == false) {
    if (restart.visible == true && mousePressedOver(restart)) {
      bosshealth = 200;
      idk = 195;
      cont = 1;
      Idk = 190;
      IDK = 185;
      health = 5;
      dir = 1;
      van.x = 400;
      van.y = 300;
      van.velocityX = 0;
      map2.velocityX = 0;
      mapy.velocityX = 0;
      boss.velocityY = 10;
      background.visible = true;
      mapy.visible = true;
      map2.visible = true;
      lose.visible = false;
      van.visible = false;
      player.visible = true;
      van.visible = false;
      lose.visible = false;
      restart.visible = false;
      sad.visible = false;
      heart1.visible = true;
      heart2.visible = true;
      heart4.visible = true;
      heart3.visible = true;
      heart5.visible = true;
    }
    if (boss.y >= 350) {
      boss.velocityY = -10;
    }
    if ((boss.y) <= 50) {
      boss.velocityY = 10;
    }
    player.velocityY = player.velocityY + 2;
    if (blaster.isTouching(boss)) {
      bosshealth = bosshealth - 1;
      blaster.x = 1000;
      blaster.y = 1000;
    }
    if (player.isTouching(mapy)) {
      if (!keyDown("w")) {
        player.collide(mapy);
        player.velocityY = 0;
      }
      if (!lose.visible) {
        if (keyDown("w")) {
          player.velocityY = -25;
        }
      }
    }
    if (bosshealth == idk) {
      cont = 1;
      attack.velocityX = -5;
      attack.setAnimation("animation_1");
      idk = idk - 15;
      attack.x = boss.x + -100;
      attack.y = boss.y;
    }
    if (keyDown("m")) {
      no = 1;
    }
    if (no == 1) {
      if (keyDown("o")) {
        no = 2;
      }
    }
    if (no == 2) {
      if (keyDown("a")) {
        no = 3;
      }
    }
    if (no == 3) {
      if (keyDown("i")) {
        player.setAnimation("9ff5f05ddc6ea2f.png_1");
        no = 4;
      }
    }
    if (cont < 3) {
      if (cont > 0) {
        if ((attack.x) <= 5) {
          attack.velocityX = -5;
          attack.setAnimation("animation_1");
          attack.x = boss.x + -100;
          attack.y = boss.y;
          cont = cont + 1;
        }
      }
    }
    if (cont >= 3) {
      cont = 0;
    }
    if (attack.isTouching(player)) {
      attack.x = 1000;
      health = health - 1;
    }
    if (attack2.isTouching(player)) {
      attack2.x = 1000;
      health = health - 1;
    }
    if (attack3.isTouching(player)) {
      attack3.x = 1000;
      health = health - 1;
    }
    if (bosshealth == IDK) {
      attack2.velocityY = 5;
      attack2.setAnimation("animation_2");
      IDK = IDK - 15;
      attack2.x = randomNumber(50, 350);
      attack2.y = 0;
    }
    if (bosshealth == Idk) {
      attack3.velocityX = -5;
      attack3.setAnimation("download (1).jfif_1");
      Idk = Idk - 15;
      attack3.x = boss.x + -100;
      attack3.y = boss.y;
    }
    if ((attack3.x) <= 5) {
      attack3.velocityX = 5;
    }
    if (player.isTouching(map2)) {
      if (keyDown("w") == false) {
        player.collide(map2);
        player.velocityY = 0;
      }
      if (lose.visible == false) {
        if (keyDown("w")) {
          player.velocityY = -25;
        }
      }
    }
    if (annoying == 0) {
      mapy.x = mapy.x - 5;
      map2.x = map2.x - 5;
      if (map2.x < 5) {
        map2.x = 400;
        map2.y = 200;
      }
      if (mapy.x < 5) {
        mapy.x = 400;
        mapy.y = 200;
      }
    }
    if (lose.visible == false) {
      if (keyDown("d")) {
        player.x = player.x + 5;
        dir = 1;
        player.setAnimation("right_walk");
      }
      if (keyWentUp("d")) {
        player.setAnimation("right");
      }
      if (keyDown("a")) {
        player.x = player.x - 5;
        dir = 2;
        player.setAnimation("left_walk");
      }
      if (keyWentUp("d")) {
        player.setAnimation("right");
      }
    }
    if (delay.x >= 400) {
      if (lose.visible == false) {
        if (keyWentDown("space")) {
          blaster.x = player.x;
          blaster.y = player.y - 5;
          if (dir == 1) {
            blaster.x = blaster.x + 60;
            blaster.velocityX = 15;
            player.setAnimation("attack");
          }
          if (dir == 2) {
            blaster.x = blaster.x - 25;
            blaster.velocityX = -15;
          }
          blaster.velocityY = 1;
          delay.x = 0;
        }
      }
    }
    if (player.y > 350) {
      player.x = 100;
      player.y = 100;
      player.velocityY = -20;
      health = health - 1;
    }
    if (health <= 0) {
      van.velocityX = -20;
      map2.velocityX = 0;
      mapy.velocityX = 0;
      boss.velocityY = 0;
      blaster.velocityX = 0;
      blaster.velocityY = 0;
      background.visible = false;
      mapy.visible = false;
      map2.visible = false;
      lose.visible = true;
      van.visible = true;
      player.visible = false;
      stroke("black");
      textSize(100);
      text("you lost", 20, 100);
    } else {
      stroke("white");
      textSize(20);
      text(bosshealth, 200, 10);
    }
    if (bosshealth <= 0) {
      heart1.destroy();
      heart2.destroy();
      heart3.destroy();
      heart4.destroy();
      heart5.destroy();
      boss.destroy();
      player.destroy();
      background.destroy();
      mapy.destroy();
      map2.destroy();
      blaster.destroy();
      fill("black");
      rect(0, 0, 400);
      fill("white");
      textSize(50);
      text("you win", 100, 100);
      var win = createSprite(200, 300);
      win.setAnimation("download (1).png_1");
    }
    if (health <= 0) {
      sad.visible = true;
      van.visible = true;
    }
    if ((van.x) <= 5) {
      van.visible = false;
      restart.visible = true;
    }
    if (health <= 4) {
      heart5.visible = false;
    }
    if (health <= 3) {
      heart4.visible = false;
    }
    if (health <= 2) {
      heart3.visible = false;
    }
    if (health <= 1) {
      heart2.visible = false;
    }
    if (health <= 0) {
      heart1.visible = false;
    }
    if (lose.visible == true) {
      attack.x = 100000;
      attack.y = 10000000;
      attack2.x = 100000;
      attack2.y = 10000000;
      attack3.x = 100000;
      attack3.y = 10000000;
    }
    drawSprites();
  }
}

just replace your draw() function with this

1 Like

Thank you! It works now!