Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How do I code to have more than one sprite "say something?"
- Tarhookie
-
5 posts
How do I code to have more than one sprite "say something?"
So far only my first sprite is “talking” in my script. When I add more text for other sprites to say, only the first sprite “says” the added text.
- Scratch-Minion
-
1000+ posts
How do I code to have more than one sprite "say something?"
Whichever sprite you use the “say” block in actually says the text.
You must write say blocks in other sprites for them to speak.
You can use the broadcast block to transfer project control to these other sprites.
eg. Inside Sprite1:
Inside Sprite2:
You must write say blocks in other sprites for them to speak.
You can use the broadcast block to transfer project control to these other sprites.
eg. Inside Sprite1:
broadcast [Sprite2 to say hello v] and wait
Inside Sprite2:
when I receive [Sprite2 to say hello v]
say [Hello] for (2) secs
- Tarhookie
-
5 posts
How do I code to have more than one sprite "say something?"
Apparently I don't understand how to get “Inside a sprite.”I've tried the example you gave but can't transfer control from one sprite to another. I assume the first sprite you put on the stage is sprite 1. I want sprite 1 to say “hello” and sprite 2 to say “hi how are you” in reply to sprite 1.
If my 14 year old grandson lived nearby I'm sure he could figure this out in 30 seconds.
Many thanks!
If my 14 year old grandson lived nearby I'm sure he could figure this out in 30 seconds.
Many thanks!
Last edited by Tarhookie (May 26, 2017 02:13:43)
- footsocktoe
-
1000+ posts
How do I code to have more than one sprite "say something?"
Apparently I don't understand how to get “Inside a sprite.”I've tried the example you gave but can't transfer control from one sprite to another. I assume the first sprite you put on the stage is sprite 1. I want sprite 1 to say “hello” and sprite 2 to say “hi how are you” in reply to sprite 1.
If my 14 year old grandson lived nearby I'm sure he could figure this out in 30 seconds.
Many thanks!
In sprite 1's script…
when green flag clicked
say [Hello] for (2) secs
broadcast [say hi now v]
In sprite 2's script
when I receive [say hi now v]
say [Hi! How are you?] for (2) secs
- Scratch-Minion
-
1000+ posts
How do I code to have more than one sprite "say something?"
Apparently I don't understand how to get “Inside a sprite.”I've tried the example you gave but can't transfer control from one sprite to another. I assume the first sprite you put on the stage is sprite 1. I want sprite 1 to say “hello” and sprite 2 to say “hi how are you” in reply to sprite 1.
If my 14 year old grandson lived nearby I'm sure he could figure this out in 30 seconds.
Many thanks!
Below the stage are little square icons for each sprite. Click on these to change between sprites.
- Tarhookie
-
5 posts
How do I code to have more than one sprite "say something?"
I tried setting up the script exactly as you have it.
Steps I followed
-put first sprite on the stage
-I then entered Sprite 1's script
-I then put Sprite 2 on the state
-I then entered sprite 2's script
When I clicked on the green flag only sprite 1 spoke “Hello” then “Hi! How are you?
Apparently I'm omitting a step in the transfer to sprite 2.
Thanks for your patience. We have a saying in our family ”I'm too stupid to understand."
Steps I followed
-put first sprite on the stage
-I then entered Sprite 1's script
-I then put Sprite 2 on the state
-I then entered sprite 2's script
When I clicked on the green flag only sprite 1 spoke “Hello” then “Hi! How are you?
Apparently I'm omitting a step in the transfer to sprite 2.
Thanks for your patience. We have a saying in our family ”I'm too stupid to understand."
- footsocktoe
-
1000+ posts
How do I code to have more than one sprite "say something?"
OK, first of all, let's get clear what sprites are…
It might help to picture Scratch working like this…
Think of a stack of sheets of clear plastic. There are pictures drawn on the plastic sheets.
The bottom sheet cannot be resized or moved and always is on SHOW. That's the backdrop.
The sheets above the backdrop are sprites. They can be moved, resized, and set to SHOW or HIDE.
So sprites are always on the stage. You just have to turn them on and off with the HIDE and SHOW controls.
And of course, the sprites have sounds and scripts as well as costumes (costumes are just alternate images for the sprite).
You select a sprite by clicking on it's icon in the left panel of the editor, the sprite panel.
What you see in the right panel depends on which tab you select: sounds, costumes, or scripts.
Armed with this knowledge, look again at your project. Make sure sprite 1 has a costume and sprite 2 has a costume. Make sure sprite 1 has a script and sprite 2 has a script.
Post again if you still don't get it.
It might help to picture Scratch working like this…
Think of a stack of sheets of clear plastic. There are pictures drawn on the plastic sheets.
The bottom sheet cannot be resized or moved and always is on SHOW. That's the backdrop.
The sheets above the backdrop are sprites. They can be moved, resized, and set to SHOW or HIDE.
So sprites are always on the stage. You just have to turn them on and off with the HIDE and SHOW controls.
And of course, the sprites have sounds and scripts as well as costumes (costumes are just alternate images for the sprite).
You select a sprite by clicking on it's icon in the left panel of the editor, the sprite panel.
What you see in the right panel depends on which tab you select: sounds, costumes, or scripts.
Armed with this knowledge, look again at your project. Make sure sprite 1 has a costume and sprite 2 has a costume. Make sure sprite 1 has a script and sprite 2 has a script.
Post again if you still don't get it.
- Tarhookie
-
5 posts
How do I code to have more than one sprite "say something?"
Thanks I'll try this when I get home from a trip!
- Tarhookie
-
5 posts
How do I code to have more than one sprite "say something?"
Thanks footsocktoe!
FINALLY I understand. Just shared the project. Need to add some layers as I have time.
Tarhookie
FINALLY I understand. Just shared the project. Need to add some layers as I have time.
Tarhookie
- HollyTheKitten
-
7 posts
How do I code to have more than one sprite "say something?"
I'm going to try what Scratch-Minion said.
- HollyTheKitten
-
7 posts
How do I code to have more than one sprite "say something?"
Oh wait, and I was looking for an answer to how to make 1 sprite say four different scripts after different events.
- Vibrato
-
1000+ posts
How do I code to have more than one sprite "say something?"
Please don't necropost, this topic is from 2017 I'm going to try what Scratch-Minion said.
- Discussion Forums
- » Help with Scripts
-
» How do I code to have more than one sprite "say something?"