Discuss Scratch
- Discussion Forums
- » Suggestions
- » Should a when () costume number = ()
- Prime689
-
Scratcher
1000+ posts
Should a when () costume number = ()
Please read the topic before posting anything.
Should a when () costume number = () exist? This block is very helpful for using the broadcast unnecessarily.
With this block we can be more organized and not repeat pieces of scripts unnecessarily.
Without this block, scripts will look like this:
See that piece that I was referring to?
This is why we need this block:
Should a when () costume number = () exist? This block is very helpful for using the broadcast unnecessarily.
With this block we can be more organized and not repeat pieces of scripts unnecessarily.
Without this block, scripts will look like this:
when green flag clicked
say [you want to race?] for (2) secs
say [ready] for (0.1) secs
say [set] for (0.1) secs
say [go] for (0.1) secs
switch costume to [run v]
broadcast [I'm using my car! v]
when I receive [I'm using my car! v]
if <winner!> then
say [I won!] for (2) secs
end
See that piece that I was referring to?
switch costume to [run v]We are repeating this piece every time we need to.
broadcast [I'm using my car! v]
This is why we need this block:
when green flag clicked
say [you want to race?] for (2) secs
say [ready] for (0.1) secs
say [set] for (0.1) secs
say [go] for (0.1) secs
switch costume to [run v]
when [racer v] costume number = (2) :: custom hat block
if <winner!> then
say [I won!] for (2) secs
end
Last edited by Prime689 (Nov. 13, 2020 23:31:28)
- DancingNekoGirl
-
Scratcher
1000+ posts
Should a when () costume number = ()
So what I'm seeing is, you're waiting until the car's costume number is 2, right? If so, what's wrong with using this code?
Or this code, if the sprite is different:
wait until <(costume #) = [2]>
Or this code, if the sprite is different:
forever
set [racer costume v] to (costume #)
end
wait until <(racer costume) = [2]>
- Prime689
-
Scratcher
1000+ posts
Should a when () costume number = ()
So what I'm seeing is, you're waiting until the car's costume number is 2, right? If so, what's wrong with using this code?i meant the message hat block.wait until <(costume #) = [2]>
Or this code, if the sprite is different:forever
set [racer costume v] to (costume #)
endwait until <(racer costume) = [2]>
(my projecting is wrong.)
Last edited by Prime689 (Nov. 13, 2020 23:34:38)
- DancingNekoGirl
-
Scratcher
1000+ posts
Should a when () costume number = ()
i meant the message hat block.Oh, okay then. I would still use the code I mentioned, but otherwise this would be a good addition.
(my projecting is wrong.)
- MDCCCLXVII
-
Scratcher
1000+ posts
Should a when () costume number = ()
It would be better to implement this as

instead, alongside

Either way, this is a duplicate, but the former could be workaroundable:


instead, alongside

Either way, this is a duplicate, but the former could be workaroundable:

- Discussion Forums
- » Suggestions
-
» Should a when () costume number = ()