Discuss Scratch
- Discussion Forums
- » Suggestions
- » Sending broadcasts to clones or masters.
- fun19567
- Scratcher
57 posts
Sending broadcasts to clones or masters.
when I receive [ v] and [ v]
broadcast [ v] to [ v]
Suggestions for blocks, second input in when I receive is to select sprites, clones or masters.
Hi I'm a fellow Scratcher who loves history!
Please follow me!
And Check out RPG Stoneborn here : https://scratch.mit.edu/projects/680492862/
Thanks
- cs3868895
- Scratcher
1000+ posts
Sending broadcasts to clones or masters.
This may take me…delete all of [who's receiving sing along v] :: list
add [Dee] to [who's receiving sing along v]
create clone of [ sprite v]
add [Devin] to [who's receiving sing along v]
create clone of [ sprite v]
add [Sam] to [who's receiving sing along v]
create clone of [ sprite v]
add [Scratch Cat] to [who's receiving sing along v]
create clone of [ sprite v]
broadcast [sing along v]
when I start as a clone
if <[who's receiving sing along v] contains [Scratch Cat]> then
set [pitch v] effect to (0) :: sound
repeat (3)
play sound [Meow v] until done
change [pitch v] effect by (20) :: sound
end
Forever to make code blocks
But I did make an edited version of a workaround it might work idk-
Fish more ideas
I'm Fishy a cis bi female.
sorry, but as of currently, I'm moving platforms, I can't handle the drama.
I'm Fishy a cis bi female.
sorry, but as of currently, I'm moving platforms, I can't handle the drama.
- fun19567
- Scratcher
57 posts
Sending broadcasts to clones or masters.
(#2)This may take me…delete all of [who's receiving sing along v] :: list
add [Dee] to [who's receiving sing along v]
create clone of [ sprite v]
add [Devin] to [who's receiving sing along v]
create clone of [ sprite v]
add [Sam] to [who's receiving sing along v]
create clone of [ sprite v]
add [Scratch Cat] to [who's receiving sing along v]
create clone of [ sprite v]
broadcast [sing along v]
when I start as a clone
if <[who's receiving sing along v] contains [Scratch Cat]> then
set [pitch v] effect to (0) :: sound
repeat (3)
play sound [Meow v] until done
change [pitch v] effect by (20) :: sound
end
Forever to make code blocks
But I did make an edited version of a workaround it might work idk-
HUH, this is out of place?
Hi I'm a fellow Scratcher who loves history!
Please follow me!
And Check out RPG Stoneborn here : https://scratch.mit.edu/projects/680492862/
Thanks
- cs3868895
- Scratcher
1000+ posts
Sending broadcasts to clones or masters.
✽ broadcast message1 to only sprite1I'm sorry (,: if you want the full workaround quote here you go-
Method 1: broadcast to one sprite (thanks, @yavuz61035!)
Set a variable to the name of the sprite you want to respond. Broadcasts are always received by every sprite, so every place where you use “when I receive” with that message, check if the variable matches the name of that sprite:ask [Who's going to dance next?] and waitIt's generally best if you use a different variable for each “targeted” broadcast. That way, if you broadcast two or more different messages at the same time, you'll make sure each message gets where it's going!
set [who's receiving do a cool dance v] to (answer)
broadcast [do a cool dance v] and wait
play sound [Hooray! v] until done
when I receive [do a cool dance v] // in Gobo's code
if <(who's receiving do a cool dance) = [Gobo]> then
point in direction (45 v)
repeat (4)
repeat (10)
move (10) steps
end
turn cw (90) degrees
end
end
when I receive [do a cool dance v] // in Tera's code
if <(who's receiving do a cool dance) = [Tera]> then
set rotation style [left-right v]
repeat (5)
point in direction (90 v)
glide (1) secs to x: (50) y: (100)
point in direction (-90 v)
glide (1) secs to x: (50) y: (-50)
end
end
Method 2: broadcast to 2+ specific sprites at the same time
It's not possible to broadcast one message twice in the same Scratch frame—it'll just be received once. So if you want to broadcast to two specific sprites, you'll have to use a list:delete all of [who's receiving sing along v] :: listMethod 3: without stopping/restarting broadcasts
add [Dee] to [who's receiving sing along v]
add [Devin] to [who's receiving sing along v]
add [Sam] to [who's receiving sing along v]
add [Scratch Cat] to [who's receiving sing along v]
broadcast [sing along v]
when I receive [sing along v]
if <[who's receiving sing along v] contains [Scratch Cat]> then
set [pitch v] effect to (0) :: sound
repeat (3)
play sound [Meow v] until done
change [pitch v] effect by (20) :: sound
end
end
Keep in mind that if you broadcast something which sprites are already responding to right now, Scratch will interrupt and restart all the “when I receive” scripts with the same message. If you want to make sure the sprites who already started keep going after you broadcast the message again (maybe to another sprite), you can use a variable and the “wait until” or “forever…if” blocks.when I receive [join the team v]
if <(who's joining the team) = [Pico]> then
set [part of the team v] to [true] // local variable, "for this sprite only"
end
when green flag clicked
set [part of the team v] to [false]
wait until <(part of the team) = [true]>
forever
... follow the leader ... :: grey
end
Fish more ideas
I'm Fishy a cis bi female.
sorry, but as of currently, I'm moving platforms, I can't handle the drama.
I'm Fishy a cis bi female.
sorry, but as of currently, I'm moving platforms, I can't handle the drama.
- fun19567
- Scratcher
57 posts
Sending broadcasts to clones or masters.
Thanks a lot! I'll be needing this for my upcoming biggest project!
Hi I'm a fellow Scratcher who loves history!
Please follow me!
And Check out RPG Stoneborn here : https://scratch.mit.edu/projects/680492862/
Thanks
- Discussion Forums
- » Suggestions
- » Sending broadcasts to clones or masters.