Topicmd18617f10c28f323_1528449000663_0Topic

The first project in the Scratch environment - we teach the spritespritesprite to walk and draw

Levelmd18617f10c28f323_1528449084556_0Level

Second

Core curriculummd18617f10c28f323_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;

Timingmd18617f10c28f323_1528449068082_0Timing

45 minutes

General objectivemd18617f10c28f323_1528449523725_0General objective

Can build scripts that direct the movement of the object on the computer screen.

Specific objectivesmd18617f10c28f323_1528449552113_0Specific objectives

1. Builds scripts that direct the movement of an object in a straight line.

2. Builds scripts that rotate an object.

3. Saves the created program to disc or in the cloud.

Learning outcomesmd18617f10c28f323_1528450430307_0Learning outcomes

The student:

- builds scripts that direct the movement of an object on the computer screen,

- saves the created program to disc or in the cloud.

Methodsmd18617f10c28f323_1528449534267_0Methods

1. Discussion.

2. Work with computer.

Forms of workmd18617f10c28f323_1528449514617_0Forms of work

1. Individual work.

2. Group work.

LESSON STAGES

Introductionmd18617f10c28f323_1528450127855_0Introduction

Start the Scratch program. You can do it on your computer if you have it installed or open in your browser.

Remind which part of the program window is the stage and which part is the script areascript areascript area. Where are the building blocks needed to build scripts?

Proceduremd18617f10c28f323_1528446435040_0Procedure

Almost every computer game hero can move around the screen. He cannot do it himself, he must be thoroughly instructed, where and how he should go.

In Scratch, you'll build scripts that will allow your cat‑sprite to move around the screen.

Remember that in the scripts area, you can place a lot of scripts for every spritespritesprite. Each of them can be located in any part of the script area.

Your sprite can move in different directions by doing steps and making turns.

Task 1

Build a script that, when launched by clicking on the green flaggreen flaggreen flag, will cause the cat‑sprite to go 10 steps forward. You can try to create it yourself or use the instructions below.

Compare the results with a slideshow. Does your script look similar?

Think about what you need to do to make the spritespritesprite go backwards.

Instruction:

Step 1
Select the Events category and drag the blockblockblock when green flag clicked into the script area.

Step 2
Choose the Motion category and drag the block move … steps to the script areascript areascript area and connect it to the green flag blockblockblock.

Step 3
Choose the Control category, drag the block, stop ...and connect it to the previous block. Click on the drop down list in this block and select this script option.

Step 4
Check how the script works. Click on the green flaggreen flaggreen flag several times. The cat‑sprite should move 10 steps forward with each click. You can check if the cat‑sprite actually moves by looking at the counter in the upper right corner of the panel.

If the cat‑sprite reaches the edge of the stage, you can grab it with the mouse (e.g. by the tail) and move it to any place in the stage.

Step 5
If your script works correctly, experiment with the amount of steps performed by the spritespritesprite. Increase or decrease the numbernumbernumber of steps in the blockblockblock window. Check what will happen if you enter a minus sign in front of the number of steps, e.g. -20.

[Slideshow]

Remark:
The script would work the same way, if there was no block, stop .... However, it is worth to learn good habits and finish the scripts so that you cannot attach any blocks to the top or bottom.

You can now run the script using the green flag. It is often more convenient to run scripts using the keyboard. You can start each script with a separate keykeykey.

Task 2

Practice running the script using the keyboard.

In your script, replace the block when green flag clicked with when ... key pressed selecting the space barspace barspace bar as the start key. Restart the script by pressing the space bar.

Instruction:

Go to the Events category. Detach the blockblockblock with the green flaggreen flaggreen flag from the remaining blocks and drag it to the left. Enter a new block when ... key pressed and select the space from its drop‑down menudrop‑down menudrop‑down menu. Run your script again by pressing the space bar.

Your spritespritesprite can move, but only in one direction. You will get more motion possibilities when you apply turns.

Task 3

Create a new script that will turn the sprite when you press a selected keykeykey (e.g., right arrow or left arrow). Combine rotationrotationrotation with movement of the sprite. If you have no idea how to do it, follow the instructions.

Instruction:

Turning right:
Create a new script:

- Enter a block when ... keykeykey pressed and select from the drop‑down menu the key with which you want to run the script.
- Add a block turn right ... degrees. Enter the numbernumbernumber of degrees you want the sprite to turn by.
- Add another block that moves the spritespritesprite with the required number of steps.
- Add a block ending the script.

