Lesson 28: Final Project - Design a Game

My student wants this to happen: The keyDown “up” will only be able to be used once the score equals 100. I’m at a loss. Can you help?

function score100() {
  if (score == 100) {
    if (keyDown("up")) {
      var small2cookie = createSprite(randomNumber(50, 400), 0);
      small2cookie.setAnimation("cookie_1");
      small2cookie.rotation = 5;
      small2cookie.scale = 0.1;
      small2cookie.velocityY = 10;
      score = score + 1;
    }
  }
}

if a basic comparison operator is what your want == is your solution. I would recommend teaching about comparison operators in the future if you have not in cooperated that into lesson plans otherwise your bound to run into this fundamental issue again

Varrience

@langilla1 ,

Did the student want the clicker score to change and the cookies to fall with each click of the up key after the score gets to 100? Then you would use image so all the actions that are in the if statement run as long as the score is greater than 10.

If neither of these tips work, give us a little more information so we can help further.

~Michelle