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

#1 2011-01-09 00:35:42

Kowalskz
New Scratcher
Registered: 2010-11-20
Posts: 20

calling a subroutine / function

Hi,

I am not sure how to do the following in Scratch.

I have a program with a main script (in sprite A)  and a small script (in sprite B)

Whenever the player presses the Space key, the main script broadcasts a signal. At this point I want the small script to take over and the main script to stop. And after executing the small script,  I want the control to go back to the main script (to the step after the broadcast step)

Is this possible in Scratch?

Thanks.

Offline

 

#2 2011-01-09 01:09:25

hmnwilson
Scratcher
Registered: 2007-07-04
Posts: 1000+

Re: calling a subroutine / function

Yes - use the "broadcast [  ] and wait" block. This pauses the main script until the script(s) it triggers have ended, then it will carry on with the main script.


I'm taking a break from Scratch until 2.0 comes out. Any messages sent between then and now probably won't be read - sorry.
(Oct. 20, 2011)

Offline

 

#3 2011-01-09 11:47:54

Kowalskz
New Scratcher
Registered: 2010-11-20
Posts: 20

Re: calling a subroutine / function

hmnwilson,

Thanks a lot.

Offline

 

Board footer