Discuss Scratch

Beamy68
Scratcher
100+ posts

Workarounds to frequently suggested blocks

kittydude23 wrote:

snow
to recreate:
Step 1: make a sprite that looks like a snowflake.
Step 1 and a half: go into the snowflake's code
Step 2:
when green flag clicked
forever
create clone of [myself v]
wait (2) secs
end
Step 3:
when I start as a clone
go to x: (pick random (0) to (200)) y: (200)
step 4:
when green flag clicked
repeat until <(y position) = [0]>
change y by (-2)
end
delete this clone
No need for it to be a snowflake, it could snow scratch cats!

Post Goal:


Motion::motion
Looks::looks
Sound::sound
Pen::pen
Events::events
Control::control
Sensing::sensing
Operators::operators
Variables::variables
List::list
More Blocks::custom
bemy
my_pup4life
Scratcher
16 posts

Workarounds to frequently suggested blocks

is there a workaround for this:
set speed to (...):: sound

GO CANUCKS GO!::#00205B
Hopeijay
Scratcher
90 posts

Workarounds to frequently suggested blocks

my_pup4life wrote:

is there a workaround for this:
set speed to (...):: sound

What do you want this block to do to what?

If you are talking about setting the speed of the sprite, this may help:

set speed to (...):: #7238a8
define set speed to (speed)
forever
move (speed) steps
end


Have your hands not been washed in the last 5 hours? CALL 1-800-GOTOTHESINKANDWASHYOURHANDS now, to keep COVID-19 away! That's 1-800-GOTOTHESINKANDWASHYOURHANDS Thank you!
WindOctahedron
Scratcher
1000+ posts

Workarounds to frequently suggested blocks

Hopeijay wrote:

my_pup4life wrote:

is there a workaround for this:
set speed to (...):: sound

What do you want this block to do to what?

If you are talking about setting the speed of the sprite, this may help:

-snip-
Can't you see that it's a sound block?

The message above may contain wrong information, rude remarks, or something embarrassing to my current self. In this case, please ignore it and remember that I likely wrote it back when I didn't know what “respect” truly meant. I really hate thinking about it again.
kittiesrule247
Scratcher
100+ posts

Workarounds to frequently suggested blocks

WindOctahedron wrote:

Hopeijay wrote:

my_pup4life wrote:

is there a workaround for this:
set speed to (...):: sound

What do you want this block to do to what?

If you are talking about setting the speed of the sprite, this may help:

-snip-
Can't you see that it's a sound block?
No . . . It's not that obvious. Speed doesn't usually mean speed of sound, and please don't be rude.

LGBTQIAPNDO+ PRIDE
cheesyfriedeggs
Scratcher
1000+ posts

Workarounds to frequently suggested blocks

kittiesrule247 wrote:

WindOctahedron wrote:

Hopeijay wrote:

my_pup4life wrote:

is there a workaround for this:
set speed to (...):: sound

What do you want this block to do to what?

If you are talking about setting the speed of the sprite, this may help:

-snip-
Can't you see that it's a sound block?
No . . . It's not that obvious. Speed doesn't usually mean speed of sound, and please don't be rude.
She's not being rude.
Beamy68
Scratcher
100+ posts

Workarounds to frequently suggested blocks

kittiesrule247 wrote:

WindOctahedron wrote:

Hopeijay wrote:

my_pup4life wrote:

is there a workaround for this:
set speed to (...):: sound

What do you want this block to do to what?

If you are talking about setting the speed of the sprite, this may help:

-snip-
Can't you see that it's a sound block?
No . . . It's not that obvious. Speed doesn't usually mean speed of sound, and please don't be rude.
That wasn't rude

Post Goal:


Motion::motion
Looks::looks
Sound::sound
Pen::pen
Events::events
Control::control
Sensing::sensing
Operators::operators
Variables::variables
List::list
More Blocks::custom
bemy
my_pup4life
Scratcher
16 posts

Workarounds to frequently suggested blocks

123scratcher4321 wrote:

how about this


(volume of music)
that would be:
(volume)
I think
otherwise, the
(volume)
block is the input volume (mic)

Last edited by my_pup4life (Nov. 11, 2019 23:51:39)


GO CANUCKS GO!::#00205B
my_pup4life
Scratcher
16 posts

Workarounds to frequently suggested blocks

Hopeijay wrote:

my_pup4life wrote:

is there a workaround for this:
set speed to (...):: sound

What do you want this block to do to what?

If you are talking about setting the speed of the sprite, this may help:

set speed to (...):: #7238a8
define set speed to (speed)
forever
move (speed) steps
end
I made it a sound block for a reason, its supposed to be the speed of the sound without the pitch changing

