Discuss Scratch

BrodoIsAYai
New to Scratch
2 posts

How do I have a sprite Clicked, Broadcast a message, and When it's clicked after the message, It'll broadcast a new One?

when this sprite clicked
broadcast [ PLAYERTWO]
when this sprite clicked
broadcast [ GAMESTART]
My Dad says It's Only One thing Done, But can I get it to have Both?
BrodoIsAYai
New to Scratch
2 posts

How do I have a sprite Clicked, Broadcast a message, and When it's clicked after the message, It'll broadcast a new One?

Help Please!
LuckyLucky7
Scratcher
1000+ posts

How do I have a sprite Clicked, Broadcast a message, and When it's clicked after the message, It'll broadcast a new One?

Yes, both messages will be done at the same time unless you put a block like this:
broadcast [ v] and wait

I have about 3450 posts, 90 shared projects, 180 total created/followed topics, and 425 followers.

Wahsp
Scratcher
1000+ posts

How do I have a sprite Clicked, Broadcast a message, and When it's clicked after the message, It'll broadcast a new One?

when this sprite clicked
broadcast [... v]
wait (.1) secs
wait until <<touching [mouse pointer v]> and <mouse down>>
broadcast [... v]

​I am Wahsp
______________________________________________________

Formerly pretty active on the forums, probably mostly retired now…
If you see one of my posts send me a hello!
______________________________________________________
TheRealNetherBefore
Scratcher
1000+ posts

How do I have a sprite Clicked, Broadcast a message, and When it's clicked after the message, It'll broadcast a new One?

Or you could do this:
when green flag clicked
set [broadcast v] to [1]
when this sprite clicked
if <(broadcast) = [1]> then
broadcast [thing1 v]
change [broadcast v] by (1)
else
broadcast [thing2 v]
end

*Drinks ketchup*
there is no ethical consumption under capitalism my dudes
Small Games | Tips and Advice | Boredom Cat | Misc
Want to make a fantasy world everyone on scratch can use? Click here!
G'thorpax the Unspoken
-ShadowOfThePast-
Scratcher
100+ posts

How do I have a sprite Clicked, Broadcast a message, and When it's clicked after the message, It'll broadcast a new One?

TheRealNetherBefore wrote:

<snip>

Wahsp wrote:

<snip>
This would also work…

when gf clicked
wait until <<touching [mouse-pointer v]?> and <mouse down?>>
broadcast [message1 v]
wait until <not <<touching [mouse-pointer v]?> and <mouse down?>>>
wait until <<touching [mouse-pointer v]?> and <mouse down?>>
broadcast [message2 v]
wait until <not <<touching [mouse-pointer v]?> and <mouse down?>>>
...










Hello.
mystery4000
Scratcher
100+ posts

How do I have a sprite Clicked, Broadcast a message, and When it's clicked after the message, It'll broadcast a new One?

TheRealNetherBefore wrote:

Or you could do this:
when green flag clicked
set [broadcast v] to [1]
when this sprite clicked
if <(broadcast) = [1]> then
broadcast [thing1 v]
change [broadcast v] by (1)
else
broadcast [thing2 v]
end
Good example.

Wahsp wrote:

when this sprite clicked
broadcast [... v]
wait (.1) secs
wait until <<touching [mouse pointer v]> and <mouse down>>
broadcast [... v]
But wouldn’t this cause the:
when this sprite clicked
To activate twice?
LuckyLucky7
Scratcher
1000+ posts

How do I have a sprite Clicked, Broadcast a message, and When it's clicked after the message, It'll broadcast a new One?

mystery4000 wrote:

Wahsp wrote:

when this sprite clicked
broadcast [... v]
wait (.1) secs
wait until <<touching [mouse pointer v]> and <mouse down?>>
broadcast [... v]
But wouldn’t this cause the:
when this sprite clicked
To activate twice?
Yes, which would cause the 2nd broadcast block to never execute, and therefore that script would be going in an infinite loop.

I have about 3450 posts, 90 shared projects, 180 total created/followed topics, and 425 followers.

Powered by DjangoBB