Topicm77c18d88c8577793_1528449000663_0Topic

Mouse in the mazemazemaze

Levelm77c18d88c8577793_1528449084556_0Level

Second

Core curriculumm77c18d88c8577793_1528449076687_0Core curriculum

Grades IV‑VI

I. Understanding, analyzing and solving problems. The student:

2) formulates and writes in the form of algorithms commands consisting of:

c) controlling the robot or object on the screen;

3) distinguishes basic steps in algorithmic problem solving: determination of the problem and goal to be achieved, analysis of the problem situation, developing a solution, checking the problem solution for example data, writing the solution in the form of a diagram or program.

II. Programming and solving problems with the use of computer and other digital devices. The student:

1) designs, creates and writes in a visual programming language:

a) ideas of stories and solutions to problems, including simple algorithms using sequential, conditional and iterative commands and events,    
b) a simple program that controls a robot or other object on the computer screen;

Timingm77c18d88c8577793_1528449068082_0Timing

45 minutes

General objectivem77c18d88c8577793_1528449523725_0General objective

Creates a simple boardboardboard game.

Specific objectivesm77c18d88c8577793_1528449552113_0Specific objectives

1. Applies iterative instructions.

2. Applies conditional instructions.

3. Creates new variables.

Learning outcomesm77c18d88c8577793_1528450430307_0Learning outcomes

The student:

- designs and creates a simple board game,

- applies iterative and conditional instructions and creates new variables.

Methodsm77c18d88c8577793_1528449534267_0Methods

1. Discussion.

2. Work with computer.

Forms of workm77c18d88c8577793_1528449514617_0Forms of work

1. Individual work.

2. Group work.

LESSON STAGES

Introductionm77c18d88c8577793_1528450127855_0Introduction

Certainly you know computer games, in which the protagonistprotagonistprotagonist walks around the mazemazemaze and collects various items or avoids contact with them. Your task is to create a simple version of such a game.

Think about who may be the protagonist of your game, how the board should look, how characters should move, what rules will apply to it.

Procedurem77c18d88c8577793_1528446435040_0Procedure

Before you start to implement the scenario of your game, do the following exercises. These exercises show what solutions you can use in your game.

The sprite touches other objects:

Task 1

Build a script in which the sprite‑cat meets on his way an apple, and after touching it, he says something and then goes backwards.

Use the block touching ... colour from the Sensing category and the conditional expression if ... then from the Control category.

Tip: To change the colour in the block touching ... colour, click the left mouse button on the colour box in the block. After clicking, the mouse pointer will change its appearance. Move the pointer to another object on the screen in the colour you need. When you click again on this object, the colour box in the block will change colour accordingly.

Solution:

One of the possible solutions:

[Illustration 1]

Controlling the sprite movement:

Task 2

You want the directiondirectiondirection of the sprite movement to be changed using the arrows.

Build a script in which pressing the arrow will cause the sprite to turn in the desired direction.

Solution:

One of the possible solutions - pressing the spacebar causes the movement of the sprite. When we press the arrow, the sprite will change its direction of movement. Check, which way it goes, by pressing the space again.

[Illustration 2]

Game board:

To create a game boardboardboard containing a maze, you can create it from scratch in any graphic editor (remember that the Scratch scene is 480 points wide and 360 points high). You can also modify one of the backdrops from the program library called xy‑grid‑30px or use the following board.

[Download]

[Illustration 3]

Mouse in the maze:

You already have a board ready. Now it's time to place sprites on it.

Task 3

Place two sprites on the board. Adjust their sizes to fit entirely in a single maze field. Choose the coordinates of the position of the sprites so that after the green flag lights up they are always in the same place.

Tip:

Use the block set size to ... % from the Look category.

Task 4

Choose the number of steps of one of the sprites, so that after pressing the space it would go entirely to the next field, and pressing the arrow would change the directiondirectiondirection of its movement. The second sprite remains still all the time.

