Comp6-Module2 - 2ndquarter

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Module 2- Using Motion Commands

Module 2- Using Motion Commands

Expected Outcomes

At the end of the lesson, the learners should be able to:

1. Explore the motion commands of scratch


2. Create a Scratch programming

Questions to Ponder

Learning how to code in Scratch is the perfect introduction to Computer


Science and will make learning other programming languages much more
insightful. Movement is arguably the most basic function in any game. It is
the first thing you do when you start a new game. This module will help you
learn how to make sprites move. This is perfect for Scratchers who are just
getting started and want to make their own creations. This will also explain
how to create a sprite and make it controllable.

“What are the commands in moving sprite in scratch programming?”

Grade 6- Computer 47
Module 2- Using Motion Commands

The Concepts

Moving Sprites

Program Name: Square

1. Click File/New to create a new project and enter a project name of Square.

2. From the Events menu, drag a when green flag clicked block to the scripts
area. Your scripts area should look like this:

3. From the Motion menu, drag a go to x: 0 y: 0 block to the scripts area and
snap it to the bottom of the when green flag clicked block. Your script should
look like this:

4. Add a move 100 steps block to the bottom of your script and change the
10 to 100.

5. Click the green flag at the top right corner of the stage to run your program.
Let’s look at what happened:

When green flag clicked block tells Scratch that the other blocks in the
script are to be executed at the start of the program — that is, when the
green flag is clicked.

The go to x: 0 y: 0 block tells Scratch to move the sprite — that’s the cat,
which is what you’re writing instructions for — to the coordinates (0, 0). The
stage has a coordinate system with (0, 0) in the center, x values ranging from
–240 to +240, and y values ranging from –180 to +180

Grade 6- Computer 48
Module 2- Using Motion Commands

Turning and Waiting


Now it’s time to make your sprite move in a Square.

1. Drag a turn counterclockwise 15 degrees block to the bottom of the script


and change the 15 to 90

2. Add more blocks until you have four moves/turn pairs in your script

3. Run your program. The sprite moved in a square, but so quickly that you
couldn’t see it. You can fix that by adding wait 1 secs blocks from the
Control menu to the stack

Grade 6- Computer 49
Module 2- Using Motion Commands

4. Run your program again. If your sprite is too slow, you can always change
the wait time.

Move and Turn are relative motion commands. It is important to understand how
Scratch uses directions to move a sprite using the point in direction command. In
Scratch, up direction is equivalent to 0, right is 90, left is -90 and down is 180.

Try the change x and change y motion! Check out the output!

There are some instances that you just


want to move the sprite horizontally or
vertically. You can use the change x
and change y blocks as illustrated in
the image.

Grade 6- Computer 50
Module 2- Using Motion Commands

Programming a Lady bug to run after a ball


It contains two sprites, Lady bug and Ball with the scripts. When you clicked the
green flag icon, the Lady bug sprite continuously follows the Ball.
1. Lady bug is set to rotate on the stage.
2. Lady bug continuous points towards the ball and
3. Glides towards the ball at 0.5 second following the x and y coordinates using
the mouse x and mouse y commands.
4. Ball is instructed to go where the mouse pointer is located and
5. Turn to the right 15 degrees.
Blocks for the Lady Bug Blocks for the Ball

Criteria:
Accuracy – 10points Promptness – 5 points Total points: 15 pts.

Additional Learning Resources

References:

Fontanilla, Aimee, Theresa A., et. al (2017). Digi titans 6 ICT Essential for the
Future. Tec Factor Inc.
http://www.rpbourret.com/scratch/Bourret-ScratchProgramming.pdf

Module Creator/Curator : Mrs. Liza L. Garcia


Template & Layout Designer : Mrs Jeniffer M. Makalintal

Grade 6- Computer 51

You might also like