Sprites are images that you would like to work with in a Scratch computer program. You use the kind of sprites you want to use and write some code to control them and make them do things like movement or change their appearance. For example, if you want to code a Mario game the first thing you need is the image of Mario.
Examples of sprites in Scratch
Sprites come in different sizes and we use different sizes in the program for different requirements. Once you have the sprite you can make the sprite behave in different ways.
How to create a sprite in Scratch?
Click on the cat picture as shown below to choose the sprite.
On clicking choose a Sprite the following library of sprite opens up as shown below:
Click on the picture to add the sprite to the game. Here an apple picture was clicked to be added to the game as shown below.
How to add costumes to your sprite?
Right click on the red apple sprite and click on duplicate.
After clicking on the duplicate sprite, another copy of the sprite gets created as shown below:
How to create your own sprites in Scratch and write code?
The obstacle sprite scrolls throughout the scene in a continuous fashion.
1) Go to import sprite to add the Back sprite.
2) Choose the obstacle sprite containing two costumes:
3) Obstacle sprite program:
– At first, we put the obstacle sprite in the background and place it in the initial position:
– The obstacle sprite is scrolled horizontally in the scene. If he reaches the edge of the stage, he changes the costume and positions himself in the initial position.
Here is the final program for the obstacle sprite:
Also, children code the same game on another platform called Code.Org.
Hope this is useful, thank you.