If the sprite touches the field beyond the maze path, it should go back to the previous position.

Tip:

Use the solution for the command from the beginning of the lesson.

Solution:

One of the possible solutions:

[Illustration 4]

Introducing action to the game:

Your sprite can move around the mazemazemaze. Think about what should happen to the sprites in the moment they meet.

Remember to save individual stages of your game under various names, e.g. Maze_version1. This way it will be easier for you to make changes or go back to successful solutions.

Task 5

Modify the previous script so that the sprite wandering around the maze „eats” the second sprite.

Tip:

When the wandering sprite meets another sprite, he broadcasts a message to him. The second sprite, after receiving the message, executes a given command. You will find the blocks you need in the Events category.m77c18d88c8577793_1527752256679_0When the wandering sprite meets another sprite, he broadcasts a message to him. The second sprite, after receiving the message, executes a given command. You will find the blocks you need in the Events category.

Solution:

The first sprite sends the message after encountering the second sprite:

[Illustration 5]

The second sprite receives the message and executes the command:

[Illustration 6]

Lives counterlives counterLives counter:

No game can go without a score or lives counter. To add counters to the game, create a new variable in the Data category. We use this variable later to count the scored points or lost lives of the protagonist of the game. After creating the variable, new blocks automatically appear, which we use to build scripts.m77c18d88c8577793_1527752263647_0No game can go without a score or lives counter. To add counters to the game, create a new variable in the Data category. We use this variable later to count the scored points or lost lives of the protagonist of the game. After creating the variable, new blocks automatically appear, which we use to build scripts.

Task 6

In the Data category, create a new Lives variablevariablevariable. Look what new blocks appeared. Consider how to modify your codecodecode so that the sprite will lose one life after accidentally touching the wall of the mazemazemaze. When the number of lives is exhausted, the game ends.

Tip: If you are not sure how to apply the newly created variable in the codecodecode, look at the following slideshow.

[Slideshow]

Lesson summarym77c18d88c8577793_1528450119332_0Lesson summary

In Scratch you can define new variables. Sprites can communicate with each other.

Selected words and expressions used in the lesson plan

boardboardboard

codecodecode

directiondirectiondirection

lives counterlives counterlives counter

mazemazemaze

protagonistprotagonistprotagonist

scorescorescore

variablevariablevariable

m77c18d88c8577793_1527752263647_0
m77c18d88c8577793_1527752256679_0
m77c18d88c8577793_1528449000663_0
m77c18d88c8577793_1528449084556_0
m77c18d88c8577793_1528449076687_0
m77c18d88c8577793_1528449068082_0
m77c18d88c8577793_1528449523725_0
m77c18d88c8577793_1528449552113_0
m77c18d88c8577793_1528450430307_0
m77c18d88c8577793_1528449534267_0
m77c18d88c8577793_1528449514617_0
m77c18d88c8577793_1528450135461_0
m77c18d88c8577793_1528450127855_0
m77c18d88c8577793_1528446435040_0
m77c18d88c8577793_1528450119332_0
maze1
maze

labirynt

RAimwz0RRxXKe1
wymowa w języku angielskim: maze
board1
board

plansza

RVN3k5D1uV1GA1
wymowa w języku angielskim: board
protagonist1
protagonist

bohater

Ra8hm6Q07yqxi1
wymowa w języku angielskim: protagonist
direction1
direction

kierunek

RpSOosSa5kz4D1
wymowa w języku angielskim: direction
lives counter1
lives counter

licznik żyć

R12hUdtcuotHC1
wymowa w języku angielskim: lives counter
variable1
variable

zmienna

RCBeE3UIqQDMk1
wymowa w języku angielskim: variable
code1
code

kod

R1JorZ2D5ClUr1
wymowa w języku angielskim: code
score1
score

punkt

R1Czzukv0Kyw11
wymowa w języku angielskim: score