Turning left:
Create a new script:

- Enter a block when ... key pressed and select from the drop‑down menudrop‑down menudrop‑down menu the key with which you want to run the script.
- Add a block turn left ... degrees. Enter the number of degrees you want the sprite to turn by.
- Add another block that moves the sprite with the required number of steps.
- Add a block ending the script.

If we want the sprite to start its movement in the selected place, we can create the appropriate script. This script will move the sprite where we want it. You can also choose the direction in which it will look.

Task 4

Find in the program the blocks shown in the figure and create a script to move the sprite to the desired location. Check what option in the block point in direction ... you have to choose for the sprite to look down. Try out the settings you need to set for the blocks set x to ... and set y to ... for the sprite to be in the upper left corner of the stage.md18617f10c28f323_1527752263647_0Find in the program the blocks shown in the figure and create a script to move the sprite to the desired location. Check what option in the block point in direction ... you have to choose for the sprite to look down. Try out the settings you need to set for the blocks set x to ... and set y to ... for the sprite to be in the upper left corner of the stage.

[Illustration 1]

Your spritespritesprite can also leave a trailtrailtrail behind itself. Sometimes this function is useful if we want to check if the sprite is moving along the path we want.

To create trails, we use blocks in the Pen category.

Task 5

Build two additional scripts:

- The first script causes to lower the pen on the stage after pressing the selected keykeykey,
- The second script causes to raise the pen above the stage after pressing the selected key.

Once the scripts works expand them and add changing colour and thickness.

If you have no idea how to do it, look at the hint.

[Illustration 2]

The spritespritesprite leaves a lot of trails. To get rid of them, you need to clear the stage. You can combine this action with placing the sprite in the starting position after restarting the program, e.g. using the following script.

[Illustration 3]

Saving the script:
You can save the scripts you have created on your drive or in the cloud on the Scratch portal. If you want to save it on the portal, you must have an account there.

To save the program on your computer, select File/Save or File/Download to your computer (depending on whether you run Scratch locally or in a web browser). Then enter the filename, e.g. First program and click Save.

Lesson summarymd18617f10c28f323_1528450119332_0Lesson summary

Using scripts, we can control the sprite movement in any direction; place it in the selected position. The sprite can leave a trail when moving around.md18617f10c28f323_1527752256679_0Using scripts, we can control the sprite movement in any direction; place it in the selected position. The sprite can leave a trail when moving around.

Selected words and expressions used in the lesson plan

blockblockblock

drop‑down menudrop‑down menudrop‑down menu

green flaggreen flaggreen flag

keykeykey

numbernumbernumber

rotationrotationrotation

script areascript areascript area

space barspace barspace bar

spritespritesprite

trailtrailtrail

md18617f10c28f323_1527752263647_0
md18617f10c28f323_1527752256679_0
md18617f10c28f323_1528449000663_0
md18617f10c28f323_1528449084556_0
md18617f10c28f323_1528449076687_0
md18617f10c28f323_1528449068082_0
md18617f10c28f323_1528449523725_0
md18617f10c28f323_1528449552113_0
md18617f10c28f323_1528450430307_0
md18617f10c28f323_1528449534267_0
md18617f10c28f323_1528449514617_0
md18617f10c28f323_1528450135461_0
md18617f10c28f323_1528450127855_0
md18617f10c28f323_1528446435040_0
md18617f10c28f323_1528450119332_0
sprite1
sprite

duszek

Ry1BGluPEVXbZ1
wymowa w języku angielskim: sprite
script area1
script area

obszar skryptu

RJFnEJYQvL3qL1
wymowa w języku angielskim: script area
green flag1
green flag

zielona flaga

Rv939M6E9Hzy81
wymowa w języku angielskim: green flag
block1
block

klocek

Rljbq3MQosrW61
wymowa w języku angielskim: block
number1
number

liczba

R1QkozXry1Sbd1
wymowa w języku angielskim: number
key1
key

klawisz

R19f8BxBIFzOQ1
wymowa w języku angielskim: key
space bar1
space bar

spacja

RpUDLiGE6eEhe1
wymowa w języku angielskim: space bar
drop‑down menu1
drop‑down menu

rozwijalne menu

R1E9T9Gal506j1
wymowa w języku angielskim: drop‑down menu
rotation1
rotation

obrót

Rbf1UPWFj3WVr1
wymowa w języku angielskim: rotation
trail1
trail

ślad

R6qISvTf1Vp921
wymowa w języku angielskim: trail