![ラッチ先生](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/2022/07/ratch_kao_yes-2-300x300.png)
今回は、「ねっち暗黒迷路!」でぇ~す!
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyou1057-2gif.gif)
![スック](https://scratchsiyou.com/wp-content/uploads/2023/01/sukku_futu-1-300x300.png)
これは、簡単ゲーム「ねっち 迷路」に プログラムを追加して 作ったよ。
「ねっち迷路」のプログラムの 作り方は、こちらからどうぞ!
![ラッチ先生](https://scratchsiyou.com/wp-content/uploads/2023/01/ratch_kao_dounaru-1.png)
「ねっち迷路」を 暗闇にし ボールにライトを あてる プログラムだよ
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch 暗闇にライトをつけるスクリプト](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyou1057-4gif.gif)
![スック](https://scratchsiyou.com/wp-content/uploads/2023/01/sukku_are-1-300x300.png)
えっ!
たった5つのブロックで、できちゃうの…。
![ラッチ先生](https://scratchsiyou.com/wp-content/uploads/2023/02/ratch_kao_yes-300x300.png)
そうだよぉ……ん!
簡単でしょ!
![スック](https://scratchsiyou.com/wp-content/uploads/2023/01/sukku_futu-1-300x300.png)
うん。
![ラッチ先生](https://scratchsiyou.com/wp-content/uploads/2023/01/ratch_kao_dounaru.png)
それでは、はじめるよ!
![スック](https://scratchsiyou.com/wp-content/uploads/2023/01/sukku_ok-1-300x300.png)
了解!
それでは、楽しくプログラミングを学んでいきましょう!
今回作るスクラッチの作品は、これっ!
![スック](https://scratchsiyou.com/wp-content/uploads/2022/10/sukku_futu-300x300.png)
おもしろいよ!
今回のプログラミングで学ぶことは
1.暗闇の 作り方が わかるよ
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch 暗闇にする](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1057_explanation5.png)
2.暗闇に ライトをつける スクリプトがわかるよ
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch 暗闇にライトをつける](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyou1057-5gif.gif)
プログラミングの仕方を説明します
暗闇の作り方
1.暗闇の 作り方が わかるよ
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch 暗闇にする](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1057_explanation5.png)
![ラッチ先生<br>](https://scratchsiyou.com/wp-content/uploads/2021/12/ratch_kao_dounaru.png)
最初に、
スプライト「ライト」を 作ります。
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch スプライト「ライト」](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1057_explanation6.png)
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch コスチューム「ライト」](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1057_explanation9.png)
![スック](https://scratchsiyou.com/wp-content/uploads/2023/01/sukku_futu-300x300.png)
スプライト「ライト」の 作り方だよ。
1.スプライト「ライト」を 作る
フリーBGM:DOVA-SYNDROME 午後のカメレオンは星の波動を数え… written by Masuo
![スック](https://scratchsiyou.com/wp-content/uploads/2023/01/sukku_futu-300x300.png)
ライトの円の大きさを 「250×250」にしたけど、
これを目安に、自由に大きさを 決めてね!
![ラッチ先生<br>](https://scratchsiyou.com/wp-content/uploads/2021/12/ratch_kao_dounaru.png)
さて、ここで問題が おこるんだ。
緑の旗を クリックすると…
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch ライトを追加することによる問題](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyou1057-7gif.gif)
![スック](https://scratchsiyou.com/wp-content/uploads/2023/02/sukku_question-300x300.png)
あれっ…?
ロボが 壁の中に 現れるよ…
![ラッチ先生<br>](https://scratchsiyou.com/wp-content/uploads/2021/12/ratch_kao_dounaru.png)
そうなんだ。
スプライト「ライト」を 追加したことによって 新しい問題が 出てくるんだ。
こちらで解説するね。
フリーBGM:DOVA-SYNDROME 午後のカメレオンは星の波動を数え… written by Masuo
問題点:迷路の色が 赤色でなくなり、ロボが 迷路に ふれてしまう。
![スック](https://scratchsiyou.com/wp-content/uploads/2023/01/sukku_futu-1-300x300.png)
なるほどね!
「○色に触れた」ブロックの
![scratch 「○色に触れた」ブロック](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1057_explanation12.png)
赤色では なくなっちゃうんだね!
![ラッチ先生<br>](https://scratchsiyou.com/wp-content/uploads/2021/12/ratch_kao_dounaru.png)
そう!
だから、ロボを迷路に 触れないようにするには、
迷路の色では プログラムできないんだ。
![スック](https://scratchsiyou.com/wp-content/uploads/2023/02/sukku_question-300x300.png)
じゃあ…、どうするの?
![ラッチ先生<br>](https://scratchsiyou.com/wp-content/uploads/2023/02/ratch_kao_yes-300x300.png)
スプライト「迷路」を
![スプライト「迷路」](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1057_explanation13.png)
作ればいいんだよ!
![スック](https://scratchsiyou.com/wp-content/uploads/2023/02/sukku_un-300x300.png)
ん…
![ラッチ先生<br>](https://scratchsiyou.com/wp-content/uploads/2023/01/ratch_kao_dounaru-1.png)
こちらで、解説するね!
2.スプライト「迷路」を 作る
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch スプライト「迷路」](https://scratchsiyou.com/wp-content/uploads/2023/03/image.png)
![](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1057_explanation22-1.jpg)
フリーBGM:DOVA-SYNDROME 午後のカメレオンは星の波動を数え… written by Masuo
![スック](https://scratchsiyou.com/wp-content/uploads/2023/01/sukku_futu-1-300x300.png)
コスチューム名を
・コスチューム1⇒「迷路」
・コスチューム2⇒「クリア」
に したよ!
![ラッチ先生<br>](https://scratchsiyou.com/wp-content/uploads/2023/01/ratch_kao_dounaru-1.png)
次は、
「○色に触れた」ブロックを
![「○色に触れた」ブロック](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1057_explanation12.png)
「○に触れた」ブロックに
![「○に触れた」ブロック](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1057_explanation23.png)
変えるよ!
![スック](https://scratchsiyou.com/wp-content/uploads/2023/01/sukku_futu-1-300x300.png)
まずは、スプライト「ロボ」の
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch スプライト「ロボ」](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1056_explanation28-1.png)
プログラムから 変えるよ
3.「○に触れた」ブロックを 変える(ロボ)
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch 「○に触れた」ブロックに変える①](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyou1057-11gif-4.gif)
![スック](https://scratchsiyou.com/wp-content/uploads/2023/01/sukku_futu-1-300x300.png)
そして、スプライト「ボール」の
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch スプライト「ボール」](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1056_explanation32-1.png)
プログラムも 変えるよ
3.「○に触れた」ブロックを 変える(ボール)
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch 「○に触れた」ブロックに変える②](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyou1057-13gif-2.gif)
![ラッチ先生<br>](https://scratchsiyou.com/wp-content/uploads/2023/01/ratch_kao_dounaru-1.png)
スプライト「迷路」の場所を
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch スプライト「迷路」](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1057_explanation13-1.png)
「x座標を○、y座標を○にする」ブロックで
![「x座標を○、y座標を○にする」ブロック](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1057_explanation28.png)
決めましょう。
4.スプライト「迷路」の場所を 決める
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch 迷路の場所を決めるスクリプト](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1057_explanation33.png)
![スック](https://scratchsiyou.com/wp-content/uploads/2023/01/sukku_futu-1-300x300.png)
「コスチュームを○にする」ブロックで
![「コスチュームを○にする」ブロック](https://scratchsiyou.com/wp-content/uploads/2024/02/18.png)
ゲームの始まりに「迷路」が 表示するようにしたよ
ボールに ライトを当てるプログラミング
2.暗闇に ライトをつける スクリプトがわかるよ
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch 暗闇にライトをつける](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyou1057-5gif.gif)
![ラッチ先生<br>](https://scratchsiyou.com/wp-content/uploads/2021/12/ratch_kao_dounaru.png)
スプライト「ライト」に
![](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1057_explanation10.png)
「○へ行く」ブロックを 使って
![](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1057_explanation11.png)
ボールと 同じ動きをするように プログラムします
1.ライトを ボールに あてる
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch ボールをライトに当てるスクリプト](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyou1057-15gif.gif)
![スック](https://scratchsiyou.com/wp-content/uploads/2023/01/sukku_are-1-300x300.png)
あれっ?
迷路が 見えちゃってるよ
![ラッチ先生<br>](https://scratchsiyou.com/wp-content/uploads/2023/02/ratch_kao_yes-300x300.png)
あらっ!
スプライト「迷路」が一番上の層(レイヤー)に きてるね。
「○へ移動する」ブロックをつかって
![「○へ移動する」ブロック](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1057_explanation37.png)
スプライト「ライト」を 一番上に しましょう!
2.スプライト「ライト」を 一番上の層(レイヤー)にする
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch ライトを上にするスクリプト](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyou1057-17gif.gif)
![スック](https://scratchsiyou.com/wp-content/uploads/2023/01/sukku_ok-1-300x300.png)
おっ!
暗闇になったぞ
![ラッチ先生<br>](https://scratchsiyou.com/wp-content/uploads/2023/01/ratch_kao_dounaru-1.png)
ゲームクリアーしたのに、暗いままだね。
「隠す」ブロックをつかって、
![](https://scratchsiyou.com/wp-content/uploads/2024/02/3-1.png)
ボールが ねっちに触ったら、スプライト「ライト」を 消そう!
![スック](https://scratchsiyou.com/wp-content/uploads/2023/01/sukku_ok-1-300x300.png)
スプライト「迷路」のプログラムに
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch スプライト「迷路」](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1057_explanation13-2.png)
「コスチュームを○にする」ブロックをつかって
![「コスチュームを○にする」」ブロック](https://scratchsiyou.com/wp-content/uploads/2024/02/20.png)
ゲームクリアの背景を 表示したよ
3.ねっちに触ったら、明るくして ゲームクリアにする
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch クリアのスクリプト](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyou1057-19gif.gif)
![スック](https://scratchsiyou.com/wp-content/uploads/2023/01/sukku_ok-1-300x300.png)
「表示する」ブロックで
![「表示する」ブロック](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1057_explanation44.png)
ゲームスタートするときは、
スプライト「ライト」を表示して 暗闇にするよ!
![ラッチ先生<br>](https://scratchsiyou.com/wp-content/uploads/2023/01/ratch_kao_dounaru-1.png)
最後に、ロボに 当たったときの「ゲームオーバー」を 変えるよ。
こちらを ちょっと見てみて。
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch ゲームオーバー](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyou1057-21gif.gif)
![スック](https://scratchsiyou.com/wp-content/uploads/2023/01/sukku_are-1-300x300.png)
あれれ…
暗闇から「アウト!」と 言ってるよ
![ラッチ先生<br>](https://scratchsiyou.com/wp-content/uploads/2023/01/ratch_kao_dounaru-1.png)
そうなんだ。
せっかく暗闇にしたのに、ねっちの場所が わかっちゃうよね!
だから、「ボール」に 言わせるようプログラムするよ
![スック](https://scratchsiyou.com/wp-content/uploads/2023/01/sukku_futu-1-300x300.png)
うん。
![ラッチ先生<br>](https://scratchsiyou.com/wp-content/uploads/2023/01/ratch_kao_dounaru-1.png)
まずは、
スプライト「ねっち」にある
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch スプライト「ねっち」](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1056_explanation35.png)
ゲームオーバーのプログラムを
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch ゲームオーバーのプログラム](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1057_explanation45.png)
![スック](https://scratchsiyou.com/wp-content/uploads/2023/01/sukku_ok-1-300x300.png)
わかった!
スプライト「ボール」に、うつすんだね!
4.ロボに触ったら、ボールが「アウト!」と 言う
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch ゲームオーバーのスクリプト](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyou1057-23gif.gif)
![スック](https://scratchsiyou.com/wp-content/uploads/2023/01/sukku_ok-1-300x300.png)
これで、簡単ゲーム「ねっち暗黒迷路」のプログラミング、終了!
まとめ
![ラッチ先生](https://scratchsiyou.com/wp-content/uploads/2021/12/ratch_kao_dounaru.png)
お疲れさま!
「ねっち暗黒迷路!」のプログラミングが 終わりました。
各スプライトのスクリプトです。
ボールのスクリプト
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch ボールのスクリプト](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1057_explanation47.png)
ねっちのスクリプト
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch ねっちのスクリプト](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1057_explanation48.png)
ロボのスクリプト
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch ロボのスクリプト](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1057_explanation49.png)
立入禁止のスクリプト
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch 立入禁止のスクリプト](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1056_explanation48.png)
ライトのスクリプト
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch ライトのスクリプト](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1057_explanation50.png)
迷路のスクリプト
![「スクラッチしよう!10-57 ねっち暗黒迷路!」 scratch 迷路のスクリプト](https://scratchsiyou.com/wp-content/uploads/2023/03/scratchsiyoutitle1057_explanation51.png)
![スック](https://scratchsiyou.com/wp-content/uploads/2022/11/sukku_futu-300x300.png)
できたぁ!
![ラッチ先生](https://scratchsiyou.com/wp-content/uploads/2021/12/ratch_kao_dounaru.png)
これからも楽しいゲームのプログラミングを紹介していきます。
お楽しみに!
それじゃあ、またっ!
![スック](https://scratchsiyou.com/wp-content/uploads/2021/12/sukku_futu-300x300.png)
まったねえーーー!
(@^^)/~~~
ステップアップドリル
![ラッチ先生](https://scratchsiyou.com/wp-content/uploads/2021/12/ratch_kao_dounaru.png)
「変数」って、なあに?
「変数」ブロックって、どう使うの?
と 思っている方に!
変数ブロックでのプログラミングを 学べるドリルを 作りました
![ラッチ先生](https://scratchsiyou.com/wp-content/uploads/2021/12/ratch_kao_dounaru.png)
「リスト」って、なあに?
「リスト」ブロックって、どう使うの?
と 思っている方はこちら!
リストブロックでのプログラミングを 学べるドリルを 作りました
![スック](https://scratchsiyou.com/wp-content/uploads/2022/01/sukku_futu-300x300.png)
画面を クリックすると
「ステップアップドリル」のサイトへ 行けます!
コメント