Uploaded by Ashborn

5.2-Categories-of-Blocks (2)

advertisement
CATEGORIES
OF
BLOCKS
OBJECTIVES:
1. Identify the Different
Categories of Blocks and the
shapes used for each
category
2. Familiarize the function of
each block by using it in a
sample program
BLOCKS Categories
1) Events Category
Use to start any
project or program.
1.1) when green flag clicked
Executes the subsequent script when you
press the green flag.
Example:
After you click the green flag, the sprite
moves forward 10 steps
1.2) when ( ) key pressed
Executes the subsequent script when you
press the specified key on the keyboard.
Example:
After you press the space key, the sprite
moves forward 10 steps
1.3) when this sprite clicked
Executes the subsequent script when you
click the sprite.
Example:
After being clicked, the sprite says “Hello”
for 2 seconds.
1.4) when backdrop
switches to ( )
Executes the subsequent script when the
stage backdrop is switched to the specified one.
Example:
When the backdrop is switched to
backdrop1, the sprite plays the sound meow.
1.5) when ( ) > ( )
Executes the subsequent script when the
loudness or timer value is greater than the
specified value.
Example:
When the loudness is greater than 10, the
sprite says “Hello!”
1.6) when I receive ( )
Executes the subsequent script when the
specified message is received.
Example:
When receiving message1, the sprite
moves forward 10 steps.
1.7) broadcast ( )
Broadcast the specified message.
Example:
When you press the space key, the sprite
broadcast message1.
1.8) broadcast ( )
and wait
Broadcast the specified message.
Example:
When you press the space key, the sprite
broadcast message1 and waits until scripts
triggered by it are executed.
2) Motion Category
Use to make
your sprite move.
2.1) move ( ) steps
Moves the sprite forward the specified
number of steps.
Example:
After you click the green flag, the sprite
moves forward 10 steps.
2.2) turn ( ) degree (clockwise)
Turns the sprite clockwise the specified
degrees.
Example:
When you press the → key, the sprite
turns clockwise 15 degrees.
2.3) turn ( ) degree
(counter clockwise)
Turns the sprite counter clockwise the
specified degrees.
Example:
When you press the ← key, the sprite
turns counter clockwise 15 degrees.
2.4) go to ( )
Moves the sprite to a random position,
mouse-pointer position or another position.
Example:
When you click the green flag, the sprite
moves random position of the stage.
2.5) go to x:( ) y:( )
Moves the sprite to the specified position
(x, y) of the stage.
Example:
When you click the green flag, the sprite
moves the position (0, 0) of the stage.
2.6) glide ( ) secs to ( )
Moves the sprite to a random position,
mouse-pointer position or another position in
the specified period of time
Example:
When you click the green flag, the sprite
moves to a random position of the stage in one
second.
2.7) glide ( ) secs
to x:( ) y:( )
Moves the sprite to the specified position
(x, y) of the stage in the specified period of time.
Example:
When you click the green flag, the sprite
moves to the position of the stage in one
second.
2.8) point in direction ( )
Makes the sprite face the specified
direction.
Example:
When you click the green flag, the sprite
faces the 90 degree direction (the right side).
2.9) point towards ( )
Makes the sprite face the mouse-pointer
or another specified direction.
Example:
When you click the green flag, the sprite
faces the mouse-pointer.
2.10) change x by ( )
Changes the x coordinate of the sprite by
the specified value.
Example:
When you press space key, the x
coordinate of the sprite is increased by 10.
2.11) change y by ( )
Changes the y coordinate of the sprite by
the specified value.
Example:
When you press space key, the y
coordinate of the sprite is increased by 10.
2.12) set x to ( )
Sets the x coordinate of the sprite by the
specified value.
Example:
When you press space key, the x
coordinate of the sprite is set to 0.
2.13) set y to ( )
Sets the y coordinate of the sprite by the
specified value.
Example:
When you press space key, the y
coordinate of the sprite is set to 0.
3) Looks
Category
Are used to
control a sprite and
backdrop
appearance.
3.1) say ( ) for ( ) seconds
Display a speech bubble containing the
specific text on the upper right of the sprite for
the specified period.
Example:
When you click when this sprite clicked,
the sprite says “Hello!” for 2 seconds.
3.2) say ( )
Display a speech bubble with the
specified text on the upper right of the sprite.
Example:
When you click the green flag, the sprite
says “Hello!”
3.3) think ( )
for ( ) seconds
Display a thought bubble containing the
specified text on the upper right of the sprite
for the specified period.
Example:
When you click the green flag, the sprite
thinks “Hmm…” for 2 seconds.
3.4) think ( )
Display a thought bubble with specified
text on the upper right of the sprite.
Example:
When you click the green flag, the sprite
thinks “Hmm…”
3.5) switch costume to ( )
Changes the costume of the sprite to the
specified one.
Example:
When you press → key, the costume of
the sprite is changed to costume1.
3.6) next costume ( )
Changes the costume of the sprite to the
next one in the costume list. If the current
costume is the last one in the list, it is changed
to the first one.
Example:
After the green flag is clicked, the sprite
says “Hello!” for a second, waits 1 second, and
then changes to the next costume.
3.7) switch backdrop
to ( )
Changes the stage backdrop to the
specified one.
Example:
When you press space key, the backdrop
of the stage is changed to costume1.
3.8) next backdrop
Changes the stage backdrop to the next
one in the backdrop list. If the current
backdrop is the last one in the list, it is changed
to the first one.
Example:
When you press → key, the backdrop of
the stage is changed to the next one in the
backdrop list.
3.9) change size by ( )
Changes the size of the sprite by the
specified percentage.
Example:
When you press ↑ key, the size of the
sprite is enlarged by 10%.
3.10) set size to ( )%
Set the size of the sprite to the specified
one by percentage. The default size is defined
as 100%
Example:
When you click the green flag, the size of
the sprite is set to 50% of the default size.
3.11) change ( )
effect by ( )
Change the specified effect of the sprite
by the specified amount.
Example:
When you click the green flag, the color
effect of the sprite is increased by 50%.
3.12) set ( )
effect to ( )
Sets the specified effect of the sprite to
the specified percentage.
Example:
When you click the green flag, the color
effect of the sprite is set to 50%.
3.13) clear graphic
effects
Deletes the graphic effects of the sprite.
Example:
When you press ↑ key, the graphic
effects of the sprite is deleted.
3.14) show
Shows the sprite on the stage.
Example:
When you click the green flag, the sprite
is shown on the stage.
3.15) hide
Hides the sprite from the stage.
Example:
When you press the space bar, the sprite
is shown on the stage, and it is hidden after 1
second.
3.16) go to ( ) layer
Moves the sprite to the front or back
layer.
Example:
When you press the ← key, the sprite is
moved to the front layer.
3.17) go to ( )
( ) layer
Moves the sprite forward or backward by
the specified number of layers.
Example:
When you press the ↑ key, the sprite is
moved forward by one layer.
3.18) costume ( )
Current costume number or name of the
sprite.
Example:
When you click the green flag, the sprite
reports its costume number.
3.19) backdrop ( )
Current backdrop number or name of the
stage.
Example:
When you click the green flag, the sprite
reports the current backdrop number of the
stage.
3.20) size
Size of the sprite.
Example:
When you click the green flag, the sprite
reports its size.
4) Sound
Category
Are used to
control sound and
MIDI
(Musical
Instrument
Digital
Interface) functions.
4.1) play sound ( )
until done
Plays the specified sound until it ends.
Example:
When you click the sprite, the sound
Grunt is played until it ends.
4.2) starts sound ( )
Plays the specified sound without
pausing the script.
Example:
When you click the sprite, the sound
Grunt is played.
4.3) stop all sounds
Stops playing all sounds.
Example:
When you press the space key, the sound
Grunt is played then after a second stops all
sounds and after 3 seconds the sound Meow is
played until it ends .
4.4) change ( )
effect by ( )
Changes the specified effect (pitch or pan
left/right) by the specified amount.
Example:
When you press the ← key, the pitch
effect is increased by 50%.
4.5) set ( )
effect to ( )
Sets the specified effect (pitch or pan
left/right) to the specified amount.
Example:
When you press the space key, the pitch
is set to 90%.
4.6) clear sound
effects
Deletes all sound effects.
Example:
When you press the space key, all sound
effects are deleted.
4.7) change
volume by ( )
Changes the volume by the specified
amount.
Example:
When you press the ← key, the volume is
decreased by 10%.
4.8) set volume to ( ) %
Sets the volume to the specified amount.
Example:
When you click the sprite, the volume is
set to 50%.
4.9) volume
Current volume.
Example:
When you click the sprite, the sprite
reports the current volume.
https://www.mblock.cc/doc/en/block-reference/events.html
https://www.mblock.cc/doc/en/block-reference/motion.html
https://www.mblock.cc/doc/en/block-reference/looks.html
https://www.mblock.cc/doc/en/block-reference/sound.html
Thank you!
Download