This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-11-20 10:48:01

ibb
New Scratcher
Registered: 2012-11-20
Posts: 3

hide does not work

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

 

#2 2012-11-20 10:51:40

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: hide does not work

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.  smile


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#3 2012-11-20 11:47:44

GenChico
Scratcher
Registered: 2012-11-08
Posts: 100+

Re: hide does not work

Use a forever block instead of the repeat block, then it should work. If you have any more questions feel free to ask.


http://i.imgur.com/Cb8HC.png

Offline

 

#4 2012-11-20 12:35:16

BoltBait
Scratcher
Registered: 2009-03-09
Posts: 1000+

Re: hide does not work

Put this code in each sprite you wish to hide at the end of the game:

when gf clicked
wait until <(score) > (14)>
hide
Put 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)


Animated sigs must be banned!
http://boltbait.com/j.pnghttp://boltbait.com/s.pnghttp://boltbait.com/d.pnghttp://boltbait.com/a.pnghttp://boltbait.com/p.png

Offline

 

Board footer