Discuss Scratch

mcclearyd933
Scratcher
5 posts

how do i define a block?

how do i define a block?
CoolGrl197
Scratcher
21 posts

how do i define a block?

mcclearyd933 wrote:

how do i define a block?

Easy! To define a block, just do this:

SAMPLE BLOCK:

when this sprite clicked
WALK

DEFINE WALK
glide (1) secs to x: (120) y: (180)

In defining a block, use the desinged-by-scratch blocks and put them under the define block. So here, when a certain sprite is clicked, it will WALK(walk being the custome block), thus, doing what the define block says. Understand? Do you have any questions about inputs like strings and numbers? If so, ask me! I'm not very good with booleans though…

Take this for example:

when I receive [scratch.mit.edu v]
forever
imagine
program
share
end

define imagine
set [Ideas v] to [INFINITY]

define program
set [YOUR AMAZING ABILITYS v] to [INFINITY]

define share
set [YOUR AWESOMENESS v] to [INFINITY]

for example, you are that sprite. When scratch.mit.edu is roadcasted, you will imagine, program, and share. When you imagine, you set ideas to infinity. When you program, you set your amazing ability to infinity. When you share, you set your awesomness to infinity. So, the definition blocks tell that block what to do. To define a block, basically, put designed-by-scratch blocks into it. For example, if you want a sprite to talk when the green flag is clicked, make a block called talk. Then in define talk, put what you want it to do. If you want it to say hello, put say hello! for () seconds under define talk. Get it?
mcclearyd933
Scratcher
5 posts

how do i define a block?

huh???
blob8108
Scratcher
1000+ posts

how do i define a block?

Click “Make a Block” in the “More Blocks” palette.

CoolGrl197
Scratcher
21 posts

how do i define a block?

mcclearyd933 wrote:

huh???

Dont understand? To define a block, put blocks into it that show what the block will do. like this:

define WALK
point in direction (90 v)
move (10) steps

Thats a block definition. You can only use blocks made by scratch to define a block. If you want the sprite to say something, define a block like this:
define TALK
say [(something)] for (2) secs

Basically, just define a block by putting blocks under it, what you want it to do.

forever
imagine
program
share
end
tobyceci
Scratcher
2 posts

how do i define a block?

I want to add a “and” to how do I do that?
<<> and <>>
<touching [ v]?>
<mouse down?>

Last edited by tobyceci (June 13, 2014 16:13:23)

typemaster
Scratcher
100+ posts

how do i define a block?

tobyceci wrote:

I want to add a “and” to how do I do that?
<<> and <>>
<touching [ v]?>
<mouse down?>

LOL
<<touching [ v]?>> and <<mouse down?>

Last edited by typemaster (June 13, 2014 18:15:25)

RandomPerson1789
Scratcher
100+ posts

how do i define a block?

U can also do blocks with input such as these:
define Hi (Number)
move (Number) steps
Hope this helped!

Last edited by RandomPerson1789 (June 13, 2014 22:27:37)

gwgw99
Scratcher
41 posts

how do i define a block?

making a block is simple. whatever i put under the define block, happens when I use the block I made.
(join [i hope] [this helped!!!])
typemaster
Scratcher
100+ posts

how do i define a block?

You can make blocks like this:
define walk
glide (1) secs to x: (0) y: (0)

//trigger here
walk
Or, you could also make blocks with inputs:
define setLoc (number) (number2)
go to x: (number) y: (number2)

//trigger here
setLoc (0) (0)
08draven
Scratcher
69 posts

how do i define a block?

gwgw99 wrote:

making a block is simple. whatever i put under the define block, happens when I use the block I made.
(join [i hope] [this helped!!!])


when green flag clicked
scratch 2.0 website


define scratch 2.0 website
get you to the website

Last edited by 08draven (July 24, 2014 04:52:57)

08draven
Scratcher
69 posts

how do i define a block?


Dont understand? To define a block, put blocks into it that show what the block will do. like this:

define WALK
point in direction (90 v)
move (10) steps

Thats a block definition. You can only use blocks made by scratch to define a block. If you want the sprite to say something, define a block like this:
define TALK
say [(something)] for (2) secs

Basically, just define a block by putting blocks under it, what you want it to do.

forever
scratch
imagine
program
share
scratch 1.0
scratch 1.1
scratch 1.2
scratch 1.3
scratch 1.4
scratch 2.0
end

[

Last edited by 08draven (July 24, 2014 05:00:13)

pandaboy74
New Scratcher
1 post

how do i define a block?

what if you need to put in a starting block in
define 
when [ v] key pressed
when [v v] key pressed
define
when [ v] key pressed
when [







v] key pressed
ED3628
Scratcher
1 post

how do i define a block?

How would I define changing languages?:/
deck26
Scratcher
1000+ posts

how do i define a block?

ED3628 wrote:

How would I define changing languages?:/
Please create your own topic rather than necroposting.
MINECRAFTGAMER2111
Scratcher
100+ posts

how do i define a block?

Using “More Blocks” can also define sprites.
when green flag clicked
(Name)

define Name
move (10) steps
Teddy_Bear3
Scratcher
42 posts

how do i define a block?

This is how:
First when you make a block
Think Hard []
a
define Think Hard [Think]
will appear. You can then use it like this:
define Think Hard [Think]
repeat (3)
think [fwd] for (.01) secs
think [GCC] for (.01) secs
think [bf] for (.01) secs
think [gs] for (.01) secs
end
think [!] for (.) secs
think (Think) for ((length of (Think)) / (2)) secs

Note: the block will use the inputs given in the code.

Last edited by Teddy_Bear3 (Dec. 15, 2019 15:59:27)

codeyeeter
New Scratcher
1 post

how do i define a block?

how can i define -if sprite 1 and sprite 2 use gravity (gravity = -1) gravity stays the same?-

deck26
Scratcher
1000+ posts

how do i define a block?

codeyeeter wrote:

how can i define -if sprite 1 and sprite 2 use gravity (gravity = -1) gravity stays the same?-

You should create your own new topic and share your project so we can better understand your problem.
PlayerXS
Scratcher
80 posts

how do i define a block?

Defining a block is when you place the block, it tells what it means. On the hat block, which is "Define ", you can put scripts under it, and that tells what that block means.
Ex:
When flag clicked
move 7 steps
define move 7 steps
move (7) steps
now, that purple block, “move 7 steps” has a definition. When you use the block, it will move 7 steps, because that's what we put under the
define
block. Get it now?

Powered by DjangoBB