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

I’m Sukku.
Nice to meet you!

Sukku.
Have you ever played games where ghosts or enemies appear and disappear in different places like this?


Yeah!
You often see that in shooting games!

You can make the cat appear in different places with just 4 code blocks!

What!
Just 4 code blocks!

Here’s the script to make the cat appear in different places.


I can do this too!

If you learn this programming, you can make games too!
Let’s try it right away!

Let’s do it!
Now, let’s learn programming in a fun way!
Here’s the Scratch project we’re making today!

Try clicking the cat!
What you’ll learn in this programming lesson
1. You’ll understand the script that makes the cat appear in different places.

2. You’ll understand the script that makes the cat say “Hello!” and stop when clicked.

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 appear in different places


- The computer randomly decides where to display the sprite.

Programming to stop when the cat is clicked


- When the sprite is clicked, the script below gives commands to the computer.


The “stop other scripts in sprite” code stops other scripts from running.
Read this article for more details.
Programming to make the cat speak and finish

How do I change the teleport timing?

Teacher Ratch,
the cat’s teleportation is too slow and I can click it easily!
Can it teleport faster?

That’s right!
If you make the cat teleport faster, it becomes harder to click and more fun!
Then let’s change the “wait 1 seconds” code to “wait 0.5 seconds” by entering “0.5”!


Wow! Now I can’t click the cat easily!
Yeah, it’s getting more fun!

Try changing the number in the “wait _ seconds” code to make different cat movements and make it more fun!

Hey, what happens to the cat’s movement if I set it to “wait -1 seconds”?


Hehe…
That’s interesting!
I wonder what “wait -1 seconds” means…
Try it yourself!

Huh…?
・・・

Stop! That’s enough!
Sukku, be quiet!
You who are reading this should try it yourself to see what happens!
You’ll definitely go “Huh…?!!”
Summary

Today,
we learned programming to teleport the cat using the “go to random position” code.
What we learned today

Programming to make sprites appear in different places uses these 4 code blocks.


There are many game projects that use this script.
We also learned programming that starts when you click a sprite.
We use the “when this sprite clicked” block.
Try using these codes to challenge yourself with game programming!
See you again!!

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




コメント