GO CANUCKS GO!::#00205B
my_pup4life
Scratcher
16 posts

Workarounds to frequently suggested blocks

kittydude23 wrote:

snow
to recreate:
Step 1: make a sprite that looks like a snowflake.
Step 1 and a half: go into the snowflake's code
Step 2:
when green flag clicked
forever
create clone of [myself v]
wait (2) secs
end
Step 3:
when I start as a clone
go to x: (pick random (0) to (200)) y: (200)
step 4:
when green flag clicked
repeat until <(y position) = [0]>
change y by (-2)
end
delete this clone
for me the sprites just stay floating at the top of the screen

GO CANUCKS GO!::#00205B
my_pup4life
Scratcher
16 posts

Workarounds to frequently suggested blocks

cheesyfriedeggs wrote:

kittiesrule247 wrote:

WindOctahedron wrote:

Hopeijay wrote:

my_pup4life wrote:

is there a workaround for this:
set speed to (...):: sound

What do you want this block to do to what?

If you are talking about setting the speed of the sprite, this may help:

-snip-
Can't you see that it's a sound block?
No . . . It's not that obvious. Speed doesn't usually mean speed of sound, and please don't be rude.
She's not being rude.
I agree!

GO CANUCKS GO!::#00205B
DoritostasteGood
Scratcher
22 posts

Workarounds to frequently suggested blocks

Computer_Fizz wrote:

Motion :: motion hat
move up ( number ) steps :: motion
can be recreated with the following code:
set [direction v] to ( direction )
point in direction ( 0 v)
move ( number ) steps
point in direction ( direction :: variables )
———————————————————–
point towards x: ( WantedX ) y: ( WantedY ) :: motion
can be recreated by moving a sprite to that x and y then pointing toward that sprite. it can also be recreated with the following (more complicated) code:
set [deltax v] to ( ( WantedX ) - ( x position ) )
set [deltay v] to ( ( WantedY ) - ( y position ) )
if <not < ( deltay ) = ( 0 )> > then
if < ( deltay ) > ( 0 ) > then
point in direction ( [atan v] of ( ( deltax ) / ( deltay ) )
else
point in direction ( ([atan v] of ( ( deltax ) / ( deltay ) ) ) + (180) )
end
else
if ( ( deltax ) > ( 0 ) ) then
point in direction ( 90 )
else
point in direction ( -90 )
end

That would be complicated, though.
my_pup4life
Scratcher
16 posts

Workarounds to frequently suggested blocks

DoritostasteGood wrote:

Computer_Fizz wrote:

Motion :: motion hat
move up ( number ) steps :: motion
can be recreated with the following code:
set [direction v] to ( direction )
point in direction ( 0 v)
move ( number ) steps
point in direction ( direction :: variables )
———————————————————–
point towards x: ( WantedX ) y: ( WantedY ) :: motion
can be recreated by moving a sprite to that x and y then pointing toward that sprite. it can also be recreated with the following (more complicated) code:
set [deltax v] to ( ( WantedX ) - ( x position ) )
set [deltay v] to ( ( WantedY ) - ( y position ) )
if <not < ( deltay ) = ( 0 )> > then
if < ( deltay ) > ( 0 ) > then
point in direction ( [atan v] of ( ( deltax ) / ( deltay ) )
else
point in direction ( ([atan v] of ( ( deltax ) / ( deltay ) ) ) + (180) )
end
else
if ( ( deltax ) > ( 0 ) ) then
point in direction ( 90 )
else
point in direction ( -90 )
end

That would be complicated, though.
but @ComputerFizz already said its complicated

Last edited by my_pup4life (Nov. 12, 2019 01:11:13)


GO CANUCKS GO!::#00205B
PixelYoshi
Scratcher
100+ posts

Workarounds to frequently suggested blocks

my_pup4life wrote:

Hopeijay wrote:

my_pup4life wrote:

is there a workaround for this:
set speed to (...):: sound

What do you want this block to do to what?

If you are talking about setting the speed of the sprite, this may help:

set speed to (...):: #7238a8
define set speed to (speed)
forever
move (speed) steps
end
I made it a sound block for a reason, its supposed to be the speed of the sound without the pitch changing
i don't think you can change the speed of a sound without the pitch changing. i think thats just how it works. i'm not sure though.
venyanwarrior
Scratcher
1000+ posts

Workarounds to frequently suggested blocks

Beamy68 wrote:

venyanwarrior wrote:

Beamy68 wrote:

WindOctahedron wrote:

Beamy68 wrote:

mica43683 wrote:

-snip-
Yes, but it depends on what type of block you're using. If you have a project with 1000
wait (1) secs
blocks, then it'll take up way less RAM than this:
when green flag clicked
create clone of [myself v]

when I start as a clone
create clone of [myself v]
delete this clone

That actually crashes the editor, so less blocks don't always mean it's faster, it depends on the type of blocks you're using.

It doesn't crash the editor
Actually, it does. https://scratch.mit.edu/projects/161875695/

Last edited by venyanwarrior (Nov. 12, 2019 23:20:55)


If you're seeing this signature, that means I've come out of my social anxiety hole.

Also, I edit the Scratch Wiki. Check it out sometime it's cool I guess.
mica43683
Scratcher
500+ posts

Workarounds to frequently suggested blocks

Oh, I just thought about this:
when [timer v] > (0)
if <...> then
...
wait until <not <...>>
end

I got a lot of compliments on my last signature, and I think that's kind of strange. I wrote it when I was 12 and it wasn't very good. I acted like PS4 controllers were the epitome of human technology, for God's sake! I tried too hard to be philosophical, or maybe I tried too hard to be funny, or maybe it was something else. But that signature was bad. It wasn't good. It might be strange for some of you to hear this, seeing as this site is full of kids, but 12-year-old me was practically a baby. I think that's something you realise when you grow up. That you're always better than you were last year. I was looking through old Skype messages between me and a friend of mine from when we were 12, and as I read them, I couldn't stop thinking, “Woah. I was the worst.” It's important to know that you're always the worst. I can almost guarantee that future you is thinking negatively of you right now, just as future me is thinking negatively of me. It's important not to let that get to you. Remember to stay in the present. Tomorrow hates you, but it can't hurt you because you'll never get to tomorrow. When I was 10 or 11, I remember seeing the world very cynically. I thought that human life was inherently selfish, and that we were only put on this planet to destroy it. I'm so glad 10 or 11 year old me is gone, because 17 year old me would NOT get along with that kid.
CalculatorFun
Scratcher
94 posts

Workarounds to frequently suggested blocks

my_pup4life wrote:

is there a workaround for this:
set speed to (...):: sound
This reminds me of a workaround to linearly control the playback speed for sounds, so here's mine (with pitch change)

My workaround with explanation:
Every 120 (twelve semitones or one octave) units up the pitch/speed increases 2*
(This is a exponential rate of change, so our answer is likely going to have a log function if we want to use this function in a “linear” way)

x = Scratch Input
S = Speed that we want to control (Scratch's output) (e.g.: 2 times speed)

1] S = 2^(x/120) || transcribe our formula, this is how the normal speed is calculated.
2] log₂(S) = log₂(2^x/120) || We get the log base 2 to cancel out the 2^n and bring n down.
3] log₂(S) = x/120 || Now get log base 2 to cancel the 2^n.
4] 120 * log₂(S) = x || Divide by 120 and we're done isolating x! (But now we have to write log₂ in terms of log or ln)
5] 120 * log(S)/log(2) = x || Using change of base rule we have completed the final step.

