Coding Booklet Class Iv
Coding Booklet Class Iv
CLASS-IV
⮚ Basics of Sprite Lab
⮚ SPRITE LAB | Code.org
Sprite Lab is a block-based programming environment where you can
make simple animations and games with objects and characters that
interact with each other.
Moves a sprite or group of sprites the given number of pixels in the selected
direction.
This block lets sprites move around the display. A sprite can move in four
directions, and a default number block is given to specify how many pixels
the sprite will move at a time.
⮚ Rotate a Sprite :
Rotates a sprite or group of sprites by the selected amount. When used in
a behavior, the turn command will give sprite the appearance that it is
spinning.
Example : The toothbrush has been turned to make it look like it is in the
sprite’s hand.
⮚ Move Forward :
Moves the sprite the specified number of pixels in the direction it is facing.
By default, the block moves sprites to the right (or east). However, changing
the sprite’s movement direction will change which direction it moves when
moving forward.
⮚ Adding Text and Prompts:
Text in Sprite Lab can be written using Print block as shown in the
picture below. When a computer wants to collect information it uses a
“prompt”. In Sprite Lab, this prompt block asks a user a question and you
can generate a personalized response on the basis of it.
⮚ Move Towards :
Sprites moves a specified number of pixels towards a location.
Rather than specify an exact direction to move in, this block lets the sprite move
towards a location. This can be useful when you want a sprite to target
something or chase another sprite.
BACKGROUND AND SOUNDS
⮚ Set Background:
Plays the given sound once. This block connects to a menu of sounds to
choose from. Once a sound is chosen, its file name appears in the block.
⮚ EVENTS IN SPRITES
⮚ Sprite Clicked:
Triggers a sequence of blocks to run when a specific sprite is clicked.
Sometimes code should only be run if an event happens. In this case, when a
sprite is clicked, the blocks attached under the event block will begin to run
sequentially. If the costume block is used here, the code will run whenever any
sprite with the matching costume is clicked.
This block has a drop-down menu with “when” and “while” options. “When” a
sprite is clicked, the code will only run once. “While” a sprite is clicked, the
code will run over and over again until the sprite stops being clicked on.
⮚ Sprite Touches :
Sometimes code should only be run if an event happens. In this case, when a
specific sprite touches another specific sprite, the blocks attached under the
event block will begin to run sequentially. If the costume block is used in either
parameter, the event will check for touches between any sprites of the matching
costume(s).
This block has a drop-down menu with “when” and “while” options. “When” a
sprite touches another sprite, the code will only run once. “While” a sprite is
touching another sprite, the code will run over and over again until the sprites
stop touching.