Her code blocks will not appear after pressing the blocks button. It states that she needs to correct some of the code, however that is impossible without seeing the blocks. Please help!
function draw() {
// draw the background
if ("score" > 20) {
background3();
} else if (("score > 10)) {
background2();
else {
background1();
}
It’s very obvious it is just some syntax errors.
There is an unmatched quote on line 23
Even if the syntax error is corrected, the script still won’t run:
"score"
is a string, it is comparing a string with an integer when it should be comparing a variable score
line 61
showscore()
is not defined. Should be corrected to showScore()
line 80
LoopPlatform
, might want to make L
lowercase so that line 30
, which contains loopPlatform();
avoids calling an undefined value
line 90
,
star.x = randomNumber(-30, -60);
star.y = randomNumber(50, 350);
Looks like star.x and star.y was switched
Perhaps the intent was:
star.y = randomNumber(-30, -60);
star.x = randomNumber(50, 350);
Line 77
text("Score:0",10, 10, 80, 20);
text(score, 75, 10, 80, 20);
Score:0 messes up the display a bit, try removing the 0
so it looks like Score:
Platform 1 and Platform 2 won’t fall, try adding platform1.velocityY = 2
and platform2.velocityY = 2
after variable declaration.
The score won’t actually go up, try incrementing the score with score = score + 1
or score++
the same place you reset their positions.
@keisa.carrhudson Were you able to make progress on this one yet or do you still need some assistance? Let us know and we’re happy to help you out if you are still needing help on this one.
Mike