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

#1 2007-07-31 07:05:57

rbkc
Scratcher
Registered: 2007-07-31
Posts: 3

Linking sprites

Whats the beginners way to link one sprites actions to another please?  Have created different sprites and now want to link them and the 'getting started' doesn't show and tell this!

Offline

 

#2 2007-07-31 09:53:33

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: Linking sprites

Exactly what do you mean by linking?  What do you want to happen?


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#3 2007-07-31 10:43:28

rbkc
Scratcher
Registered: 2007-07-31
Posts: 3

Re: Linking sprites

Hi I already taken a look at your great projects ... but for a beginner .... I don't understand how the "broadcast" and "when I rceive ..." work to enable one set of actions to be linked to another.  And I can't find a beginners guide to these tools

Offline

 

#4 2007-07-31 14:06:59

paulmedwal
Scratcher
Registered: 2007-03-09
Posts: 100+

Re: Linking sprites

You can find out what different blocks do by right-clicking on them and choosing "help". Also, inside of the support section of the Scratch site, you can look at the different help screens (click here to see descriptions of all the blocks). Below are the screens that are related to the "broadcast" and "when I receive" blocks.

Paulmedwal

http://llk.media.mit.edu/projects/scratch/help/images/broadcast_.gif
http://llk.media.mit.edu/projects/scratch/help/images/broadcastHat.gif


And, in case you want it, here is the description for "broadcast and wait"
http://llk.media.mit.edu/projects/scratch/help/images/doBroadcastAndWait.gif

Last edited by paulmedwal (2007-07-31 14:10:56)


clutter.scratch.mit.edu Visit the Clutter site to create multi-scene stories and multi-level games with Scratch.

Offline

 

#5 2007-07-31 15:05:25

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: Linking sprites

Basically, Broadcast (message) allows a sprite to "shout" that message to all the other sprites (and the background).

Any of those sprites (or even the same sprite) can be given a "when I recieve" block, which is basically an instruction to listen for a particular shouted message, and act when they hear it.

EG: 
Sprite 1 shouts (or rather, Broadcasts) "Start shooting"
Sprite 2 has instructions that say "if somebody shouts "start shooting", move forward 100 (When I recieve...).  So when it "hears" sprite 1, it carries out its instructions accordingly.


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#6 2007-08-05 22:30:36

Larry828
Scratcher
Registered: 2007-05-30
Posts: 100+

Re: Linking sprites

rbkc wrote:

... but for a beginner .... I don't understand how the "broadcast" and "when I rceive ..." work to enable one set of actions to be linked to another.  And I can't find a beginners guide to these tools

===============================
It took me a long time to figure out the same thing when I started.  As Mayhem said, you can link actions using the "Broadcast....Receive" commands. 

eg:  The Cat in his living room wants to play ball with someone.
       In the Cat's script, add the block "Broadcast..." with its blank box.
       Click in the blank box and you'll get "new".  That means you name the command you want the Cat to send to everyplace in general.  So click on "new" and you'll get a little window where you type the name of this "broadcast" command.  In this case, you could name it "Play ball".
        Now here's the interesting part: any other Sprite and even the Background (Stage) can Receive a broadcast and act on it.
        If there's a Dog in your project, click on the Dog sprite and add to his script "When I receive..."  Click in the blank box on the command block and you'll see a list of the available broadcasts he could respond to.  In this case, click on "Play ball."  Then have the dog think "I'd like to play!"
       AND, you could have the Stage ALSO receive the broadcast.  Click on the Stage and start its script with "When I receive...." and choose "Play ball."  Add a command to that script that changes the background from the Cat's living room to a baseball field. So now you'll have the cat standing in the baseball field.
       Go back to the Dog and give him commands that let him walk onto the baseball field ready to play!

The first project I posted online was called "Boo!" and it was an experiment with having a wizard broadcast commands and have other characters, and the background, respond to them.  If you'd like to look at the project and the scripts, it's at:
http://scratch.mit.edu/projects/Larry828/11086.

Best of luck having your sprites interact with each other!!

Offline

 

Board footer