My students are on the final project and are creating games that require a score variable. The ones that are having difficulty have set backgrounds as sprites. No matter how the sprites are ordered, the score stays behind the background sprite.
My thought is that they will need to draw their own background in order for the score to appear, as opposed to having the background set as a sprite. Is this correct?
The thing that I see is that there are two if statements regarding whether the apple is touching the basket - one if statement resets the x and y, and the second increases the score. Try dragging the score=score+1 into the first if statement.
The syntax isn’t correct - it should say scoreIncrease or scoreDecrease - the second word should be capitalized. Also, there are two if statements regarding whether the apple is touching the basket - one if statement resets the x and y, and the second increases the score. Try dragging the score=score+1 into the first if statement.
So, the combined code will read:
If apple1 is touching basket:
apple1.x=0
apple1.y=random
score=score+1
You should be able to eliminate the whole increaseScore function. Hope this helps!