
Hello!
I’m Teacher Ratch from “Let’s Scratch! Fun Programming Class.”

I’m Sukku.
Nice to meet you!

Hey, Sukku.
Have you ever played a game where you move things with the mouse like this?


Yeah, I have!
It’s fun, right?

You can program the cat to follow the mouse
with just 4 code blocks!

Really?

Here’s the script to make the cat follow the mouse.


That’s all you need to make it follow the mouse!

Now, let’s make it together!

Let’s do it together!!
Now, let’s have fun learning programming!
Here’s the Scratch project we’re making today!

Try moving the cat with the mouse!
What you’ll learn in this lesson
1. You’ll learn the script that makes the cat follow the mouse.

Let’s look at the script
Here’s the sprite!


The sprite in this Scratch project is:
- “Cat”
- I renamed “Sprite1” to “Cat.”
Here’s the script!
Cat’s Script

Let me explain how to program this
Cat’s Script
Programming to make the cat point towards the mouse


- The sprite points in the direction where the mouse pointer is


Hey, what’s a “mouse pointer”?

The “mouse pointer” is
the arrow on the stage.


Oh, that’s what they call a “mouse pointer”!
Programming to make the cat follow the mouse

Let’s change the cat’s movement speed

Let’s change the cat’s movement speed.
Try changing the number “10” in “move 10 steps” to “5”



Wow! The cat approaches the mouse pointer slowly!
This is easier to control!

Try changing the number in the “move () steps” block to test different cat movements,
and find the movement you like best!
The cat disappeared when I used “-5 steps”! What should I do?
What happens to the cat’s movement when you use “-5 steps”?

Hey, what happens to the cat’s movement

when I use “-5 steps”?
Will the cat walk backward?

Good thinking!
Let’s try it right away!

Huh…?
The cat disappeared!

It won’t come back even when I press the red button.
The cat won’t appear even when I click the green flag!
What should I do…?!

Don’t worry! It’s okay!
Because of the -5 steps, the cat runs away from the mouse pointer.
So if you change it back to a positive number like 5 steps,

the cat will move toward the mouse pointer and come back!
- The cat appears from the edge


Oh! It’s true.
The cat came back. I’m so relieved!
Summary

oday, we learned
how to program the cat to follow the mouse using the “point towards mouse-pointer” block.
What we learned today

Programming to make the cat follow the mouse uses these 4 code blocks!


There are many games that use this script to control things with the mouse.
Try using this script to create your own game!
See you next time!!

See you later!!!
(@^^)/~~~




コメント