- Resource Information
Abstract
Scratch programming environment is one of the best applications to learn coding. It uses a visual programming scripts that helps to understand the consept of programming and develops the logical thinking behind it. Using Scratch you can build different animations and games with different levels and complexity. You can use different characters, backgrounds, sounds etc and your imagination and creativity to build whatever you like.
This activity can be developed individually by learners or as a pair activity (2 learners) to learn simple programming and to create a game. Teacher shall maintain a close screw of the work performed by the learners.
Scratch environment
Learning Outcomes
The learners will learn how to use Scratch programming environment to program a simple game.
Skills and competences
The learners can develop following skills and competences:
- Programming
- Problem solving
- Teamwork
- Motivation
- Do-it-yourself (DIY)
- Process management
- Planning and organising
- Analysation, Initiation
- Logical thinking
Knowledge
The following knowledge can be gathered by the learners:
- How to be creative
- How to use Scratch
- How to make a program
- How to make a game
Other Instructions
- Make a new Stage. Use the Backdrop paint and paint a nice apple tree.
- NB! Do not include apples, we will add them later!
- Add a fruit as a new Sprite (character).
- NB! Delete the cat sprite by right click -> delete or clicking the trash can icon on sprite.
- On the left you can see a sample tree with apple sprite on it.
- Next we start programming the apple.
- As a tradition the program starts with when green flag clicked and defining the start position for the apple.
- The idea of the game is to pick as many apples as you can in 30 seconds!
- For that we must define 2 variables. You can do that in Variables
- Click Make a Variable and give to the first variable a name Timer. Now make another variable and name it Picked.
- With Timer we are counting down from 30 to 0.
- With Picked we are counting the number of picked apples.
- Let’s start with the Timer. When green flag clicked, set the timer to 30. Use set Timer to 0 button in Variables Change it accordingly.
- Now we need to subtract 1 with every second. For that use wait 1 second from Control section, change Timer by -1 from Variables section and to do it 30 times, use repeat 30 script from Control section.
- Timer should look like in the picture on the left.
- Now we need to manipulate with variable Picked. We can do it in main program.
- First, set the starting position for the first apple (sprite) if you have not done so.
- Then we need to set the Picked variable to 0, because when the game starts, we have not picked any apples.
- To do so use set Picked to 0 from Variables section. So, every time we start the game the Picked is 0 and Timer is 30.
- Next, we need to wait for the timer to get 0 and then the game says Game over!
- For that we can use wait until block from Control section and use the equal block from Operator section as the argument and set right side 0 and drag Timer from Variables section to the left side.
- This should look like this.
- So, if the timer goes 0, the game ends and says, “Game over!”
- Last step is to program the game to pick the apples by clicking the mouse on the apple.
- For that we use when this sprite clicked block from Events section. So, every time when the game is on and we click on apple this program part applies.
- So, if we click on this sprite (apple) we need to add 1 to Picked variable. Use change Picked by 1 from Variables
- Then we need to hide the apple (as it was picked). Use hide from Looks section for that.
- Next, we need to change the coordinates for the new apple to show up.
- For that we use go to x: … y: … block from Motion
- To select a random position for the apple to show up, we use the pick random … to … operator from the Operator section for x and y values
- For x value we use – value on the left side of the tree and + value from the right side of the tree.
- For y value we use – value on the lower side of the tree and + value from the upper side of the tree.
- If the new position is defined, we need to show the apple again. For that use show block from Looks
- Now the game should be ready.
URL
RESOURCES
Author
Language
English