How to Move Cat Up and Down in Scratch

Motion
ラッチ先生
ラッチ先生

Hello!
I’m Teacher Ratch from “Scratch Fun Academy – Programming Classroom.”!

スック
スック

I’m Sukku.
Nice to meet you!

ラッチ先生
ラッチ先生

Today, we’ll program the cat to move up and down.

ラッチ先生
ラッチ先生

This cat’s movement can be done with just 5 code blocks.

「スクラッチしよう!1-2 ネコを上下に動かそう!」scratch ネコを上下に動かすスクリプト
ネコを上下じょうげうごかすスクリプト
スック
スック

Yes, it’s easy!

Let’s have fun learning programming!


スポンサーリンク

Here’s the Scratch project we’ll make today!

  • When you click the green flag, the cat moves up and down.
  • When the cat touches the top or bottom edge, it changes direction.
  • When you click the red button, the cat stops.
スック
スック

Click the green flag to see the project!

What you’ll learn in today’s programming:

1. You’ll understand the script that makes the cat keep walking upward.

scratchのネコが上に歩きつづける
うえあるつづける

2.You’ll understand the script that makes the cat change direction
  when it touches the edge.

scratchのネコが端に当たると向きを変える
はしたると、きをえる

3. You’ll understand how to keep the cat facing right.

scratchのネコがずっと右向きである
ネコのきを右向みぎむきにする
スポンサーリンク

Let’s look at the script

Here’s the sprite!

「スクラッチしよう!1-2 ネコを上下に動かそう!」のスプライト
スプライト
ラッチ先生<br>
ラッチ先生

The sprite in this Scratch project is “Cat.”

When you look at the Scratch screen, it says “Cat.”

 *We renamed “Sprite1” to “Cat.”

Here’s the script!

Cat’s Script

「スクラッチしよう!1-2 ネコを上下に動かそう!」のネコのスクリプト
ネコのスクリプト

Let me explain how to program this

Cat’s Script

Programming to make the cat keep walking upward

scratchのネコが上に歩き続けるスクリプト
うえあるつづけるスクリプト

Programming to make the cat change direction when it touches the edge

scratchのネコが端に当たると向きを変えるスクリプト
はしたると、きをえるスクリプト

Programming to keep the cat facing right

scratchのネコをずっと右向きにするコードは「回転方法を左右のみにする」コード
ネコをみぎきにするやりかた
スポンサーリンク

When programming the cat to move, always pay attention to the “direction”!

When moving a sprite (in this case, the cat), you always need to set the “direction in degrees.”

If you don’t set anything, it’s always set to “direction 90 degrees.”

ラッチ先生
ラッチ先生

Look here!
Sprites (in this case, the cat) are always set to face right.

In other words, the direction is always set to 90 degrees.

So, if you don’t program anything (give instructions to the computer), all sprites will face right and move to the right when they move.

scratchのスプライトの向きがわかる「向き」の場所
き」を
ラッチ先生
ラッチ先生

First, let’s remember the four directions and angles of the sprite (in this case, the cat)!

scratchのスプライトの向き 上向きは0度、右向きは90度
うえき=0みぎき=90
scratchのスプライトの向き 下向きは180度、左向きは‐90度
したき=180ひだりき=-90
スック
スック

Oh no!

When facing left, the sprite (cat) turned upside down!!

ラッチ先生
ラッチ先生

If your sprite (in this case, the cat) is upside down while programming,
click here and set it to “left-right only”!

That will fix the upside-down sprite (in this case, the cat)!

scratchのスプライト 「左右のみ」をクリックするとスプライトの逆さが直る
左右さゆうのみ」をクリックしてネコのさかさをなお
スポンサーリンク

Summary

ラッチ先生
ラッチ先生

Today, we learned programming to “move the cat up and down.”

What we learned in today’s programming

ラッチ先生
ラッチ先生

When moving a sprite, decide its direction.

「〇ける」コード
「90ける」コード
  • Set the sprite’s direction
scratch「〇度に向ける」コードの役目
スプライトの向きを決める
「〇ける」コードのスプライトの
ラッチ先生
ラッチ先生

We also learned how to make the sprite (cat) face only left or right when moving up or down.

スプライトを右向きにする方法
  • Click “left-right only” in the direction settings
scratchのスプライトの向きを右無二にするときは「向き」の「左右のみ」をクリックする
き」の「左右さゆうのみ」をクリック

The sprite will always face right

scratchのスプライトはずっと右向きになる
スプライトはずっとみぎ
スポンサーリンク

What will happen?

ラッチ先生<br>
ラッチ先生

Let’s change the number in the “point in direction 0” code!

Try “40” or “156”…

Enter your favorite number and see how the cat moves!

You’ll see interesting movements when the cat hits the edge!!

「〇度に向ける」コードの数字を40に変える
「〇ける」コード数字すうじえる
スック
スック

Hey, hey, Teacher Ratch!

What if I enter “1000”?

What will happen to the cat?

ラッチ先生
ラッチ先生

Oh! That’s interesting!!
Go ahead and enter “1000” right away.

 It’s good to imagine how the cat will move before trying it!

It’s exciting to see if your guess is correct!

After moving the cat, look at where you entered “1000”!

What happened?


ラッチ先生
ラッチ先生

That’s all for today’s programming lesson!

We learned that sprite movement always has a “direction”!

 If your sprite doesn’t move in the direction you expected,
check the direction setting.

Also, if your sprite is upside down, click “left-right only” in the direction settings!

「向き」の「左右のみ」をクリックしたらscratchのスプライトの逆さまがなおる
き」の「左右さゆうのみ」をクリックして ネコのさかさをなお

See you next time!!

スック
スック

See you later!

(@^^)/~~~

コメント