Discuss Scratch

Tornado1013
Scratcher
31 posts

Custom blocks

How do custom blocks work? If you have any info, post it here.

marcominecraft
Scratcher
14 posts

Custom blocks

When you make a custom block, after you click ‘ok’ you will see a block that looks like this:
define [Custom Block]

And what ever you put under there, that is what the block will do

Example:
[scratchblocks]
define [Hello]
say [Hello!]
[/scratchblocks]

Last edited by marcominecraft (May 11, 2021 17:40:00)

Evanzap
Scratcher
100+ posts

Custom blocks

Basically custom blocks are a group of blocks compacted into one block. They can then be used in the same sprite it was created in.

define jump
repeat (10)
change y by (5)
end
repeat (10)
change y by (-5)
end

when [space v] key pressed
jump

The could also be boolean and reporter inputs

define jump (height) pixels
repeat (10)
change y by (height)
end
repeat (10)
change y by ((height) * (-1))
end

when [space v] key pressed
jump (4) pixels


Hi, I'm Evan! I'm not the best at coding.
Fun Fact: most of my usernames are Evanzap.
I play roblox! (User: 1newkidonthegame) I also play both versions of mc! (User: EvanZap)
Shift/Ctrl+Down

I use Scratch because it's fun to make projects. Whenever you get a view thats a real person who saw what you made. Sharing and creating is one of the best things about Scratch. It's hard to remember that each and every project on this platform is made by a real human. Each and every Like, Favorite and even View was done by a real person. Thats why I love Scratch, everyone is really nice to eachother and willing to help people out. (almost) Everything that I've heard people say about my projects were really nice things. Anyways, thanks for coming to my TED Talk.
TheAnomalousPseudo
Scratcher
1000+ posts

Custom blocks

It's known as a function in other coding languages. You basically (temporarily) make a new word (or block, in this case) that does a specific thing. The “change x by #” block is equivalent to point in direction 90/-90 and move # steps, then point back in the original direction. People use custom blocks to make their programs more organized when you have repetitive code.


We ought to be careful with that octopus that takes over the servers. He's well armed.
StampyTheBear
Scratcher
2 posts

Custom blocks

Custom blocks are blocks you can make yourself. They can help with making things easier to do. example: you have multiple sprites that do the same thing, rather then just copying the script over and over again, you can just use the custom block. First you make a custom block and the get the block that says “Define”:
define 
You can get the script and attach it to the block. Then you can take the custom block and use it.
Tornado1013
Scratcher
31 posts

Custom blocks

Thanks everyone for the help! It is greatly appreciated

Powered by DjangoBB