![ラッチ先生](https://scratchsiyou.com/wp-content/uploads/2021/12/ratch_kao_dounaru.png)
こんにちは!
「ステップアップドリル:変数ブロックの使い方入門」に ようこそ!
「スクラッチしよう!楽しく学ぶプログラミング教室」の担任ラッチです。
![スック](https://scratchsiyou.com/wp-content/uploads/2022/01/sukku_futu-300x300.png)
スックだよ!
![ラッチ先生](https://scratchsiyou.com/wp-content/uploads/2021/12/ratch_kao_dounaru.png)
今回の「ステップアップドリル」で作る作品は、こちら!
![「スクラッチしよう!8-1-05 ステップアップドリル:ねっちコイン タップゲーム!」 scratch](https://scratchsiyou.com/wp-content/uploads/2023/11/scratchdrillocal05-gif1-1.gif)
![スック](https://scratchsiyou.com/wp-content/uploads/2022/01/sukku_futu-300x300.png)
10秒以内に
ねっちカードをタップして ゲットしてね
![ラッチ先生](https://scratchsiyou.com/wp-content/uploads/2021/12/ratch_kao_dounaru.png)
ねっちカードのタップする数を ランダムにしました
![「スクラッチしよう!8-1-05 ステップアップドリル:ねっちコイン タップゲーム!」 scratch タップすると数字が変わる](https://scratchsiyou.com/wp-content/uploads/2023/11/scratchdrillocal05-gif10-1.gif)
ローカル変数「番号」ブロックが 使われているんだ
![変数ブロック](https://scratchsiyou.com/wp-content/uploads/2023/11/scratchdrillocal05-explanation1-1.png)
![](https://scratchsiyou.com/wp-content/uploads/2023/11/scratchdrillocal05-explanation2-3.png)
![新しい変数](https://scratchsiyou.com/wp-content/uploads/2023/11/scratchdrillocal05-explanation3.png)
![スック](https://scratchsiyou.com/wp-content/uploads/2023/11/sukku_futu-1-300x300.png)
タップする回数が いくつになるか
わからないんだね!
![ラッチ先生](https://scratchsiyou.com/wp-content/uploads/2021/12/ratch_kao_dounaru.png)
そうだよ!そこが このゲームのおもしろいところ。
それでは、ローカル変数が どのように使われているか 学んでいこう
![スック](https://scratchsiyou.com/wp-content/uploads/2023/09/sukku_ok-300x300.png)
ラジャ!
今回作るスクラッチの作品は、これっ!
![スック](https://scratchsiyou.com/wp-content/uploads/2023/07/sukku_futu-1-300x300.png)
やみつきに なるよ!
今回のプログラミングで 学ぶことは
1.10枚のコインを 表示するスクリプトが わかるよ
![](https://scratchsiyou.com/wp-content/uploads/2023/12/scratchdrillocal05-gif13.gif)
2.タップして コインをゲットする スクリプトが わかるよ
3.10秒後 判定をする スクリプトが わかるよ
![「スクラッチしよう!8-1-05 ステップアップドリル:ねっちコイン タップゲーム!」 scratch 判定する](https://scratchsiyou.com/wp-content/uploads/2023/11/scratchdrillocal05-explanation6.png)
プログラミングの仕方を説明します
10枚のコインを 表示するプログラミング
1.10枚のコインを 表示するスクリプトが わかるよ
![](https://scratchsiyou.com/wp-content/uploads/2023/12/scratchdrillocal05-gif13.gif)
![ラッチ先生](https://scratchsiyou.com/wp-content/uploads/2021/12/ratch_kao_dounaru.png)
最初に、スプライト「ねっち」「コイン」を 描きます
![「スクラッチしよう!8-1-05 ステップアップドリル:ねっちコイン タップゲーム!」 scratch スプライト](https://scratchsiyou.com/wp-content/uploads/2023/11/scratchdrillocal05-explanation7-2.png)
![「スクラッチしよう!8-1-05 ステップアップドリル:ねっちコイン タップゲーム!」 scratch コスチュームと背景](https://scratchsiyou.com/wp-content/uploads/2023/11/scratchdrillocal05-explanation14-3-800x583.png)
![スック](https://scratchsiyou.com/wp-content/uploads/2023/07/sukku_futu-1-300x300.png)
各スプライトの コスチュームの作り方は
こちらの動画で 説明してるよ
フリーBGM:DOVA-SYNDROME 午後のカメレオンは星の波動を数え… written by Masuo
![ラッチ先生](https://scratchsiyou.com/wp-content/uploads/2021/12/ratch_kao_dounaru.png)
スプライト「コイン」で
![「スクラッチしよう!8-1-05 ステップアップドリル:ねっちコイン タップゲーム!」 scratch スプライト「コイン」](https://scratchsiyou.com/wp-content/uploads/2023/11/scratchdrillocal05-explanation13-1.png)
プログラムを 作っていこう!
![スック](https://scratchsiyou.com/wp-content/uploads/2023/07/sukku_futu-1-300x300.png)
いいよ!
![ラッチ先生](https://scratchsiyou.com/wp-content/uploads/2021/12/ratch_kao_dounaru.png)
まず、
「○をクローンを作る」ブロックで
![「○のクローンを作る」ブロック](https://scratchsiyou.com/wp-content/uploads/2023/11/scratchdrillocal05-explanation16.png)
10枚のコインを 表示させるよ
![スック](https://scratchsiyou.com/wp-content/uploads/2023/07/sukku_futu-1-300x300.png)
「コスチュームを○にする」ブロックで
![「コスチュームを○にする」ブロック](https://scratchsiyou.com/wp-content/uploads/2023/11/scratchdrillocal05-explanation17.png)
「ねっちコイン」に なるように するよ
1.コインを 10枚 表示する
![スック](https://scratchsiyou.com/wp-content/uploads/2023/07/sukku_futu-1-300x300.png)
ラッチ先生!
このスクリプトだと
コインが はみ出したり
![「スクラッチしよう!8-1-05 ステップアップドリル:ねっちコイン タップゲーム!」 scratch コインがはみ出す](https://scratchsiyou.com/wp-content/uploads/2023/11/scratchdrillocal05-explanation26.png)
重なったりするんだよね
![「スクラッチしよう!8-1-05 ステップアップドリル:ねっちコイン タップゲーム!」 scratch コインが重なる](https://scratchsiyou.com/wp-content/uploads/2023/11/scratchdrillocal05-explanation27.png)
![ラッチ先生](https://scratchsiyou.com/wp-content/uploads/2023/11/ratch_kao_yes-2-300x300.png)
スック!そのとぉぉぉ…り!学んでるね
これだと、タップしずらいよね
今回は、「○でない」ブロックを 使って、タップしやすい場所に 表示します
![「○ではない」ブロック](https://scratchsiyou.com/wp-content/uploads/2023/11/scratchdrillocal05-explanation33.png)
条件:はみ出す
条件:重なる
この条件は ダメ
![「○また○」ブロック](https://scratchsiyou.com/wp-content/uploads/2023/11/scratchdrillocal05-explanation34-1.png)
2.はみ出さない・重ならないように 表示する
![スック](https://scratchsiyou.com/wp-content/uploads/2023/11/sukku_are-2-300x300.png)
ねぇ…、ラッチ先生
コインが パラパラと 表示されてるよ。
パッと、いっぺんに 表示できないの?
![ラッチ先生](https://scratchsiyou.com/wp-content/uploads/2023/11/ratch_kao_dounaru-1.png)
これは、
「○まで繰り返す」ブロックで
![「○まで繰り返す」ブロック](https://scratchsiyou.com/wp-content/uploads/2023/11/scratchdrillocal05-explanation44-4.png)
コインの表示する場所を 探しているから 時間が かかるんだよね。
![スック](https://scratchsiyou.com/wp-content/uploads/2023/11/sukku_futu-2-300x300.png)
うん、うん。
![ラッチ先生](https://scratchsiyou.com/wp-content/uploads/2023/11/ratch_kao_dounaru-1.png)
こういう場合は、「ターボモード」にして、
![「ターボモード」](https://scratchsiyou.com/wp-content/uploads/2023/11/scratchdrillocal05-explanation37.png)
パワーアップさせよう!
パソコンの プログラムを 処理するスピードが 速くなるんだ!
![スック](https://scratchsiyou.com/wp-content/uploads/2023/11/sukku_futu-2-300x300.png)
おぉ!
パッと コインが 表示されたぞ
タップすると 数字が 変わるプログラミング
2.タップして コインを ゲットする スクリプトが わかるよ
![ラッチ先生](https://scratchsiyou.com/wp-content/uploads/2023/11/ratch_kao_dounaru-1.png)
さあ、次は、
ローカル変数「数字」を 使って
![変数ブロック](https://scratchsiyou.com/wp-content/uploads/2023/11/scratchdrillocal05-explanation1-2.png)
![変数表示](https://scratchsiyou.com/wp-content/uploads/2023/11/scratchdrillocal05-explanation2-2.png)
コインを タップしたら 数字が 出るようにしましょう
コメント