Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Why are my blocks always start with "define"
- MaceRobin112
-
Scratcher
24 posts
Why are my blocks always start with "define"
I'm creating a game that uses user-generated blocks. But whenever I create my own block it always starts with “define”.
It looks like this:
How do I make this work?
Edit:It's on the forum list of blocks.So it must be intentional…
It looks like this:
define (if this sprite was clicked on)
How do I make this work?
Edit:It's on the forum list of blocks.So it must be intentional…
Last edited by MaceRobin112 (Dec. 22, 2025 22:25:53)
- The_Cool_Test_Alt
-
Scratcher
100+ posts
Why are my blocks always start with "define"
Under the define block, you must define your block.
Like this:
Then, you can scroll down to the “my blocks” section of the block palette, drag out the block, and use it!
Like this:
define bounce
change y by [10]
change size by [10]
wait [0.5] seconds
change y by [-10]
change size by [-10]
Then, you can scroll down to the “my blocks” section of the block palette, drag out the block, and use it!
Last edited by The_Cool_Test_Alt (Dec. 22, 2025 22:51:59)
- MaceRobin112
-
Scratcher
24 posts
Why are my blocks always start with "define"
Under the define block, you must define your block.Oh,so that's why it was already working when I pressed on the block.
Like this:define bounce
change y by [10]
change size by [10]
wait [0.5] seconds
change y by [-10]
change size by [-10]
Then, you can scroll down to the “my blocks” section of the block palette, drag out the block, and use it!
- nourramymohamed
-
Scratcher
3 posts
Why are my blocks always start with "define"
The reason is simple.
If you create a new block, a
For example,
So, based on my example, every time you use:
If you create a new block, a
define example block (apple)will appear. Under it, you must put the code that this block means.
For example,
define example block (apple)Then, every time you use that block in your code, Scratch runs the code that the block is supposed to do.
turn cw ((apple) * (2)) degrees
say (join (join [Yummy! I've eaten] (apple)) [apples today!]) for (2) secs
So, based on my example, every time you use:
example block (apple::custom) :: customit runs the code:
turn cw ((apple::custom) * (2)) degrees
say (join (join [Yummy! I've eaten] (apple::custom)) [apples today!]) for (2) secs
- Discussion Forums
- » Help with Scripts
-
» Why are my blocks always start with "define"