100% found this document useful (1 vote)
287 views16 pages

Coding Booklet Class Iv

The document provides information on using sprites in Sprite Lab, including how to create and customize sprites, make sprites move and interact, add text and prompts, set backgrounds and play sounds. It explains different blocks for controlling sprite properties and behaviors, such as moving sprites in different directions, rotating sprites, making sprites jump or move towards a location. Events that can trigger blocks of code when sprites are clicked or touch are also described.

Uploaded by

Harleen Kaur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
287 views16 pages

Coding Booklet Class Iv

The document provides information on using sprites in Sprite Lab, including how to create and customize sprites, make sprites move and interact, add text and prompts, set backgrounds and play sounds. It explains different blocks for controlling sprite properties and behaviors, such as moving sprites in different directions, rotating sprites, making sprites jump or move towards a location. Events that can trigger blocks of code when sprites are clicked or touch are also described.

Uploaded by

Harleen Kaur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

CODING BOOKLET

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.

⮚ How to Make a Sprite :


Sprite can be created by using Sprite Block. This block customizes how
the sprite looks and where it starts on the display. The costume drop
down menu gives a variety of sprite costumes to choose from and also
has the option to draw a costume. A location block can be attached at the
end of the block to control where the sprite will appear on the display.
⮚ Sprites in Action :
To make a sprite move or to perform any action we use events in sprite
Lab. By using action in sprite we can move a sprite or a group of sprite.
A sprite can move in all four directions.

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.

A sequence of characters.String is the word used to describe a sequence of


characters that could be letters, numbers, or symbols. The string can be
stored in a variable or printed onto the display when attached to specific text
blocks.
⮚ Show Title Screen :
Displays a title screen.
Titles can show the name of the program or communicate something to the
user. There are two sections: title and text. Title is larger text centered at the
top of the display and the text is smaller text at the bottom of the screen.
⮚ Join Text :
Gets the text string created by combining two values.
Sometimes strings can get really long or need to be printed with values that
are not strings. This block joins the two blocks into one string that can then
be stored in a variable or printed on the display.
⮚ Multiple Sprites:
To make more complex games and simulations, you’re probably going to
want a LOT of sprites. When you have a group of sprites with the same
costume, actions will usually affect all of them. If you want to change the
size of one of the sprites, you’ll need to use events.
The events tell the computer to wait for the click and then respond by
changing the properties which you want to change.
⮚ Make a Sprite Jump :
Sprite jumps instantly to a specified location.

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

Sets the background of the display area to an image.


When creating a Sprite Lab project, you may want to customize the background.
This block has a drop-down menu of images you can use.
⮚ Play Sound :

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 :

Triggers a sequence of blocks to run when a specific sprite touches


another specific sprite.

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.

You might also like