Discuss Scratch

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:
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:

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"

The_Cool_Test_Alt wrote:

Under the define block, you must define your 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!
Oh,so that's why it was already working when I pressed on the block.
nourramymohamed
Scratcher
3 posts

Why are my blocks always start with "define"

The reason is simple.
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)
turn cw ((apple) * (2)) degrees
say (join (join [Yummy! I've eaten] (apple)) [apples today!]) for (2) secs
Then, every time you use that block in your code, Scratch runs the code that the block is supposed to do.
So, based on my example, every time you use:
example block (apple::custom) :: custom
it runs the code:
turn cw ((apple::custom) * (2)) degrees
say (join (join [Yummy! I've eaten] (apple::custom)) [apples today!]) for (2) secs

Powered by DjangoBB