My son is programming in scratch. At the end of the game he is programming, he wants to hide the 2 sprites, and the stage to change to the other background.
The end of the game is when score > 14.
First we tried to make a script as follows:
when space key is pressed (=start signal of the game)
show
If score>14
hide
This does not work.
Then we tried:
when space key is pressed (=start signal of the game)
show
repeat until score>14
change volume by -10 (we do not use a sound, so this is a fake comment, just to be able to use the "repeat until" block)
hide
This does not work in de project we made. However, in a simple try out project that I quickly made to try out, it did work. We do not understand the difference between the two projects. Both have the same programming blocks.
Who can help?
Offline
ibb wrote:
My son is programming in scratch. At the end of the game he is programming, he wants to hide the 2 sprites, and the stage to change to the other background.
The end of the game is when score > 14.
First we tried to make a script as follows:
when space key is pressed (=start signal of the game)
show
If score>14
hide
This does not work.
Then we tried:
when space key is pressed (=start signal of the game)
show
repeat until score>14
change volume by -10 (we do not use a sound, so this is a fake comment, just to be able to use the "repeat until" block)
hide
This does not work in de project we made. However, in a simple try out project that I quickly made to try out, it did work. We do not understand the difference between the two projects. Both have the same programming blocks.
Who can help?
Don't forget, always use a "forever" loop around everything if you need it to constantly check.
Otherwise you need to score 14 in 0.01 seconds...the amount of time it takes to run once.
Offline
Put this code in each sprite you wish to hide at the end of the game:
when gf clicked wait until <(score) > (14)> hidePut this in the stage:
when gf clicked wait until <(score) > (14)> switch to background [endBackground v]
Last edited by BoltBait (2012-11-20 12:38:09)
Offline