Now write it in Scratch blocks
set [speed v] effect to ((120) * (([log v] of (Rate)) / ([log v] of (2)))):: sound
now we can evaluate it and rewrite:: control
set [speed v] effect to ((398.6313713864836)*([log v] of (Rate))):: sound

Last edited by CalculatorFun (Nov. 14, 2019 03:21:41)


max_mcnamee
Scratcher
6 posts

Workarounds to frequently suggested blocks

Computer_Fizz wrote:

Sensing :: sensing hat
< am i a clone ? :: sensing>
can be recreated with the following code:
when @greenFlag clicked
set [am i a clone? v] to [false] // this variable must be "for this sprite only"
when I start as a clone
set [am i a clone? v] to [true]

if < ( am i a clone? ) = [true] > then
...
———————————————————–
< key [enter v] pressed? >
can be recreated with the following code:
< key ( join [enter] [] ) pressed? >
// this also goes for other keys not on the drop-down as well

if ( am i a clone? ) then

Last edited by max_mcnamee (Nov. 15, 2019 01:43:24)


when <your web browser is on [scratch.mit.edu]?:: sensing>:: events
forever{
imagine:: events
program:: motion
share:: sound
}:: control loop
Computer_Fizz
Scratcher
100+ posts

Workarounds to frequently suggested blocks

max_mcnamee wrote:

if ( am i a clone? ) then

You can't put reporter variables inside if blocks like that. You have to use [] = true

Last edited by Computer_Fizz (Nov. 16, 2019 01:17:06)

Lukesstitch
Scratcher
100+ posts

Workarounds to frequently suggested blocks

Thanks for the information!

Powered by DjangoBB