Planet Game

Learn

Code

Repeat

Lesson 3 - Visual, level 3

Introduction

Show the example. Note that the game ends when the planet has dropped 10 times, or when there have been 3 crashes. Children analyse how the code is working and share ideas. Draw attention to the variables "score" and "lives". Explain that sprites communicate with each other using the "broadcast" block. (see video)

Main Activities

Load the template. This is a simple version of the game without the "lives" variable and it does not decrease the score when the rocket crashes.

Task 1. Add in code to decrease the score by 3 when the rocket crashes. (Use the "set score to" block).

Task 2. Add in a "lives" variable so that the game ends after 3 crashes. (They will need to broadcast "game over" when lives is equal to 0).

Challenge

Children can "clone" the planet sprite and change it to a different planet. They can then experiment with the code so the object of the game is to hit the new planet. Look at the example "planet strike" and try making various changes to it.

Share the games with younger children in the school. Those with access to the Just2easy Tool Suite may do that with blogging or sharing, other schools may use the "link" button.

Follow up lesson(s)

Children should now have the skills to use J2Code and should be encouraged to design and create their own programs.

Children can be encouraged to continue to experiment by accessing J2Code at home.

Schools with access to the Just2easy ToolSuite may choose to blog some work, pupils can then leave comments on each other's work suggesting improvements or leaving feedback. Teachers may also save and share their own examples and templates.

Assessment

Self and peer assessment - pupils can work with a partner to review, and help correct their code (debug).

Learning Objectives

- To use variables in the context of a game.

- To analyse and explain how an existing program works.

Learning Outcomes

All children: will change how a a variable works in the planet game

Most children: will use a new variable in the planet game.

Some children: will create their own game using multiple variables.

Cross curricular links

Maths: geometry - position and direction.

Vocabulary

variable, broadcast (see glossary).

Resources

Template: j2e.com/code/template/Y5Template3

Example: j2e.com/code/examples/Visual/Y5Example3

Video: j2e.com/help/videos/Y5Video3