Discuss Scratch

phoenix_kyper
Scratcher
4 posts

Receiving Messages

How do I make my sprite show only after my sprite has received two messages?
Nezon
Scratcher
1000+ posts

Receiving Messages

when green flag clicked
set [foo v] to [0]

when I receive [broadcast 1 v]
change [foo v] by (1)

when I receive [broadcast 2 v]
change [foo v] by (1)

when green flag clicked
forever
if <(foo) = [2]> then
show
else
hide
end
end

This is my signature (it goes automatically under every post I make)! Here is a bit of advice on foruming, by the way. Don't do SAND. SAND means four words.
SAND means Spam, Advertising, Necroposting, and Derailing.
Spam is when a irrelevant message is sent to many places. Wiki Article: Spam
Advertising is when you promote your studios and projects. Wiki Article: Advertising
Necroposting is when you post on a old topic. It distracts other helpers! Wiki Article: Necroposting
Derailing is when you post something that is irrelevant to the topic, like minimodding. It is called thread hijacking. Wiki Article: Derailing(Derailing idea comes from this guy),
in the process of leaving scratch.
bob has been hidden again :(

Theo_1er
Scratcher
500+ posts

Receiving Messages

This way it will shows even if it's receive twice same broadcast. Maybe
when I receive [broadcast 1 v]
if <((foo) mod (2)) = [0]> then
change [foo v] by (1)
end

when I receive [broadcast 2 v]
if <(foo) < [2]> then
change [foo v] by (2)
end

when green flag clicked
forever
if <(foo) = [3]> then
show
else
hide
end
end

Last edited by Theo_1er (April 18, 2021 15:44:16)


Quand le risque est ridicule, la récompense est ridicule.
phoenix_kyper
Scratcher
4 posts

Receiving Messages

Thank you! It worked

Powered by DjangoBB