<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>サトシ | はじめてのスクラッチ</title>
	<atom:link href="https://scratch.earth-shop.net/author/earth_shop1982/feed/" rel="self" type="application/rss+xml" />
	<link>https://scratch.earth-shop.net</link>
	<description>こどもから大人まで、レッツ・エンジョイ・プログラミング！！</description>
	<lastBuildDate>Fri, 26 Jan 2024 05:26:37 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://scratch.earth-shop.net/wp-content/uploads/10_common/1_site/favicon-100x100.png</url>
	<title>サトシ | はじめてのスクラッチ</title>
	<link>https://scratch.earth-shop.net</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>小学生のための簡単「アンダーテール」の作り方</title>
		<link>https://scratch.earth-shop.net/pg_under-tale/</link>
					<comments>https://scratch.earth-shop.net/pg_under-tale/#respond</comments>
		
		<dc:creator><![CDATA[サトシ]]></dc:creator>
		<pubDate>Wed, 03 Jan 2024 19:47:10 +0000</pubDate>
				<category><![CDATA[有名なあのゲームを作る]]></category>
		<guid isPermaLink="false">https://scratch.earth-shop.net/?p=4525</guid>

					<description><![CDATA[完成版を動画で見る アンダーテールは、アメリカ人の作曲家兼ゲーム開発者であるトビー・フォックス氏によってほぼ一人で開発されました。100万本以上の売り上げを記録した人気の作品です。こんなゲームが作れるようになりたいですね [&#8230;]]]></description>
										<content:encoded><![CDATA[<div class="template-box block-box template-12"><p><!-- wp:image {"align":"center","id":4733,"sizeSlug":"full","linkDestination":"custom"} --></p>
<figure class="wp-block-image aligncenter size-full"><a rel="noopener" target="_blank" href="https://earth-shop.net/online-lesson/"><img fetchpriority="high" decoding="async" width="700" height="200" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/1_common/ad-body2.jpg" alt="ad-body2" class="wp-image-4733" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/1_common/ad-body2.jpg 700w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/1_common/ad-body2-500x143.jpg 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/1_common/ad-body2-300x86.jpg 300w" sizes="(max-width: 700px) 100vw, 700px" /></a></figure>
<p><!-- /wp:image --></p>
</div>


<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-amber-border-color"><div class="caption-box-label block-box-label box-label fab-lightbulb"><span class="caption-box-label-text block-box-label-text box-label-text">今日のポイント</span></div><div class="caption-box-content block-box-content box-content">
<ul class="wp-block-list">
<li>枠の中だけしか移動できないようにする</li>



<li>処理の内容ごとにスクリプトを分けて、プログラムを見やすくする</li>
</ul>
</div></div>



<h2 class="wp-block-heading"><span id="toc1">完成版を動画で見る</span></h2>



<p class="wp-block-paragraph">アンダーテールは、アメリカ人の作曲家兼ゲーム開発者であるトビー・フォックス氏によってほぼ一人で開発されました。100万本以上の売り上げを記録した人気の作品です。こんなゲームが作れるようになりたいですね。</p>



<figure class="wp-block-embed aligncenter is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe title="【スクラッチ｜チャレンジ課題】第4回「アンダーテールを作る」（見本）" width="1256" height="707" src="https://www.youtube.com/embed/4q4LYGZpd38?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>



<h2 class="wp-block-heading"><span id="toc2">作品の全体像を確認する</span></h2>



<h3 class="wp-block-heading"><span id="toc3">主なスプライトと役割</span></h3>



<p class="wp-block-paragraph">このゲームで重要なスプライトについて説明します。</p>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/main-sprite.png"><img decoding="async" width="800" height="391" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/main-sprite-800x391.png" alt="main-sprite" class="wp-image-4537" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/main-sprite-800x391.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/main-sprite-500x244.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/main-sprite-300x147.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/main-sprite-768x375.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/main-sprite.png 1248w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<h4 class="wp-block-heading has-ex-a-color has-vivid-cyan-blue-background-color has-text-color has-background has-link-color has-medium-font-size wp-elements-a83c0d98f86020a624fd9e8e6fe6791f" style="font-style:normal;font-weight:100"><span class="fz-18px">① スプライト「フレーム」の役割</span></h4>



<p class="wp-block-paragraph">スプライト（ハートと敵の攻撃）が、フレームの外に出ないようにするために用意します。</p>



<h4 class="wp-block-heading has-ex-a-color has-green-background-color has-text-color has-background has-link-color wp-elements-fa5b2dfdb1c22a752e22381502c53dcd" style="font-style:normal;font-weight:100"><span class="fz-18px">② スプライト「ハート」の役割</span></h4>



<p class="wp-block-paragraph">ハートは、プレイヤーのことです。上下左右に移動して、敵の攻撃から逃げます。敵の攻撃に当たるとHP が減っていき、ゼロになると「ゲームオーバー」になります。</p>



<h4 class="wp-block-heading has-ex-a-color has-grey-background-color has-text-color has-background has-link-color wp-elements-62b0cdd5ff57ae0c08fd1f9448c6f0ce" style="font-style:normal;font-weight:100"><span class="fz-18px">③ スプライト「敵の攻撃」の役割</span></h4>



<p class="wp-block-paragraph">敵の攻撃を3種類作成します。</p>



<div class="wp-block-cocoon-blocks-column-3 column-wrap column-3 layout-box">
<div class="wp-block-cocoon-blocks-column-left column-left waku">
<p class="has-text-align-center wp-block-paragraph">トリエルの攻撃1</p>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="「アンダーテールを作る」トリエルの攻撃1" width="1256" height="707" src="https://www.youtube.com/embed/nMg_bS1UO70?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>
</div>



<div class="wp-block-cocoon-blocks-column-center column-center waku">
<p class="has-text-align-center wp-block-paragraph">トリエルの攻撃2</p>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="「アンダーテールを作る」トリエルの攻撃2" width="1256" height="707" src="https://www.youtube.com/embed/NtxUA-z8LkI?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>
</div>



<div class="wp-block-cocoon-blocks-column-right column-right waku">
<p class="has-text-align-center wp-block-paragraph">トリエルの攻撃3</p>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="「アンダーテールを作る」トリエルの攻撃3" width="1256" height="707" src="https://www.youtube.com/embed/8k1ZLt5b33U?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>
</div>
</div>



<h2 class="wp-block-heading"><span id="toc4">プログラミングをしよう</span></h2>



<p class="wp-block-paragraph">まずは、元になる作品をリミックスします。コスチュームや音などの素材が入っているよ。</p>



<div class="wp-block-cocoon-blocks-blogcard blogcard-type bct-none">

<a rel="noopener" target="_blank" href="https://scratch.mit.edu/projects/947360061/" title="https://scratch.mit.edu/projects/947360061/" class="blogcard-wrap external-blogcard-wrap a-wrap cf"><div class="blogcard external-blogcard eb-left cf"><div class="blogcard-label external-blogcard-label"><span class="fa"></span></div><figure class="blogcard-thumbnail external-blogcard-thumbnail"><img loading="lazy" decoding="async" src="https://s.wordpress.com/mshots/v1/https%3A%2F%2Fscratch.mit.edu%2Fprojects%2F947360061%2F?w=160&#038;h=90" alt="" class="blogcard-thumb-image external-blogcard-thumb-image" width="160" height="90" /></figure><div class="blogcard-content external-blogcard-content"><div class="blogcard-title external-blogcard-title">https://scratch.mit.edu/projects/947360061/</div><div class="blogcard-snippet external-blogcard-snippet"></div></div><div class="blogcard-footer external-blogcard-footer cf"><div class="blogcard-site external-blogcard-site"><div class="blogcard-favicon external-blogcard-favicon"><img loading="lazy" decoding="async" src="https://www.google.com/s2/favicons?domain=https://scratch.mit.edu/projects/947360061/" alt="" class="blogcard-favicon-image external-blogcard-favicon-image" width="16" height="16" /></div><div class="blogcard-domain external-blogcard-domain">scratch.mit.edu</div></div></div></div></a>
</div>



<h3 class="wp-block-heading has-ex-a-color has-vivid-cyan-blue-background-color has-text-color has-background has-link-color wp-elements-69d7324a55d09acb99a4b86b8f54e4a4" style="font-style:normal;font-weight:100"><span id="toc5">①「フレーム」をプログラミング</span></h3>



<h4 class="wp-block-heading">コスチューム</h4>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/frame.png"><img loading="lazy" decoding="async" width="301" height="194" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/frame.png" alt="frame" class="wp-image-4633"/></a></figure>



<h4 class="wp-block-heading">プログラムの流れ</h4>



<p class="wp-block-paragraph">フレームの範囲を設定するだけです。</p>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-frame.png"><img loading="lazy" decoding="async" width="800" height="313" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-frame-800x313.png" alt="program-frame" class="wp-image-4567" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-frame-800x313.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-frame-500x196.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-frame-300x118.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-frame-768x301.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-frame.png 1271w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<h4 class="wp-block-heading">プログラムの中身</h4>



<h5 class="wp-block-heading has-text-align-center">(1). フレームの範囲を設定</h5>



<p class="wp-block-paragraph">「x座標の上限」、・・・、「y座標の下限」といった変数は、「すべてのスプライト用」で作成します。ハートや敵の攻撃といったスプライトでも、この変数を利用したいからです。</p>



<figure class="wp-block-image aligncenter size-medium"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-frame2.png"><img loading="lazy" decoding="async" width="500" height="189" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-frame2-500x189.png" alt="program-frame2" class="wp-image-4576" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-frame2-500x189.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-frame2-300x113.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-frame2.png 769w" sizes="(max-width: 500px) 100vw, 500px" /></a></figure>



<div class="wp-block-cocoon-blocks-balloon-ex-box-1 speech-wrap sb-id-13 sbs-flat sbp-r sbis-cb cf block-box"><div class="speech-person"><figure class="speech-icon"><img decoding="async" src="https://scratch.earth-shop.net/wp-content/uploads/10_common/2_character/1_satoshi/3_satoshi_here-1.png" alt="サトシ先生" class="speech-icon-image"/></figure><div class="speech-name">サトシ先生</div></div><div class="speech-balloon">
<p class="wp-block-paragraph">設定する値は、フレームの位置やサイズによって異なります。みんなの作品に合わせてくださいね。</p>
</div></div>



<h4 class="wp-block-heading">ポイントを解説</h4>



<p class="wp-block-paragraph">フレームは、箱のようなものです。ハートが箱の外に出ないように、範囲を指定します。そのために、x座標の上限と下限、y座標の上限と下限を利用します。上限や下限を超えて移動しようとしたときに、超えないようにプログラム（移動前の位置に戻す、など）します。</p>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-frame1.png"><img loading="lazy" decoding="async" width="800" height="465" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-frame1-800x465.png" alt="program-frame1" class="wp-image-4676" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-frame1-800x465.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-frame1-500x291.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-frame1-300x174.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-frame1-768x446.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-frame1.png 960w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<h3 class="wp-block-heading has-text-align-left has-ex-a-color has-green-background-color has-text-color has-background has-link-color wp-elements-4d376dc6f69343aad46d52f9fbeb70ca" style="font-style:normal;font-weight:100"><span id="toc6">②「ハート」をプログラミング</span></h3>



<h4 class="wp-block-heading">コスチューム</h4>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/dbff0ee0a14ed0c4237f6b9c67fc1b07.png"><img loading="lazy" decoding="async" width="60" height="42" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/dbff0ee0a14ed0c4237f6b9c67fc1b07.png" alt="heart" class="wp-image-4619"/></a></figure>



<h4 class="wp-block-heading">プログラムの流れ</h4>



<p class="wp-block-paragraph">左に移動する、上に移動する、下に移動する、の処理は記載していません。右に移動する、とほとんど同じなので省略しています。</p>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart0.png"><img loading="lazy" decoding="async" width="800" height="494" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart0-800x494.png" alt="program-heart0" class="wp-image-4685" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart0-800x494.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart0-500x309.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart0-300x185.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart0-768x474.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart0.png 1138w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<h4 class="wp-block-heading">プログラムの中身</h4>



<h5 class="wp-block-heading has-text-align-center">(1). 最初の状態を設定</h5>



<figure class="wp-block-image aligncenter size-medium"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart.png"><img loading="lazy" decoding="async" width="500" height="126" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart-500x126.png" alt="program-heart" class="wp-image-4578" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart-500x126.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart-300x76.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart.png 532w" sizes="(max-width: 500px) 100vw, 500px" /></a></figure>



<h5 class="wp-block-heading has-text-align-center">(2). 上下左右の移動</h5>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart2.png"><img loading="lazy" decoding="async" width="800" height="367" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart2-800x367.png" alt="program-heart2" class="wp-image-4599" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart2-800x367.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart2-500x230.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart2-300x138.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart2-768x353.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart2.png 1017w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<h5 class="wp-block-heading has-text-align-center">(3). 敵の攻撃に当たったとき</h5>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart3.png"><img loading="lazy" decoding="async" width="800" height="334" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart3-800x334.png" alt="program-heart3" class="wp-image-4600" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart3-800x334.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart3-500x209.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart3-300x125.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart3-768x321.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart3.png 965w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<h4 class="wp-block-heading">ポイントを解説</h4>



<div class="wp-block-cocoon-blocks-balloon-ex-box-1 speech-wrap sb-id-13 sbs-flat sbp-r sbis-cb cf block-box"><div class="speech-person"><figure class="speech-icon"><img decoding="async" src="https://scratch.earth-shop.net/wp-content/uploads/10_common/2_character/1_satoshi/3_satoshi_here-1.png" alt="サトシ先生" class="speech-icon-image"/></figure><div class="speech-name">サトシ先生</div></div><div class="speech-balloon">
<p class="wp-block-paragraph">上下左右の移動について詳しく解説します。</p>
</div></div>



<p class="wp-block-paragraph">右に移動するときのプログラムを考えます。まず、x座標とはスプライトが横方向のどの位置にいるかを表すものです（y座標は縦方向の位置を決めるものです）。</p>



<p class="wp-block-paragraph">右に移動するときに大事なのは、フレームの右端から出ないようにすることです。フレームの右端は「x座標の上限」の値です。</p>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart01.png"><img loading="lazy" decoding="async" width="800" height="304" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart01-800x304.png" alt="program-heart01" class="wp-image-4680" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart01-800x304.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart01-500x190.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart01-300x114.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart01-768x292.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-heart01.png 991w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<p class="wp-block-paragraph">ハートが 「x座標 = 185」の位置にいたとします（上図）。 この状態で右に移動すると、x座標が 10 変わるので「x座標 = 195」になります。これは「x座標の上限」を超えた値、つまりフレームからはみ出した状態です。フレームからはみ出さないように、「x座標 = x座標の上限（190）」に戻します。</p>



<p class="wp-block-paragraph">上に移動するときは「y座標の上限」、下に移動するときは「y座標の下限」、左に移動するときは「x座標の下限」を使います。</p>



<h3 class="wp-block-heading has-ex-a-color has-grey-background-color has-text-color has-background has-link-color wp-elements-25eb5ed4b718e7118c3c6d3457a7e305" style="font-style:normal;font-weight:100"><span id="toc7">③「敵の攻撃」をプログラミング</span></h3>



<div class="wp-block-cocoon-blocks-balloon-ex-box-1 speech-wrap sb-id-15 sbs-flat sbp-r sbis-cb cf block-box"><div class="speech-person"><figure class="speech-icon"><img decoding="async" src="https://scratch.earth-shop.net/wp-content/uploads/10_common/2_character/1_satoshi/5_satoshi_point.png" alt="サトシ先生" class="speech-icon-image"/></figure><div class="speech-name">サトシ先生</div></div><div class="speech-balloon">
<p class="wp-block-paragraph">敵の攻撃は3種類あります。ここでは「トリエルの攻撃2」について詳しく見ていきましょう。</p>
</div></div>



<h4 class="wp-block-heading">コスチューム</h4>



<div class="wp-block-cocoon-blocks-column-3 column-wrap column-3 layout-box">
<div class="wp-block-cocoon-blocks-column-left column-left waku">
<p class="wp-block-paragraph">コスチューム名：1</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/torieru-attack2-1.png"><img loading="lazy" decoding="async" width="87" height="80" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/torieru-attack2-1.png" alt="torieru-attack2-1" class="wp-image-4629"/></a></figure>
</div>



<div class="wp-block-cocoon-blocks-column-center column-center waku">
<p class="wp-block-paragraph">コスチューム名：2</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/torieru-attack2-2.png"><img loading="lazy" decoding="async" width="106" height="76" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/torieru-attack2-2.png" alt="torieru-attack2-2" class="wp-image-4630"/></a></figure>
</div>



<div class="wp-block-cocoon-blocks-column-right column-right waku">
<p class="wp-block-paragraph">コスチューム名：3</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/torieru-attack2-3.png"><img loading="lazy" decoding="async" width="92" height="76" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/torieru-attack2-3.png" alt="torieru-attack2-3" class="wp-image-4631"/></a></figure>
</div>
</div>



<h4 class="wp-block-heading">プログラムの流れ</h4>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack.png"><img loading="lazy" decoding="async" width="800" height="496" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack-800x496.png" alt="program-attack" class="wp-image-4688" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack-800x496.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack-500x310.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack-300x186.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack-768x476.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack.png 1139w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<h4 class="wp-block-heading">プログラムの中身</h4>



<h5 class="wp-block-heading has-text-align-center">最初の状態</h5>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack1.png"><img loading="lazy" decoding="async" width="172" height="125" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack1.png" alt="program-attack1" class="wp-image-4612"/></a></figure>



<h5 class="wp-block-heading has-text-align-center">攻撃する</h5>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack2.png"><img loading="lazy" decoding="async" width="800" height="485" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack2-800x485.png" alt="program-attack2" class="wp-image-4615" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack2-800x485.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack2-500x303.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack2-300x182.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack2-768x465.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack2.png 1134w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<h4 class="wp-block-heading">ポイントを解説</h4>



<p class="wp-block-paragraph">「トリエルの攻撃2」のポイントは、クローンを作ったときに次の 3つのスクリプトが実行されることです。</p>



<ul class="wp-block-list">
<li>見た目を変えるためのスクリプト</li>



<li>左右に揺れるためのスクリプト</li>



<li>画面の下に落ちていくスクリプト</li>
</ul>



<p class="wp-block-paragraph">これを一つのスクリプトにまとめようとすると大変です。処理の内容ごとにスクリプトを分けると、難しい動きも簡単にプログラミングすることができます。</p>



<h3 class="wp-block-heading"><span id="toc8">④ その他のスプライト</span></h3>



<h4 class="wp-block-heading">トリエル</h4>



<h5 class="wp-block-heading has-text-align-center">コスチューム</h5>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/torieru.png"><img loading="lazy" decoding="async" width="84" height="114" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/torieru.png" alt="torieru" class="wp-image-4641"/></a></figure>



<h5 class="wp-block-heading has-text-align-center">プログラムの中身</h5>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-torieru.png"><img loading="lazy" decoding="async" width="622" height="474" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-torieru.png" alt="program-torieru" class="wp-image-4695" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-torieru.png 622w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-torieru-500x381.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-torieru-300x229.png 300w" sizes="(max-width: 622px) 100vw, 622px" /></a></figure>



<h4 class="wp-block-heading">上矢印</h4>



<h5 class="wp-block-heading has-text-align-center">コスチューム</h5>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/ue.png"><img loading="lazy" decoding="async" width="78" height="60" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/ue.png" alt="ue" class="wp-image-4645"/></a></figure>



<h5 class="wp-block-heading has-text-align-center">プログラムの中身</h5>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-ue.png"><img loading="lazy" decoding="async" width="702" height="495" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-ue.png" alt="program-ue" class="wp-image-4698" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-ue.png 702w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-ue-500x353.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-ue-300x212.png 300w" sizes="(max-width: 702px) 100vw, 702px" /></a></figure>



<h4 class="wp-block-heading">下矢印</h4>



<h5 class="wp-block-heading has-text-align-center">コスチューム</h5>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/shita.png"><img loading="lazy" decoding="async" width="78" height="60" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/shita.png" alt="shita" class="wp-image-4646"/></a></figure>



<h5 class="wp-block-heading has-text-align-center">プログラムの中身</h5>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-shita.png"><img loading="lazy" decoding="async" width="485" height="475" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-shita.png" alt="program-shita" class="wp-image-4697" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-shita.png 485w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-shita-300x294.png 300w" sizes="(max-width: 485px) 100vw, 485px" /></a></figure>



<h4 class="wp-block-heading">右矢印</h4>



<h5 class="wp-block-heading has-text-align-center">コスチューム</h5>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/migi.png"><img loading="lazy" decoding="async" width="61" height="78" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/migi.png" alt="migi" class="wp-image-4647"/></a></figure>



<h5 class="wp-block-heading has-text-align-center">プログラムの中身</h5>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-migi.png"><img loading="lazy" decoding="async" width="482" height="472" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-migi.png" alt="program-migi" class="wp-image-4700" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-migi.png 482w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-migi-300x294.png 300w" sizes="(max-width: 482px) 100vw, 482px" /></a></figure>



<h4 class="wp-block-heading">左矢印</h4>



<h5 class="wp-block-heading has-text-align-center">コスチューム</h5>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/hidari.png"><img loading="lazy" decoding="async" width="61" height="78" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/hidari.png" alt="hidari" class="wp-image-4648"/></a></figure>



<h5 class="wp-block-heading has-text-align-center">プログラムの中身</h5>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-hidari.png"><img loading="lazy" decoding="async" width="472" height="464" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-hidari.png" alt="program-hidari" class="wp-image-4701" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-hidari.png 472w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-hidari-300x295.png 300w" sizes="(max-width: 472px) 100vw, 472px" /></a></figure>



<h4 class="wp-block-heading">トリエルの攻撃1</h4>



<h5 class="wp-block-heading has-text-align-center">コスチューム</h5>



<div class="wp-block-cocoon-blocks-column-3 column-wrap column-3 layout-box">
<div class="wp-block-cocoon-blocks-column-left column-left waku">
<p class="wp-block-paragraph">コスチューム名：1</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/torieru-attack1-1.png"><img loading="lazy" decoding="async" width="86" height="80" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/torieru-attack1-1.png" alt="torieru-attack1-1" class="wp-image-4649"/></a></figure>
</div>



<div class="wp-block-cocoon-blocks-column-center column-center waku">
<p class="wp-block-paragraph">コスチューム名：2</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/torieru-attack1-2.png"><img loading="lazy" decoding="async" width="86" height="80" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/torieru-attack1-2.png" alt="torieru-attack1-2" class="wp-image-4650"/></a></figure>
</div>



<div class="wp-block-cocoon-blocks-column-right column-right waku">
<p class="wp-block-paragraph">コスチューム名：3</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/torieru-attack1-3.png"><img loading="lazy" decoding="async" width="64" height="268" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/torieru-attack1-3.png" alt="torieru-attack1-3" class="wp-image-4651"/></a></figure>
</div>
</div>



<h5 class="wp-block-heading has-text-align-center">プログラムの中身</h5>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack0.png"><img loading="lazy" decoding="async" width="800" height="586" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack0-800x586.png" alt="program-attack0" class="wp-image-4705" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack0-800x586.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack0-500x366.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack0-300x220.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack0-768x562.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack0.png 940w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<h4 class="wp-block-heading">トリエルの攻撃3</h4>



<h5 class="wp-block-heading has-text-align-center">コスチューム</h5>



<div class="wp-block-cocoon-blocks-column-2 column-wrap column-2 column-2-2-1-1 layout-box">
<div class="wp-block-cocoon-blocks-column-left column-left">
<p class="wp-block-paragraph">コスチューム名：短い骨</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/torieru-attack3-1.png"><img loading="lazy" decoding="async" width="48" height="92" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/torieru-attack3-1.png" alt="torieru-attack3-1" class="wp-image-4652"/></a></figure>
</div>



<div class="wp-block-cocoon-blocks-column-right column-right">
<p class="wp-block-paragraph">コスチューム名：長い骨</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/torieru-attack3-2.png"><img loading="lazy" decoding="async" width="48" height="290" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/torieru-attack3-2.png" alt="torieru-attack3-2" class="wp-image-4653"/></a></figure>
</div>
</div>



<h5 class="wp-block-heading has-text-align-center">プログラムの中身</h5>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack3-1-1.png"><img loading="lazy" decoding="async" width="800" height="276" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack3-1-1-800x276.png" alt="program-attack3-1" class="wp-image-4706" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack3-1-1-800x276.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack3-1-1-500x172.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack3-1-1-300x103.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack3-1-1-768x265.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack3-1-1.png 836w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack3-2-1.png"><img loading="lazy" decoding="async" width="800" height="478" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack3-2-1-800x478.png" alt="program-attack3-2" class="wp-image-4707" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack3-2-1-800x478.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack3-2-1-500x299.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack3-2-1-300x179.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack3-2-1-768x459.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program-attack3-2-1.png 988w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<h4 class="wp-block-heading">結果</h4>



<h5 class="wp-block-heading has-text-align-center">コスチューム</h5>



<div class="wp-block-cocoon-blocks-column-2 column-wrap column-2 column-2-2-1-1 layout-box">
<div class="wp-block-cocoon-blocks-column-left column-left">
<p class="wp-block-paragraph">コスチューム名：ゲームクリア</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/result1.png"><img loading="lazy" decoding="async" width="467" height="108" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/result1.png" alt="result1" class="wp-image-4656" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/result1.png 467w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/result1-300x69.png 300w" sizes="(max-width: 467px) 100vw, 467px" /></a></figure>
</div>



<div class="wp-block-cocoon-blocks-column-right column-right">
<p class="wp-block-paragraph">コスチューム名：ゲームオーバー</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/result2.png"><img loading="lazy" decoding="async" width="464" height="92" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/result2.png" alt="result2" class="wp-image-4657" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/result2.png 464w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/result2-300x59.png 300w" sizes="(max-width: 464px) 100vw, 464px" /></a></figure>
</div>
</div>



<h5 class="wp-block-heading has-text-align-center">プログラムの中身</h5>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program_result.png"><img loading="lazy" decoding="async" width="590" height="355" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program_result.png" alt="program_result" class="wp-image-4709" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program_result.png 590w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program_result-500x301.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/program_result-300x181.png 300w" sizes="(max-width: 590px) 100vw, 590px" /></a></figure>



<h2 class="wp-block-heading"><span id="toc9">よくある質問</span></h2>



<h3 class="wp-block-heading"><span id="toc10">Q1. フレームの枠からズレて移動しています</span></h3>



<p class="wp-block-paragraph">コスチュームが中心に配置されていないためだと思います。下図のように、①「コスチュームの x座標と y座標の値を 0」にして、②「画像を中心に移動」させてみてください。</p>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/costume.png"><img loading="lazy" decoding="async" width="800" height="312" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/costume-800x312.png" alt="costume" class="wp-image-4714" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/costume-800x312.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/costume-500x195.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/costume-300x117.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/costume-768x299.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/costume-1536x598.png 1536w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/under-tale/4525/costume.png 1948w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<h2 class="wp-block-heading"><span id="toc11">まとめ</span></h2>



<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-amber-border-color"><div class="caption-box-label block-box-label box-label fab-lightbulb"><span class="caption-box-label-text block-box-label-text box-label-text">今日のポイント</span></div><div class="caption-box-content block-box-content box-content">
<ul class="wp-block-list">
<li>枠の中だけしか移動できないようにする<br>⇒　x座標の上限や下限を使って、それを超えないようにプログラミングする</li>



<li>処理の内容ごとにスクリプトを分けて、プログラムを見やすくする</li>
</ul>
</div></div>



<div class="wp-block-cocoon-blocks-balloon-ex-box-1 speech-wrap sb-id-11 sbs-flat sbp-r sbis-cb cf block-box"><div class="speech-person"><figure class="speech-icon"><img decoding="async" src="https://scratch.earth-shop.net/wp-content/uploads/10_common/2_character/1_satoshi/1_satoshi_ok.png" alt="サトシ先生" class="speech-icon-image"/></figure><div class="speech-name">サトシ先生</div></div><div class="speech-balloon">
<p class="wp-block-paragraph">完成した作品は後日公開します。</p>
</div></div>


<div class="template-box block-box template-13"><p><!-- wp:image {"align":"center","id":4734,"sizeSlug":"full","linkDestination":"custom"} --></p>
<figure class="wp-block-image aligncenter size-full"><a rel="noopener" target="_blank" href="https://earth-shop.net/online-lesson/"><img loading="lazy" decoding="async" width="600" height="300" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/1_common/ad-body.jpg" alt="ad-body" class="wp-image-4734" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/1_common/ad-body.jpg 600w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/1_common/ad-body-500x250.jpg 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/1_common/ad-body-300x150.jpg 300w" sizes="(max-width: 600px) 100vw, 600px" /></a></figure>
<p><!-- /wp:image --></p>
</div>]]></content:encoded>
					
					<wfw:commentRss>https://scratch.earth-shop.net/pg_under-tale/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>スイカゲームの作り方</title>
		<link>https://scratch.earth-shop.net/pg-suika/</link>
					<comments>https://scratch.earth-shop.net/pg-suika/#respond</comments>
		
		<dc:creator><![CDATA[サトシ]]></dc:creator>
		<pubDate>Sun, 10 Dec 2023 20:44:58 +0000</pubDate>
				<category><![CDATA[有名なあのゲームを作る]]></category>
		<guid isPermaLink="false">https://scratch.earth-shop.net/?p=4252</guid>

					<description><![CDATA[【はじめに】完成した作品を見る フルーツの進化の順序は次の順番にしました。 　「イチゴ」⇒「リンゴ」⇒「バナナ」⇒「スイカ」 動画で確認する コードの中身を確認する 主なスプライトと役割 ① プレイヤー 「次に落とすフル [&#8230;]]]></description>
										<content:encoded><![CDATA[<div class="template-box block-box template-12"><p><!-- wp:image {"align":"center","id":4733,"sizeSlug":"full","linkDestination":"custom"} --></p>
<figure class="wp-block-image aligncenter size-full"><a rel="noopener" target="_blank" href="https://earth-shop.net/online-lesson/"><img loading="lazy" decoding="async" width="700" height="200" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/1_common/ad-body2.jpg" alt="ad-body2" class="wp-image-4733" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/1_common/ad-body2.jpg 700w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/1_common/ad-body2-500x143.jpg 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/1_common/ad-body2-300x86.jpg 300w" sizes="(max-width: 700px) 100vw, 700px" /></a></figure>
<p><!-- /wp:image --></p>
</div>


<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-amber-border-color"><div class="caption-box-label block-box-label box-label fab-lightbulb"><span class="caption-box-label-text block-box-label-text box-label-text">今日のポイント</span></div><div class="caption-box-content block-box-content box-content">
<ul class="wp-block-list">
<li>自分のスプライト（同じ種類のフルーツ）に当たったかどうかの判定方法</li>



<li>スプライト（フルーツ）が当たって進化するときは、進化が二回実行されないようにする</li>
</ul>
</div></div>



<h2 class="wp-block-heading"><span id="toc1">【はじめに】完成した作品を見る</span></h2>



<p class="wp-block-paragraph">フルーツの進化の順序は次の順番にしました。</p>



<p class="wp-block-paragraph">　「イチゴ」⇒「リンゴ」⇒「バナナ」⇒「スイカ」</p>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/evolution.png"><img loading="lazy" decoding="async" width="800" height="158" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/evolution-800x158.png" alt="evolution" class="wp-image-4352" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/evolution-800x158.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/evolution-500x99.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/evolution-300x59.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/evolution-768x152.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/evolution.png 821w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<h3 class="wp-block-heading"><span id="toc2">動画で確認する</span></h3>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="【スクラッチ｜チャレンジ課題】第3回「スイカゲームを作る」（見本）" width="1256" height="707" src="https://www.youtube.com/embed/JDF6jB8gCz0?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
</div></figure>



<h3 class="wp-block-heading" id="code-inside"><span id="toc3">コードの中身を確認する</span></h3>



<h4 class="wp-block-heading">主なスプライトと役割</h4>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/game-screen.png"><img loading="lazy" decoding="async" width="800" height="464" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/game-screen-800x464.png" alt="game-screen" class="wp-image-4355" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/game-screen-800x464.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/game-screen-500x290.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/game-screen-300x174.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/game-screen-768x445.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/game-screen.png 1087w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-background has-border-color has-ex-a-background-color has-blue-border-color"><div class="caption-box-label block-box-label box-label"><span class="caption-box-label-text block-box-label-text box-label-text">① プレイヤー</span></div><div class="caption-box-content block-box-content box-content">
<p class="wp-block-paragraph">「プレイヤー」を押すと、フルーツを地面に向かって落とすことができます。<br>左右の矢印キーで移動できます。</p>
</div></div>



<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-green-border-color"><div class="caption-box-label block-box-label box-label"><span class="caption-box-label-text block-box-label-text box-label-text">② 地面に落ちるフルーツ</span></div><div class="caption-box-content block-box-content box-content">
<p class="wp-block-paragraph">プレイヤーによって落とされます。<br>地面に当たるか、他のフルーツに当たるまで下に落ちていきます。<br>もし同じフルーツに当たったら、フルーツが進化します。<br>スイカ同士が当たった場合は、どちらのスイカも消えます。</p>
</div></div>



<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-grey-border-color"><div class="caption-box-label block-box-label box-label"><span class="caption-box-label-text block-box-label-text box-label-text">③ 地面</span></div><div class="caption-box-content block-box-content box-content">
<p class="wp-block-paragraph">フルーツが地面に落ちたかどうか判定するために用意します。<br>コードはありません。</p>
</div></div>



<h4 class="wp-block-heading">① プレイヤー</h4>



<p class="wp-block-paragraph">「次に落とすフルーツを選ぶ」と「フルーツを落とす」の２つのブロック定義を作成します。</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/player-blocks.png"><img loading="lazy" decoding="async" width="779" height="386" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/player-blocks.png" alt="player-blocks" class="wp-image-4348" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/player-blocks.png 779w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/player-blocks-500x248.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/player-blocks-300x149.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/player-blocks-768x381.png 768w" sizes="(max-width: 779px) 100vw, 779px" /></a></figure>



<p class="wp-block-paragraph">「緑の旗が押されたとき」、ブロック定義「次に落とすフルーツを選ぶ」を実行して見た目を変えます。プレイヤーが「地面に落ちるフルーツ」のいずれかと当たったらゲームオーバーとします。「プレイヤーが押されたとき」、表示されているフルーツを落とします。</p>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/player-blocks2.png"><img loading="lazy" decoding="async" width="800" height="670" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/player-blocks2-800x670.png" alt="player-blocks2" class="wp-image-4349" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/player-blocks2-800x670.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/player-blocks2-500x419.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/player-blocks2-300x251.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/player-blocks2-768x644.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/player-blocks2.png 883w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<h4 class="wp-block-heading">② 地面に落ちるフルーツ</h4>



<p class="wp-block-paragraph">下図の赤枠の部分は、フルーツをどこに表示させるかというコードです。同じ種類のフルーツ同士が当たって進化する場合は、フルーツ同士が当たった場所に進化後のフルーツを出現させます。プレイヤーが上から落とすフルーツの場合は、「プレイヤー」のいる位置にフルーツを出現させます。</p>



<p class="wp-block-paragraph">青枠の部分は、地面に触れるまで下に落ちていくコードです。落ちながら、他のフルーツに触れるかどうかチェックしています。もし触れた場合は、「このスクリプトを止める」を実行して、下に落ちるのを止めています。</p>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/fruits-blocks.png"><img loading="lazy" decoding="async" width="800" height="588" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/fruits-blocks-800x588.png" alt="fruits-blocks" class="wp-image-4368" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/fruits-blocks-800x588.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/fruits-blocks-500x367.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/fruits-blocks-300x220.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/fruits-blocks-768x564.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/fruits-blocks.png 882w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<p class="wp-block-paragraph">下図は、フルーツの進化に関するコードです。進化する場合は、「進化前のx座標」と「進化前のy座標」に今のフルーツの座標を保存します。進化後のフルーツの最初の位置は、保存した座標にします。</p>



<p class="wp-block-paragraph">下図のコードは「リンゴ」のスプライトのコードです。「リンゴ」同士に触れたかどうか確認し、進化する場合は、「バナナのクローンを作る（赤枠内の一番したのブロック）」ようにしています。「イチゴ」や「バナナ」、「スイカ」のスプライトもほとんど同じコードですが、何に触れたか、といった条件や進化するフルーツが変わります。</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/fruits-blocks2.png"><img loading="lazy" decoding="async" width="328" height="448" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/fruits-blocks2.png" alt="fruits-blocks2" class="wp-image-4369" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/fruits-blocks2.png 328w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/fruits-blocks2-300x410.png 300w" sizes="(max-width: 328px) 100vw, 328px" /></a></figure>



<h2 class="wp-block-heading"><span id="toc4">【詳しく】プログラムの解説</span></h2>


<div class="template-box block-box template-14"><p><!-- wp:image {"align":"center","id":4735,"sizeSlug":"full","linkDestination":"custom"} --></p>
<figure class="wp-block-image aligncenter size-full"><a rel="noopener" target="_blank" href="https://earth-shop.net/online-lesson/"><img loading="lazy" decoding="async" width="300" height="200" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/1_common/ad-side.jpg" alt="ad-side" class="wp-image-4735"/></a></figure>
<p><!-- /wp:image --></p>
</div>


<h3 class="wp-block-heading"><span id="toc5">① プレイヤー</span></h3>



<p class="wp-block-paragraph">プレイヤーのコスチュームは、下図の赤枠内の３つ（イチゴ、リンゴ、バナナ）用意します。</p>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/program_player.png"><img loading="lazy" decoding="async" width="800" height="618" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/program_player-800x618.png" alt="program_player" class="wp-image-4402" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/program_player-800x618.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/program_player-500x387.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/program_player-300x232.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/program_player-768x594.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/program_player.png 996w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-pale-pink-border-color"><div class="caption-box-label block-box-label box-label"><span class="caption-box-label-text block-box-label-text box-label-text">(1) ブロック定義「次に落とすフルーツを選ぶ」</span></div><div class="caption-box-content block-box-content box-content">
<p class="wp-block-paragraph">コスチュームの表示を変更します。<br>　その際、１から３までの乱数を使い、コスチュームを番号を指定して変更します。<br>　　１から３までとしたのは、プレイヤーのコスチュームの数が３つあるためです。<br>　　フルーツの数を増やす場合は、コスチュームを追加して乱数の数字も変更します。</p>
</div></div>



<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-pale-pink-border-color"><div class="caption-box-label block-box-label box-label"><span class="caption-box-label-text block-box-label-text box-label-text">(2) ブロック定義「フルーツを落とす」</span></div><div class="caption-box-content block-box-content box-content">
<p class="wp-block-paragraph">フルーツを落とすとき、プレイヤーで表示している同じ種類のフルーツを落とします。<br>　プレイヤーで表示しているフルーツは、「コスチュームの番号」で分かります。<br>　　例えば「コスチュームの番号＝１」なら、プレイヤーは「イチゴ」を表示しています。<br>　落とすフルーツのクローンを作成します。</p>
</div></div>



<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-luminous-vivid-amber-border-color"><div class="caption-box-label block-box-label box-label"><span class="caption-box-label-text block-box-label-text box-label-text">(3) 緑の旗が押されたとき</span></div><div class="caption-box-content block-box-content box-content">
<p class="wp-block-paragraph">プレイヤーを最初の位置（0, 150）に戻します。<br>ブロック定義「次に落とすフルーツを選ぶ」を実行します。<br>次に落とすフルーツを表示します。</p>
</div></div>



<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-luminous-vivid-amber-border-color"><div class="caption-box-label block-box-label box-label"><span class="caption-box-label-text block-box-label-text box-label-text">(4) このスプライトが押されたとき（フルーツを落とします）</span></div><div class="caption-box-content block-box-content box-content">
<p class="wp-block-paragraph">プレイヤーのフルーツを隠します。（<mark>これがないとすぐにゲームオーバーになってしまいます</mark>）<br>ブロック定義「フルーツを落とす」を実行します。<br>1 秒待ちます。（<mark>これがないとすぐにゲームオーバーになってしまいます</mark>）<br>ブロック定義「次に落とすフルーツを選ぶ」を実行します。<br>次に落とすフルーツを表示します。</p>
</div></div>



<h3 class="wp-block-heading"><span id="toc6">② 地面に落ちるフルーツ</span></h3>



<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-orange-border-color"><div class="caption-box-label block-box-label box-label"><span class="caption-box-label-text block-box-label-text box-label-text">グローバル変数「進化する？」</span></div><div class="caption-box-content block-box-content box-content">
<p class="wp-block-paragraph">[Yes] か [No] が入ります。フルーツがクローンされるときは２パターンあります。一つ目は、プレイヤーが上からフルーツを落とすときです。二つ目は、フルーツ同士が当たって次のフルーツに進化するときです。この２パターンを場合分けするために、「進化する？」という変数を使います。</p>
</div></div>



<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-orange-border-color"><div class="caption-box-label block-box-label box-label"><span class="caption-box-label-text block-box-label-text box-label-text">グローバル変数「進化前のx座標」、「進化前のy座標」</span></div><div class="caption-box-content block-box-content box-content">
<p class="wp-block-paragraph">同じ種類のフルーツが触れ合ったときの位置（「x座標」と「y座標」）を保存します。進化後のフルーツの最初の位置をこの座標に設定します。こうすることで、進化後のフルーツの位置を、フルーツが触れ合ったときの場所にすることができます。</p>
</div></div>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/program_fruits.png"><img loading="lazy" decoding="async" width="800" height="433" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/program_fruits-800x433.png" alt="program_fruits" class="wp-image-4419" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/program_fruits-800x433.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/program_fruits-500x271.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/program_fruits-300x162.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/program_fruits-768x416.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/program_fruits.png 1398w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-luminous-vivid-amber-border-color"><div class="caption-box-label block-box-label box-label"><span class="caption-box-label-text block-box-label-text box-label-text">(1) クローンされたとき（地面に当たるか、他のフルーツに当たるまで下に落ちていきます）</span></div><div class="caption-box-content block-box-content box-content">
<p class="wp-block-paragraph">進化の場合は、最初の位置は「進化前のx座標」と「進化前のy座標」になります。<br>進化でなければ（プレイヤーが上からフルーツを落とす場合）、「プレイヤー」の位置が最初の位置になります。<br>最初の位置を決めたら、「進化する？」を「No」にします。（<mark>これを忘れると、進化する際にフルーツが２つ出現します</mark>）<br>「地面」に触れるまで、下に落下していきます。<br>　もし、他のフルーツのスプライトに当たったら止めるようにします。</p>
</div></div>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/program_fruits2.png"><img loading="lazy" decoding="async" width="800" height="438" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/program_fruits2-800x438.png" alt="program_fruits2" class="wp-image-4421" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/program_fruits2-800x438.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/program_fruits2-500x274.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/program_fruits2-300x164.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/program_fruits2-768x421.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/suika/4252_pg-suika-simple/program_fruits2.png 1398w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-luminous-vivid-amber-border-color"><div class="caption-box-label block-box-label box-label"><span class="caption-box-label-text block-box-label-text box-label-text">(2) クローンされたとき（同じフルーツに当たったら、フルーツが進化します）</span></div><div class="caption-box-content block-box-content box-content">
<p class="wp-block-paragraph">同じ種類のフルーツに触れたかどうか、ずっとチェックします。<br>（上図はリンゴのスプライトです。そのため「リンゴ」と触れたかどうかチェックしています）</p>



<p class="wp-block-paragraph">もし「リンゴ」に触れた場合、「進化する？」で場合分けします。<br>　「進化する＝No」なら<br>　　下記の処理を実行して進化させます（<mark>触れた相手側のフルーツが下記の処理を重複して実行しないように「進化する？＝Yes」に変更します</mark>）<br>　　・進化のために値をセット（「進化前のx座標」、「進化前のy座標」<br>　　・進化のアニメーションを実行します（「進化」するを送って待つ）<br>　　・「バナナ」のクローンを作ってフルーツを進化させます。<br>　クローンを削除します（<mark>「進化する？」が「Yes」、「No」のどちらの場合でも</mark>）</p>
</div></div>



<div class="wp-block-cocoon-blocks-balloon-ex-box-1 speech-wrap sb-id-15 sbs-flat sbp-r sbis-cb cf block-box"><div class="speech-person"><figure class="speech-icon"><img decoding="async" src="https://scratch.earth-shop.net/wp-content/uploads/10_common/2_character/1_satoshi/5_satoshi_point.png" alt="サトシ先生" class="speech-icon-image"/></figure><div class="speech-name">サトシ先生</div></div><div class="speech-balloon">
<p class="wp-block-paragraph"><strong>ポイント①</strong>：同じ種類のフルーツに触れたかどうかのチェックは下記の記事が参考になります。</p>
</div></div>



<div class="wp-block-cocoon-blocks-blogcard blogcard-type bct-none">

<a target="_self" href="https://scratch.earth-shop.net/collision-detection-with-yourself/" title="自分のスプライト（クローン）との当たり判定をチェック" class="blogcard-wrap internal-blogcard-wrap a-wrap cf"><div class="blogcard internal-blogcard ib-left cf"><div class="blogcard-label internal-blogcard-label"><span class="fa"></span></div><figure class="blogcard-thumbnail internal-blogcard-thumbnail"><img loading="lazy" decoding="async" width="160" height="90" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself-160x90.jpg" class="blogcard-thumb-image internal-blogcard-thumb-image wp-post-image" alt="" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself-160x90.jpg 160w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself-120x68.jpg 120w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself-320x180.jpg 320w" sizes="(max-width: 160px) 100vw, 160px" /></figure><div class="blogcard-content internal-blogcard-content"><div class="blogcard-title internal-blogcard-title">自分のスプライト（クローン）との当たり判定をチェック</div><div class="blogcard-snippet internal-blogcard-snippet">今日のポイントスクラッチのバグ？を利用するサトシ先生自分のスプライトとの当たり判定をチェックしたいときってありますよね。実はスクラッチのバグを利用すると簡単にできるんですよ。問題点スクラッチには、自分自身に当たったかどうかを判定するブロック...</div></div><div class="blogcard-footer internal-blogcard-footer cf"><div class="blogcard-site internal-blogcard-site"><div class="blogcard-favicon internal-blogcard-favicon"><img loading="lazy" decoding="async" src="https://www.google.com/s2/favicons?domain=https://scratch.earth-shop.net" alt="" class="blogcard-favicon-image internal-blogcard-favicon-image" width="16" height="16" /></div><div class="blogcard-domain internal-blogcard-domain">scratch.earth-shop.net</div></div><div class="blogcard-date internal-blogcard-date"><div class="blogcard-post-date internal-blogcard-post-date">2023.12.06</div></div></div></div></a>
</div>



<div class="wp-block-cocoon-blocks-balloon-ex-box-1 speech-wrap sb-id-15 sbs-flat sbp-r sbis-cb cf block-box"><div class="speech-person"><figure class="speech-icon"><img decoding="async" src="https://scratch.earth-shop.net/wp-content/uploads/10_common/2_character/1_satoshi/5_satoshi_point.png" alt="サトシ先生" class="speech-icon-image"/></figure><div class="speech-name">サトシ先生</div></div><div class="speech-balloon">
<p class="wp-block-paragraph"><strong>ポイント②</strong>：進化を重複して実行しないように、「進化する？」という変数を使います。「進化する？＝No」のときだけ進化の処理をします。進化の処理をする際、初めに「進化する？＝Yes」に変更することで、次の処理は進化の処理を実行しないようにしています。</p>
</div></div>



<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-luminous-vivid-amber-border-color"><div class="caption-box-label block-box-label box-label"><span class="caption-box-label-text block-box-label-text box-label-text">(3) スプライト「星」：「進化する」を受け取ったとき</span></div><div class="caption-box-content block-box-content box-content">
<p class="wp-block-paragraph">星の位置を、「進化前のx座標」と「進化前のy座標」にします。<br>進化中のアニメーションを表現します。</p>
</div></div>



<h2 class="wp-block-heading"><span id="toc7">【やってみよう】プログラミング</span></h2>



<h3 class="wp-block-heading"><span id="toc8">リミックスしよう</span></h3>



<p class="wp-block-paragraph">下記のプロジェクトをリミックスして、スイカゲームを完成させよう！コスチュームは全て用意しているよ。穴埋めになっているプログラムを、解説などを参考にして埋めていこう。難しい場合は、「<a href="#code-inside" data-type="internal" data-id="#code-inside" rel="noopener">コードの中身を確認する</a>」に答えがのっているよ。</p>



<div class="wp-block-cocoon-blocks-blogcard blogcard-type bct-none">

<a rel="noopener" target="_blank" href="https://scratch.mit.edu/projects/938067660/" title="https://scratch.mit.edu/projects/938067660/" class="blogcard-wrap external-blogcard-wrap a-wrap cf"><div class="blogcard external-blogcard eb-left cf"><div class="blogcard-label external-blogcard-label"><span class="fa"></span></div><figure class="blogcard-thumbnail external-blogcard-thumbnail"><img loading="lazy" decoding="async" src="https://s.wordpress.com/mshots/v1/https%3A%2F%2Fscratch.mit.edu%2Fprojects%2F938067660%2F?w=160&#038;h=90" alt="" class="blogcard-thumb-image external-blogcard-thumb-image" width="160" height="90" /></figure><div class="blogcard-content external-blogcard-content"><div class="blogcard-title external-blogcard-title">https://scratch.mit.edu/projects/938067660/</div><div class="blogcard-snippet external-blogcard-snippet"></div></div><div class="blogcard-footer external-blogcard-footer cf"><div class="blogcard-site external-blogcard-site"><div class="blogcard-favicon external-blogcard-favicon"><img loading="lazy" decoding="async" src="https://www.google.com/s2/favicons?domain=https://scratch.mit.edu/projects/938067660/" alt="" class="blogcard-favicon-image external-blogcard-favicon-image" width="16" height="16" /></div><div class="blogcard-domain external-blogcard-domain">scratch.mit.edu</div></div></div></div></a>
</div>



<h2 class="wp-block-heading"><span id="toc9">まとめ</span></h2>



<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-amber-border-color"><div class="caption-box-label block-box-label box-label fab-lightbulb"><span class="caption-box-label-text block-box-label-text box-label-text">今日のポイント</span></div><div class="caption-box-content block-box-content box-content">
<ul class="wp-block-list">
<li>自分のスプライト（同じ種類のフルーツ）に当たったかどうかの判定は、スクラッチのバグを利用します</li>



<li>変数を使うことで、進化の処理が二回実行されないようにします</li>
</ul>
</div></div>



<div class="wp-block-cocoon-blocks-balloon-ex-box-1 speech-wrap sb-id-13 sbs-flat sbp-r sbis-cb cf block-box"><div class="speech-person"><figure class="speech-icon"><img decoding="async" src="https://scratch.earth-shop.net/wp-content/uploads/10_common/2_character/1_satoshi/3_satoshi_here-1.png" alt="サトシ先生" class="speech-icon-image"/></figure><div class="speech-name">サトシ先生</div></div><div class="speech-balloon">
<p class="wp-block-paragraph">完成した作品はこちらです。</p>
</div></div>



<div class="wp-block-cocoon-blocks-blogcard blogcard-type bct-none">

<a rel="noopener" target="_blank" href="https://scratch.mit.edu/projects/935309542/fullscreen/" title="https://scratch.mit.edu/projects/935309542/fullscreen/" class="blogcard-wrap external-blogcard-wrap a-wrap cf"><div class="blogcard external-blogcard eb-left cf"><div class="blogcard-label external-blogcard-label"><span class="fa"></span></div><figure class="blogcard-thumbnail external-blogcard-thumbnail"><img loading="lazy" decoding="async" src="https://s.wordpress.com/mshots/v1/https%3A%2F%2Fscratch.mit.edu%2Fprojects%2F935309542%2Ffullscreen%2F?w=160&#038;h=90" alt="" class="blogcard-thumb-image external-blogcard-thumb-image" width="160" height="90" /></figure><div class="blogcard-content external-blogcard-content"><div class="blogcard-title external-blogcard-title">https://scratch.mit.edu/projects/935309542/fullscreen/</div><div class="blogcard-snippet external-blogcard-snippet"></div></div><div class="blogcard-footer external-blogcard-footer cf"><div class="blogcard-site external-blogcard-site"><div class="blogcard-favicon external-blogcard-favicon"><img loading="lazy" decoding="async" src="https://www.google.com/s2/favicons?domain=https://scratch.mit.edu/projects/935309542/fullscreen/" alt="" class="blogcard-favicon-image external-blogcard-favicon-image" width="16" height="16" /></div><div class="blogcard-domain external-blogcard-domain">scratch.mit.edu</div></div></div></div></a>
</div>


<div class="template-box block-box template-13"><p><!-- wp:image {"align":"center","id":4734,"sizeSlug":"full","linkDestination":"custom"} --></p>
<figure class="wp-block-image aligncenter size-full"><a rel="noopener" target="_blank" href="https://earth-shop.net/online-lesson/"><img loading="lazy" decoding="async" width="600" height="300" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/1_common/ad-body.jpg" alt="ad-body" class="wp-image-4734" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/1_common/ad-body.jpg 600w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/1_common/ad-body-500x250.jpg 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/1_common/ad-body-300x150.jpg 300w" sizes="(max-width: 600px) 100vw, 600px" /></a></figure>
<p><!-- /wp:image --></p>
</div>]]></content:encoded>
					
					<wfw:commentRss>https://scratch.earth-shop.net/pg-suika/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>自分のスプライト（クローン）との当たり判定をチェック</title>
		<link>https://scratch.earth-shop.net/collision-detection-with-yourself/</link>
					<comments>https://scratch.earth-shop.net/collision-detection-with-yourself/#respond</comments>
		
		<dc:creator><![CDATA[サトシ]]></dc:creator>
		<pubDate>Tue, 05 Dec 2023 18:04:56 +0000</pubDate>
				<category><![CDATA[テクニック集]]></category>
		<guid isPermaLink="false">https://scratch.earth-shop.net/?p=4216</guid>

					<description><![CDATA[問題点 スクラッチには、自分自身に当たったかどうかを判定するブロックがありません。下図を使って説明します。 ネコ（Cat）のスプライトで、自分自身と当たったかどうかを判定したいとします。自分のスプライトと当たったかどうか [&#8230;]]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-amber-border-color"><div class="caption-box-label block-box-label box-label fab-lightbulb"><span class="caption-box-label-text block-box-label-text box-label-text">今日のポイント</span></div><div class="caption-box-content block-box-content box-content">
<ul class="wp-block-list">
<li>スクラッチのバグ？を利用する</li>
</ul>
</div></div>



<div class="wp-block-cocoon-blocks-balloon-ex-box-1 speech-wrap sb-id-15 sbs-flat sbp-r sbis-cb cf block-box"><div class="speech-person"><figure class="speech-icon"><img decoding="async" src="https://scratch.earth-shop.net/wp-content/uploads/10_common/2_character/1_satoshi/5_satoshi_point.png" alt="サトシ先生" class="speech-icon-image"/></figure><div class="speech-name">サトシ先生</div></div><div class="speech-balloon">
<p class="wp-block-paragraph">自分のスプライトとの当たり判定をチェックしたいときってありますよね。実はスクラッチのバグを利用すると簡単にできるんですよ。</p>
</div></div>



<h2 class="wp-block-heading"><span id="toc1">問題点</span></h2>



<p class="wp-block-paragraph">スクラッチには、自分自身に当たったかどうかを判定するブロックがありません。下図を使って説明します。</p>



<figure class="wp-block-image aligncenter size-medium"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself1.png"><img loading="lazy" decoding="async" width="500" height="395" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself1-500x395.png" alt="collision-detection-with-yourself1" class="wp-image-4222" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself1-500x395.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself1-800x632.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself1-300x237.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself1-768x607.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself1.png 957w" sizes="(max-width: 500px) 100vw, 500px" /></a></figure>



<p class="wp-block-paragraph">ネコ（Cat）のスプライトで、自分自身と当たったかどうかを判定したいとします。自分のスプライトと当たったかどうか判定するために、「●に触れた」ブロックを使います。</p>



<p class="wp-block-paragraph">青枠内の中からスプライトを選ぶのですが、「ネコ」のスプライトが存在しません。このように、自分自身との当たり判定をチェックするブロックはないのです。</p>



<h2 class="wp-block-heading"><span id="toc2">解決策</span></h2>



<p class="wp-block-paragraph">しかし、解決策があります。「ネコ」のコードの中に、「ネコに触れた」というブロックはないのですが、他のスプライトのコードの中には「ネコに触れた」というブロックがあります。なんと、そのブロックをネコのスプライトにコピーして使うのです。</p>



<p class="wp-block-paragraph">まず、ネコ以外のスプライトを選択します。ここではスイカを選択しました。スイカの中には、「ネコ（Cat）に触れた」というブロックがあります。</p>



<figure class="wp-block-image aligncenter size-medium"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself2.png"><img loading="lazy" decoding="async" width="500" height="395" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself2-500x395.png" alt="collision-detection-with-yourself2" class="wp-image-4233" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself2-500x395.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself2-800x632.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself2-300x237.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself2-768x607.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself2.png 957w" sizes="(max-width: 500px) 100vw, 500px" /></a></figure>



<p class="wp-block-paragraph">このブロックを、ドラッグ＆ドロップやコピー＆ペーストするなどして、ネコのスプライトにコピーします。</p>



<figure class="wp-block-image aligncenter size-medium"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself3.png"><img loading="lazy" decoding="async" width="500" height="395" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself3-500x395.png" alt="collision-detection-with-yourself3" class="wp-image-4234" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself3-500x395.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself3-800x632.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself3-300x237.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself3-768x607.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself3.png 957w" sizes="(max-width: 500px) 100vw, 500px" /></a></figure>



<p class="wp-block-paragraph">こうすることで、ネコのスプライトの中になかった「ネコに触れた」ブロックが使えるようになります。</p>



<figure class="wp-block-image aligncenter size-medium"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself4.png"><img loading="lazy" decoding="async" width="500" height="395" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself4-500x395.png" alt="collision-detection-with-yourself4" class="wp-image-4236" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself4-500x395.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself4-800x632.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself4-300x237.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself4-768x607.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4216_collision-detection-with-yourself/collision-detection-with-yourself4.png 957w" sizes="(max-width: 500px) 100vw, 500px" /></a></figure>



<h2 class="wp-block-heading"><span id="toc3">まとめ</span></h2>



<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-amber-border-color"><div class="caption-box-label block-box-label box-label fab-lightbulb"><span class="caption-box-label-text block-box-label-text box-label-text">今日のポイント</span></div><div class="caption-box-content block-box-content box-content">
<ul class="wp-block-list">
<li>自分自身との当たり判定のチェックは、他のスプライトの「●に触れた」ブロックをコピペして使う</li>



<li>●には、「自分自身のスプライト名」が入ります</li>
</ul>
</div></div>
]]></content:encoded>
					
					<wfw:commentRss>https://scratch.earth-shop.net/collision-detection-with-yourself/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>クローンの使い方</title>
		<link>https://scratch.earth-shop.net/clone/</link>
					<comments>https://scratch.earth-shop.net/clone/#respond</comments>
		
		<dc:creator><![CDATA[サトシ]]></dc:creator>
		<pubDate>Wed, 29 Nov 2023 05:02:00 +0000</pubDate>
				<category><![CDATA[テクニック集]]></category>
		<guid isPermaLink="false">https://scratch.earth-shop.net/?p=4145</guid>

					<description><![CDATA[クローンが使えるようになると色々なゲームが作れるようになります。ぜひクローンの使い方をマスターしましょう！ クローンには、次の３つのポイントがあります。ひとつずつ丁寧に解説していきます。 同じスプライトを画面に複数表示さ [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">クローンが使えるようになると色々なゲームが作れるようになります。ぜひクローンの使い方をマスターしましょう！</p>



<p class="wp-block-paragraph">クローンには、次の３つのポイントがあります。ひとつずつ丁寧に解説していきます。</p>



<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-amber-border-color"><div class="caption-box-label block-box-label box-label fab-lightbulb"><span class="caption-box-label-text block-box-label-text box-label-text">クローンのポイント</span></div><div class="caption-box-content block-box-content box-content">
<p class="wp-block-paragraph">① 同じスプライトを画面に複数表示させたいときに使う<br>② クローンは同じスクリプトを実行する<br>③ クローンごとに変数を持つことができる</p>
</div></div>



<h2 class="wp-block-heading"><span id="toc1">同じスプライトを画面に複数表示させたいときに使う</span></h2>



<p class="wp-block-paragraph">クローンを実行すると、クローンしたスプライトと同じものが画面上に表示されます。</p>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="クローン①同じスプライトを画面に複数表示させたいときに使う" width="1256" height="707" src="https://www.youtube.com/embed/Nx4tlVzPenA?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
</div></figure>



<p class="wp-block-paragraph">「クローン」というボタンを押すと、「ネコ」のスプライトがクローンされるように作りました。コードは次のようになります。</p>



<h3 class="wp-block-heading"><span id="toc2">「クローン」ボタンのコード</span></h3>



<figure class="wp-block-image aligncenter size-full"><img loading="lazy" decoding="async" width="339" height="166" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone1-1.png" alt="clone1-1" class="wp-image-4152" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone1-1.png 339w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone1-1-300x147.png 300w" sizes="(max-width: 339px) 100vw, 339px" /></figure>



<p class="wp-block-paragraph">上図のように別のスプライトのクローンを作ることもできますし、自分自身のクローンを作ることもできます。</p>



<h3 class="wp-block-heading"><span id="toc3">「ネコ」のスプライトのコード</span></h3>



<p class="wp-block-paragraph">クローンは同じ場所に作られるので、下記のようにクローンされたら「どこかの場所へ行く」ようにしました。こうすることでクローンが作られたことが分かりやすくなります。</p>



<figure class="wp-block-image aligncenter size-full"><img loading="lazy" decoding="async" width="339" height="166" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone1-2.png" alt="clone1-2" class="wp-image-4153" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone1-2.png 339w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone1-2-300x147.png 300w" sizes="(max-width: 339px) 100vw, 339px" /></figure>



<h3 class="wp-block-heading"><span id="toc4">まとめ：同じスプライトを画面に複数表示させたいときに使う</span></h3>



<p class="wp-block-paragraph">クローンを利用すれば、敵キャラクターをたくさん増やしたり、アイテムをいくつも画面上に並べたりすることができます。</p>



<h2 class="wp-block-heading"><span id="toc5">クローンは同じスクリプトを実行する</span></h2>



<h3 class="wp-block-heading"><span id="toc6">「ネコ」のスプライトのコード</span></h3>



<p class="wp-block-paragraph">「ネコ」のスプライトに、下記のようなコードを追加しました。「ネコ」のスプライトが押されたときに「x座標」を2秒言ったり、上や下の矢印キーを押すとその向きに移動するようなコードです。</p>



<figure class="wp-block-image aligncenter size-thumbnail"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone2-1.png"><img loading="lazy" decoding="async" width="300" height="502" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone2-1-300x502.png" alt="clone2-1" class="wp-image-4161" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone2-1-300x502.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone2-1.png 372w" sizes="(max-width: 300px) 100vw, 300px" /></a></figure>



<h3 class="wp-block-heading"><span id="toc7">実行結果</span></h3>



<p class="wp-block-paragraph">「ネコ」のクローンを複数作って、このコードを実行してみました。</p>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="クローン②クローンは同じスクリプトを実行する" width="1256" height="707" src="https://www.youtube.com/embed/Ns8nhNPE3yg?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
</div></figure>



<p class="wp-block-paragraph">動画の動きを確認しましたか？すべてのクローンが上に移動したり、下に移動したりしていますね。</p>



<h3 class="wp-block-heading"><span id="toc8">まとめ：クローンは同じスクリプトを実行する</span></h3>



<p class="wp-block-paragraph">コードは、クローンごとに複数作成する必要はありません。みなさんが今までやってきたように、スプライトに対してコードを作成していけばいいのです。</p>



<h2 class="wp-block-heading"><span id="toc9">クローンごとに変数を持つことができる</span></h2>



<h3 class="wp-block-heading"><span id="toc10">概要</span></h3>



<p class="wp-block-paragraph">「クローンごとに変数を持つことができる」とはどういうことでしょうか。</p>



<p class="wp-block-paragraph">実は、先ほどの「② クローンは同じスクリプトを実行する」で使っています。答えは、ネコの「x座標」です。「x座標」は、ネコの位置を決める変数です。クローンごとに「x座標」を持つことができるので、色々な場所にクローンを置くことができるのです。</p>



<p class="wp-block-paragraph">もし、「x座標」がクローン全体で共有する変数だったとします。そうすると、あるクローンの「x座標」を変えたときにその他の全てのクローンも同じ「x座標」に移動することになります。</p>



<p class="wp-block-paragraph">このように、クローンごとに値を持つことができる変数のことを「インスタンス変数」と呼びます。一方で、スプライト全体で共有して値を持つ変数のことを「グローバル変数」と呼びます。</p>



<p class="wp-block-paragraph">スクラッチでクローンを使ったゲームを作る際に、この二種類の変数を使い分ける場面がでてきます。一緒に確認してみましょう。</p>



<h3 class="wp-block-heading"><span id="toc11">変数の作り方</span></h3>



<p class="wp-block-paragraph">作成したクローンの総数を数えたいとき、クローンごとにその変数を持つ必要はありません。スプライト全体で共有したほうがいいですね。下図の赤枠のように「すべてのスプライト用」にチェックを入れて変数を作成します。こうすることで、「クローンの数」という変数はグローバル変数として使えるようになります。</p>



<figure class="wp-block-image aligncenter size-thumbnail"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone3-2.png"><img loading="lazy" decoding="async" width="300" height="336" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone3-2-300x336.png" alt="clone3-2" class="wp-image-4180" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone3-2-300x336.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone3-2.png 364w" sizes="(max-width: 300px) 100vw, 300px" /></a></figure>



<p class="wp-block-paragraph">次に、クローンを作っていった順に、クローンに番号をつけたいこともあります。この場合は下図のように、「このスプライトのみ」にチェックを入れて変数を作成します。これで、「番号」はインスタンス変数として使えるようになり、クローンごとに異な番号をつけることができます。</p>



<figure class="wp-block-image aligncenter size-thumbnail"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone3-1.png"><img loading="lazy" decoding="async" width="300" height="336" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone3-1-300x336.png" alt="clone3-1" class="wp-image-4179" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone3-1-300x336.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone3-1.png 364w" sizes="(max-width: 300px) 100vw, 300px" /></a></figure>



<h3 class="wp-block-heading"><span id="toc12">「ネコ」のスプライトのコード</span></h3>



<p class="wp-block-paragraph">ネコがクローンされたとき、「クローンの数」を1ずつ増やします。そして、「番号」の中身を「クローンの数」にします。こうすることで、ネコがクローンされる度にクローンの数が増えていき、ネコのクローンに「番号」を1から順に割り当てることができます。</p>



<figure class="wp-block-image aligncenter size-medium"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone3-3.png"><img loading="lazy" decoding="async" width="500" height="213" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone3-3-500x213.png" alt="clone3-3" class="wp-image-4185" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone3-3-500x213.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone3-3-800x340.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone3-3-300x128.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone3-3-768x326.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4145_clone/clone3-3.png 908w" sizes="(max-width: 500px) 100vw, 500px" /></a></figure>



<h3 class="wp-block-heading"><span id="toc13">実行結果</span></h3>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="クローン③クローンごとに変数を持つことができる" width="1256" height="707" src="https://www.youtube.com/embed/XbcyhqKrQoc?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
</div></figure>



<p class="wp-block-paragraph">「番号」は、クローンごとにもつことができるインスタンス変数として作成しています。クローンごとに「番号」が割り当てられており、クローン自身の「番号」を表示します。</p>



<p class="wp-block-paragraph">一方で、「クローンの数」はグローバル変数です。グローバル変数は、スプライト全体で共有して使う変数です。そのため、「クローンの数」を表示させると、どのクローンにおいても同じ値を表示していることがわかります。</p>



<h3 class="wp-block-heading"><span id="toc14">まとめ：クローンごとに変数を持つことができる</span></h3>



<p class="wp-block-paragraph">インスタンス変数とグローバル変数の違いはわかったでしょうか。どちらがいい、どちらが悪い、ということではなく、その変数の使われ方に応じて適切な変数の種類を使えるようになることが大事です。</p>



<p class="wp-block-paragraph">どちらにするか迷った場合はなるべくインスタンス変数（「このスプライトのみ」にチェックを入れて変数を作成する）を使うようにしましょう。理由が知りたい方は、「オブジェクト指向　カプセル化」といったキーワードでネット検索してみてください。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://scratch.earth-shop.net/clone/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>ジャンプの作り方</title>
		<link>https://scratch.earth-shop.net/jump/</link>
					<comments>https://scratch.earth-shop.net/jump/#respond</comments>
		
		<dc:creator><![CDATA[サトシ]]></dc:creator>
		<pubDate>Wed, 22 Nov 2023 18:49:03 +0000</pubDate>
				<category><![CDATA[テクニック集]]></category>
		<guid isPermaLink="false">https://scratch.earth-shop.net/?p=4056</guid>

					<description><![CDATA[完成した作品を見る 初めの３回のジャンプは簡単に作ることができるのですが、カクカクとぎこちなくジャンプします。４～６回目のジャンプは連続した動きをするなめらかなジャンプをしますが、作るのが少し難しいです。 どちらの方法で [&#8230;]]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-amber-border-color"><div class="caption-box-label block-box-label box-label fab-lightbulb"><span class="caption-box-label-text block-box-label-text box-label-text">今日のポイント</span></div><div class="caption-box-content block-box-content box-content">
<ul class="wp-block-list">
<li>なめらかで自然なジャンプは、移動する距離を変化させて作る</li>
</ul>
</div></div>



<h2 class="wp-block-heading"><span id="toc1">完成した作品を見る</span></h2>



<p class="wp-block-paragraph">初めの３回のジャンプは簡単に作ることができるのですが、カクカクとぎこちなくジャンプします。４～６回目のジャンプは連続した動きをするなめらかなジャンプをしますが、作るのが少し難しいです。</p>



<p class="wp-block-paragraph">どちらの方法でも作れるようにトライしてみよう！</p>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="[スクラッチ｜テクニック] ジャンプ" width="1256" height="707" src="https://www.youtube.com/embed/lSsTXcxtLlY?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
</div></figure>



<h2 class="wp-block-heading"><span id="toc2">簡単なジャンプの作り方</span></h2>



<h3 class="wp-block-heading"><span id="toc3">プログラミングの流れ</span></h3>



<p class="wp-block-paragraph">フローチャートを使ってプログラミングの流れを示します。</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump2.png"><img loading="lazy" decoding="async" width="222" height="689" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump2.png" alt="jump2" class="wp-image-4069"/></a></figure>



<h3 class="wp-block-heading"><span id="toc4">プログラミングする</span></h3>



<h4 class="wp-block-heading">STEP①：ブロック定義を作る</h4>



<p class="wp-block-paragraph">「ジャンプする」というブロック定義を作ります。</p>



<div class="wp-block-cocoon-blocks-column-2 column-wrap column-2 column-2-2-1-1 layout-box">
<div class="wp-block-cocoon-blocks-column-left column-left">
<figure class="wp-block-image aligncenter size-medium"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump4.png"><img loading="lazy" decoding="async" width="500" height="330" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump4-500x330.png" alt="jump4" class="wp-image-4074" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump4-500x330.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump4-800x528.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump4-300x198.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump4-768x507.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump4.png 1014w" sizes="(max-width: 500px) 100vw, 500px" /></a><figcaption class="wp-element-caption">①「ブロックを作る」を選択</figcaption></figure>
</div>



<div class="wp-block-cocoon-blocks-column-right column-right">
<figure class="wp-block-image aligncenter size-medium is-resized"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump5.png"><img loading="lazy" decoding="async" width="500" height="391" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump5-500x391.png" alt="jump5" class="wp-image-4075" style="width:401px;height:auto" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump5-500x391.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump5-300x235.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump5.png 697w" sizes="(max-width: 500px) 100vw, 500px" /></a><figcaption class="wp-element-caption">②ブロックに名前を付けます</figcaption></figure>
</div>
</div>



<h4 class="wp-block-heading">STEP②：「ジャンプする」のプログラミング</h4>



<p class="wp-block-paragraph">フローチャートを見ながらプログラムを作成してみましょう。下図のようになると思います。</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump6.png"><img loading="lazy" decoding="async" width="215" height="278" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump6.png" alt="jump6" class="wp-image-4084"/></a></figure>



<h4 class="wp-block-heading">STEP③：「スペース」キーが押されたときにジャンプする</h4>



<p class="wp-block-paragraph">ここまでできれば、「ジャンプ」のプログラミングの完成です。「スペース」キーを押して、ジャンプするか確かめてみよう。</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump7.png"><img loading="lazy" decoding="async" width="223" height="120" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump7.png" alt="jump7" class="wp-image-4091"/></a></figure>



<h2 class="wp-block-heading"><span id="toc5">なめらかジャンプの作り方</span></h2>



<h3 class="wp-block-heading"><span id="toc6">プログラミングの流れ</span></h3>



<p class="wp-block-paragraph">フローチャートを使ってプログラミングの流れを示します。</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump3.png"><img loading="lazy" decoding="async" width="222" height="669" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump3.png" alt="jump3" class="wp-image-4070"/></a></figure>



<h3 class="wp-block-heading"><span id="toc7">プログラミングする</span></h3>



<h4 class="wp-block-heading">STEP①：ブロック定義を作る</h4>



<p class="wp-block-paragraph">「なめらかジャンプ」というブロック定義を作ります。</p>



<div class="wp-block-cocoon-blocks-column-2 column-wrap column-2 column-2-2-1-1 layout-box">
<div class="wp-block-cocoon-blocks-column-left column-left">
<figure class="wp-block-image aligncenter size-medium"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump4.png"><img loading="lazy" decoding="async" width="500" height="330" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump4-500x330.png" alt="jump4" class="wp-image-4074" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump4-500x330.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump4-800x528.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump4-300x198.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump4-768x507.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump4.png 1014w" sizes="(max-width: 500px) 100vw, 500px" /></a><figcaption class="wp-element-caption">①「ブロックを作る」を選択</figcaption></figure>
</div>



<div class="wp-block-cocoon-blocks-column-right column-right">
<figure class="wp-block-image aligncenter size-medium is-resized"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump8.png"><img loading="lazy" decoding="async" width="500" height="384" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump8-500x384.png" alt="jump8" class="wp-image-4095" style="width:401px;height:auto" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump8-500x384.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump8-300x231.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump8.png 701w" sizes="(max-width: 500px) 100vw, 500px" /></a><figcaption class="wp-element-caption">②ブロックに名前を付けます</figcaption></figure>
</div>
</div>



<h4 class="wp-block-heading">STEP②：「なめらかジャンプ」のプログラミング</h4>



<p class="wp-block-paragraph">フローチャートを見ながらプログラムを作成してみましょう。下図のようになると思います。</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump9.png"><img loading="lazy" decoding="async" width="381" height="413" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump9.png" alt="jump9" class="wp-image-4098" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump9.png 381w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump9-300x325.png 300w" sizes="(max-width: 381px) 100vw, 381px" /></a></figure>



<h4 class="wp-block-heading">STEP③：「上向き矢印」キーが押されたときにジャンプする</h4>



<p class="wp-block-paragraph">「緑の旗が押されたとき」、このプログラムの初期値（地面のy座標の値）をセットします。「上向き矢印」キーを押すとどうなりましたか？最初に作った「ジャンプする」と動きを比べてみましょう。</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump10.png"><img decoding="async" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump10.png" alt="jump10" class="wp-image-4101"/></a></figure>



<h2 class="wp-block-heading"><span id="toc8">まとめ</span></h2>



<p class="wp-block-paragraph">なめらかにジャンプする仕組みは、カクカクとジャンプするものとどう違うのでしょうか。</p>



<p class="wp-block-paragraph">下図のように、ジャンプしたときにいつも同じ距離だけ移動するように作ると、カクカクとジャンプするようになります。直線的な動きになります。</p>



<figure class="wp-block-image aligncenter size-medium"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump11.png"><img loading="lazy" decoding="async" width="500" height="226" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump11-500x226.png" alt="jump11" class="wp-image-4104" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump11-500x226.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump11-800x362.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump11-300x136.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump11-768x347.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump11.png 909w" sizes="(max-width: 500px) 100vw, 500px" /></a></figure>



<p class="wp-block-paragraph">次に、なめらかにジャンプする様子を下図に示します。ジャンプのてっぺん付近では、移動する距離が少なくなっています。また、落ちていくにつれて移動する距離が伸びていっています。前の図と異なり、曲線的になっているのがわかると思います。</p>



<figure class="wp-block-image aligncenter size-medium"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump12.png"><img loading="lazy" decoding="async" width="500" height="226" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump12-500x226.png" alt="jump12" class="wp-image-4105" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump12-500x226.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump12-800x362.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump12-300x136.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump12-768x347.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/4056_jump/jump12.png 909w" sizes="(max-width: 500px) 100vw, 500px" /></a></figure>



<p class="wp-block-paragraph">このように、移動する距離を変化させることでなめらかで自然なジャンプをプログラミングすることができます。</p>



<div class="wp-block-cocoon-blocks-balloon-ex-box-1 speech-wrap sb-id-13 sbs-flat sbp-r sbis-cb cf block-box"><div class="speech-person"><figure class="speech-icon"><img decoding="async" src="https://scratch.earth-shop.net/wp-content/uploads/10_common/2_character/1_satoshi/3_satoshi_here-1.png" alt="サトシ先生" class="speech-icon-image"/></figure><div class="speech-name">サトシ先生</div></div><div class="speech-balloon">
<p class="wp-block-paragraph">今回作成した作品はこちらです。</p>
</div></div>



<div class="wp-block-cocoon-blocks-blogcard blogcard-type bct-none">

<a rel="noopener" target="_blank" href="https://scratch.mit.edu/projects/927718629/fullscreen/" title="https://scratch.mit.edu/projects/927718629/fullscreen/" class="blogcard-wrap external-blogcard-wrap a-wrap cf"><div class="blogcard external-blogcard eb-left cf"><div class="blogcard-label external-blogcard-label"><span class="fa"></span></div><figure class="blogcard-thumbnail external-blogcard-thumbnail"><img loading="lazy" decoding="async" src="https://s.wordpress.com/mshots/v1/https%3A%2F%2Fscratch.mit.edu%2Fprojects%2F927718629%2Ffullscreen%2F?w=160&#038;h=90" alt="" class="blogcard-thumb-image external-blogcard-thumb-image" width="160" height="90" /></figure><div class="blogcard-content external-blogcard-content"><div class="blogcard-title external-blogcard-title">https://scratch.mit.edu/projects/927718629/fullscreen/</div><div class="blogcard-snippet external-blogcard-snippet"></div></div><div class="blogcard-footer external-blogcard-footer cf"><div class="blogcard-site external-blogcard-site"><div class="blogcard-favicon external-blogcard-favicon"><img loading="lazy" decoding="async" src="https://www.google.com/s2/favicons?domain=https://scratch.mit.edu/projects/927718629/fullscreen/" alt="" class="blogcard-favicon-image external-blogcard-favicon-image" width="16" height="16" /></div><div class="blogcard-domain external-blogcard-domain">scratch.mit.edu</div></div></div></div></a>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://scratch.earth-shop.net/jump/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>歩くアニメーションの作り方</title>
		<link>https://scratch.earth-shop.net/walk-animation/</link>
					<comments>https://scratch.earth-shop.net/walk-animation/#respond</comments>
		
		<dc:creator><![CDATA[サトシ]]></dc:creator>
		<pubDate>Sun, 12 Nov 2023 20:26:56 +0000</pubDate>
				<category><![CDATA[テクニック集]]></category>
		<guid isPermaLink="false">https://scratch.earth-shop.net/?p=3996</guid>

					<description><![CDATA[完成した作品を確認 プログラミングの手順 作成する順番（全体像） ネコのコスチュームは2つあるよ。どちらも「歩いている」コスチュームだよ。コスチュームの調べ方は、下の左の画像を参考にしてみてね。 イヌのコスチュームは3つ [&#8230;]]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-amber-border-color"><div class="caption-box-label block-box-label box-label fab-lightbulb"><span class="caption-box-label-text block-box-label-text box-label-text">今日のポイント</span></div><div class="caption-box-content block-box-content box-content">
<p class="wp-block-paragraph">スプライトにどんなコスチュームがあるかによって、作り方が変わるよ！</p>



<ul class="wp-block-list">
<li>「歩いている」コスチュームだけのとき</li>



<li>「歩いている」コスチューム以外のものが含まれているとき</li>
</ul>
</div></div>



<h2 class="wp-block-heading"><span id="toc1">完成した作品を確認</span></h2>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="【スクラッチ｜テクニック】歩くアニメーションの作り方" width="1256" height="707" src="https://www.youtube.com/embed/LnXnwCCp3ZE?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
</div></figure>



<h2 class="wp-block-heading"><span id="toc2">プログラミングの手順</span></h2>



<h3 class="wp-block-heading"><span id="toc3">作成する順番（全体像）</span></h3>



<p class="wp-block-paragraph">ネコのコスチュームは2つあるよ。どちらも「歩いている」コスチュームだよ。コスチュームの調べ方は、下の左の画像を参考にしてみてね。</p>



<div class="wp-block-cocoon-blocks-column-2 column-wrap column-2 column-2-3-1-2 layout-box">
<div class="wp-block-cocoon-blocks-column-left column-left">
<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation4.png"><img loading="lazy" decoding="async" width="800" height="411" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation4-800x411.png" alt="walk-animation4" class="wp-image-4008" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation4-800x411.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation4-500x257.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation4-300x154.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation4-768x395.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation4-1536x789.png 1536w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation4.png 1641w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>
</div>



<div class="wp-block-cocoon-blocks-column-right column-right">
<figure class="wp-block-image aligncenter size-medium"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation2.png"><img loading="lazy" decoding="async" width="500" height="277" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation2-500x277.png" alt="walk-animation2" class="wp-image-4003" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation2-500x277.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation2-800x443.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation2-300x166.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation2-768x425.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation2-160x90.png 160w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation2.png 963w" sizes="(max-width: 500px) 100vw, 500px" /></a></figure>
</div>
</div>



<p class="wp-block-paragraph">イヌのコスチュームは3つあるよ。1番目（dog2-a）と2番目（dog2-b）のコスチュームは「歩いている」コスチュームだね。3番目（dog2-c）のコスチュームは「びっくりしている」コスチュームかな。「歩いている」コスチューム以外のものが含まれていることに注意しよう。</p>



<div class="wp-block-cocoon-blocks-column-2 column-wrap column-2 column-2-3-1-2 layout-box">
<div class="wp-block-cocoon-blocks-column-left column-left">
<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation5.png"><img loading="lazy" decoding="async" width="800" height="382" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation5-800x382.png" alt="walk-animation5" class="wp-image-4009" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation5-800x382.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation5-500x239.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation5-300x143.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation5-768x366.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation5-1536x733.png 1536w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation5.png 1677w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>
</div>



<div class="wp-block-cocoon-blocks-column-right column-right">
<figure class="wp-block-image aligncenter size-medium"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation3.png"><img loading="lazy" decoding="async" width="500" height="321" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation3-500x321.png" alt="walk-animation3" class="wp-image-4004" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation3-500x321.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation3-800x513.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation3-300x192.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation3-768x492.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation3.png 1092w" sizes="(max-width: 500px) 100vw, 500px" /></a></figure>
</div>
</div>



<h4 class="wp-block-heading">STEP①：ネコのコードを完成させる</h4>



<p class="wp-block-paragraph">「つぎのコスチュームにする」を使って、アニメーションをつけるよ。</p>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation6.png"><img loading="lazy" decoding="async" width="800" height="431" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation6-800x431.png" alt="walk-animation6" class="wp-image-4014" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation6-800x431.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation6-500x270.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation6-300x162.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation6-768x414.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation6.png 803w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<h4 class="wp-block-heading">STEP②：イヌのコードを完成させる</h4>



<p class="wp-block-paragraph">歩いているコスチューム「1番目（dog2-a）と2番目（dog2-b）」を交互に表示するようにするよ。「もし～なら●●、でなければ■■」というブロックを使うよ。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="800" height="433" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation7-800x433.png" alt="walk-animation7" class="wp-image-4018" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation7-800x433.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation7-500x270.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation7-300x162.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation7-768x415.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation7.png 1026w" sizes="(max-width: 800px) 100vw, 800px" /></figure>



<h4 class="wp-block-heading">応用：コスチュームには番号と名前がついています</h4>



<p class="wp-block-paragraph">ステップ②では、コスチュームの「名前」を使ってコードを書いています。コスチュームの「番号」を使ってアニメーションを作ることもできるんですよ。</p>



<p class="wp-block-paragraph">コスチュームの番号と名前の確認方法は下図の通りです。</p>



<figure class="wp-block-image aligncenter size-medium"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation8.png"><img loading="lazy" decoding="async" width="500" height="337" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation8-500x337.png" alt="walk-animation8" class="wp-image-4023" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation8-500x337.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation8-800x539.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation8-300x202.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation8-768x517.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation8.png 1143w" sizes="(max-width: 500px) 100vw, 500px" /></a></figure>



<p class="wp-block-paragraph">番号を使うコードは次のようになります。</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation9.png"><img loading="lazy" decoding="async" width="430" height="358" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation9.png" alt="walk-animation9" class="wp-image-4025" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation9.png 430w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3996/walk-animation9-300x250.png 300w" sizes="(max-width: 430px) 100vw, 430px" /></a></figure>



<div class="wp-block-cocoon-blocks-balloon-ex-box-1 speech-wrap sb-id-11 sbs-flat sbp-r sbis-cb cf block-box"><div class="speech-person"><figure class="speech-icon"><img decoding="async" src="https://scratch.earth-shop.net/wp-content/uploads/10_common/2_character/1_satoshi/1_satoshi_ok.png" alt="サトシ先生" class="speech-icon-image"/></figure><div class="speech-name">サトシ先生</div></div><div class="speech-balloon">
<p class="wp-block-paragraph">コスチュームの「名前」を使うコードと「番号」を使うコード、どちらがいいと思いますか？君の考えを教えてください。</p>
</div></div>



<h2 class="wp-block-heading"><span id="toc4">まとめ</span></h2>



<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-amber-border-color"><div class="caption-box-label block-box-label box-label fab-lightbulb"><span class="caption-box-label-text block-box-label-text box-label-text">今日のポイント</span></div><div class="caption-box-content block-box-content box-content">
<ul class="wp-block-list">
<li>「つぎのコスチュームにする」を使って、アニメーションをつけることができる</li>



<li>歩いているコスチューム以外のものがあるときは、「もし～なら●●、でなければ■■」ブロックを使う</li>
</ul>
</div></div>



<div class="wp-block-cocoon-blocks-balloon-ex-box-1 speech-wrap sb-id-13 sbs-flat sbp-r sbis-cb cf block-box"><div class="speech-person"><figure class="speech-icon"><img decoding="async" src="https://scratch.earth-shop.net/wp-content/uploads/10_common/2_character/1_satoshi/3_satoshi_here-1.png" alt="サトシ先生" class="speech-icon-image"/></figure><div class="speech-name">サトシ先生</div></div><div class="speech-balloon">
<p class="wp-block-paragraph">今回作成した作品はこちらです。</p>
</div></div>



<div class="wp-block-cocoon-blocks-blogcard blogcard-type bct-none">

<a rel="noopener" target="_blank" href="https://scratch.mit.edu/projects/923333395/" title="https://scratch.mit.edu/projects/923333395/" class="blogcard-wrap external-blogcard-wrap a-wrap cf"><div class="blogcard external-blogcard eb-left cf"><div class="blogcard-label external-blogcard-label"><span class="fa"></span></div><figure class="blogcard-thumbnail external-blogcard-thumbnail"><img loading="lazy" decoding="async" src="https://s.wordpress.com/mshots/v1/https%3A%2F%2Fscratch.mit.edu%2Fprojects%2F923333395%2F?w=160&#038;h=90" alt="" class="blogcard-thumb-image external-blogcard-thumb-image" width="160" height="90" /></figure><div class="blogcard-content external-blogcard-content"><div class="blogcard-title external-blogcard-title">https://scratch.mit.edu/projects/923333395/</div><div class="blogcard-snippet external-blogcard-snippet"></div></div><div class="blogcard-footer external-blogcard-footer cf"><div class="blogcard-site external-blogcard-site"><div class="blogcard-favicon external-blogcard-favicon"><img loading="lazy" decoding="async" src="https://www.google.com/s2/favicons?domain=https://scratch.mit.edu/projects/923333395/" alt="" class="blogcard-favicon-image external-blogcard-favicon-image" width="16" height="16" /></div><div class="blogcard-domain external-blogcard-domain">scratch.mit.edu</div></div></div></div></a>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://scratch.earth-shop.net/walk-animation/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>スマホやタブレットでも遊べるようにする[改良版：滑らかに動かす]</title>
		<link>https://scratch.earth-shop.net/play-with-mobile-improved/</link>
					<comments>https://scratch.earth-shop.net/play-with-mobile-improved/#respond</comments>
		
		<dc:creator><![CDATA[サトシ]]></dc:creator>
		<pubDate>Sat, 11 Nov 2023 20:17:43 +0000</pubDate>
				<category><![CDATA[テクニック集]]></category>
		<guid isPermaLink="false">https://scratch.earth-shop.net/?p=3969</guid>

					<description><![CDATA[改良前の問題点 改良した作品を確認 プログラミングの手順 作成する順番（全体像） STEP①：スプライト「ネコ」のコードを書く 滑らかに移動するようにコードを書きます。「ずっと」ブロックを使うところがポイントです。 ST [&#8230;]]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-amber-border-color"><div class="caption-box-label block-box-label box-label fab-lightbulb"><span class="caption-box-label-text block-box-label-text box-label-text">今日のポイント</span></div><div class="caption-box-content block-box-content box-content">
<p class="wp-block-paragraph">次のテクニックを組み合わせます</p>



<ul class="wp-block-list">
<li><a target="_self" href="https://scratch.earth-shop.net/play-with-mobile/">スマホやタブレットでも遊べるようにする</a></li>



<li><a target="_self" href="https://scratch.earth-shop.net/key-repeat/">滑らかに動かすようにする</a></li>
</ul>
</div></div>



<h2 class="wp-block-heading"><span id="toc1">改良前の問題点</span></h2>



<div class="wp-block-cocoon-blocks-balloon-ex-box-1 speech-wrap sb-id-12 sbs-think sbp-r sbis-cb cf block-box"><div class="speech-person"><figure class="speech-icon"><img decoding="async" src="https://scratch.earth-shop.net/wp-content/uploads/10_common/2_character/1_satoshi/2_satoshi_hmm.png" alt="サトシ先生" class="speech-icon-image"/></figure><div class="speech-name">サトシ先生</div></div><div class="speech-balloon">
<p class="wp-block-paragraph">タブレットに表示されているボタンを「押したときだけ」しか、スプライトが移動していませんでした。ボタンを「押し続けている間」は、スプライトが移動し続けてほしいことがありますよね。</p>
</div></div>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="【スクラッチ｜テクニック】スマホやタブレットでも遊べるようにする（作りたいもの）" width="1256" height="707" src="https://www.youtube.com/embed/kKvyU7a-E4I?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
</div></figure>



<h2 class="wp-block-heading"><span id="toc2">改良した作品を確認</span></h2>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="【スクラッチ｜テクニック】[改良版]スマホやタブレットでも遊べるようにする" width="1256" height="707" src="https://www.youtube.com/embed/cyysZJHKyBs?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
</div></figure>



<div class="wp-block-cocoon-blocks-balloon-ex-box-1 speech-wrap sb-id-17 sbs-stn sbp-l sbis-cb cf block-box"><div class="speech-person"><figure class="speech-icon"><img decoding="async" src="https://scratch.earth-shop.net/wp-content/uploads/10_common/2_character/2_polar-bear/1_polar-bear_smile.png" alt="シロクマ生徒" class="speech-icon-image"/></figure><div class="speech-name">シロクマ生徒</div></div><div class="speech-balloon">
<p class="wp-block-paragraph">ボタンを押している間、ずっとスプライトが動くようになりましたね！</p>
</div></div>



<h2 class="wp-block-heading"><span id="toc3">プログラミングの手順</span></h2>



<h3 class="wp-block-heading"><span id="toc4">作成する順番（全体像）</span></h3>



<div class="wp-block-cocoon-blocks-timeline timeline-box cf block-box"><div class="timeline-title">今回の作品は次の順番で作成します</div><ul class="timeline">
<li class="wp-block-cocoon-blocks-timeline-item timeline-item cf"><div class="timeline-item-label">STEP①</div><div class="timeline-item-content cf"><div class="timeline-item-title">スプライト「ネコ」のコードを書く</div><div class="timeline-item-snippet">
<p class="wp-block-paragraph">「キーボード」の右矢印キーが押されたときに、右に移動するようにします</p>
</div></div></li>



<li class="wp-block-cocoon-blocks-timeline-item timeline-item cf"><div class="timeline-item-label">STEP②</div><div class="timeline-item-content cf"><div class="timeline-item-title">スプライト「右矢印」のコードを書く</div><div class="timeline-item-snippet">
<p class="wp-block-paragraph">「タブレット」上の右矢印のスプライトが押されたときに、スプライト「ネコ」が右にするようにします</p>
</div></div></li>
</ul></div>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3969/play-with-mobile-improved2.png"><img loading="lazy" decoding="async" width="800" height="412" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3969/play-with-mobile-improved2-800x412.png" alt="play-with-mobile-improved2" class="wp-image-3978" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3969/play-with-mobile-improved2-800x412.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3969/play-with-mobile-improved2-500x257.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3969/play-with-mobile-improved2-300x154.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3969/play-with-mobile-improved2-768x395.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3969/play-with-mobile-improved2.png 1274w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<h4 class="wp-block-heading">STEP①：<strong>スプライト「ネコ」のコードを書く</strong></h4>



<p class="wp-block-paragraph">滑らかに移動するようにコードを書きます。「ずっと」ブロックを使うところがポイントです。</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3969/play-with-mobile-improved3.png"><img loading="lazy" decoding="async" width="361" height="421" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3969/play-with-mobile-improved3.png" alt="play-with-mobile-improved3" class="wp-image-3982" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3969/play-with-mobile-improved3.png 361w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3969/play-with-mobile-improved3-300x350.png 300w" sizes="(max-width: 361px) 100vw, 361px" /></a></figure>



<h4 class="wp-block-heading">STEP②：スプライト「右矢印」のコードを書く</h4>



<p class="wp-block-paragraph">STEP①と同じように、「ずっと」ブロックを使って滑らかに移動するようにします。</p>



<p class="wp-block-paragraph">また、このスプライト（矢印のボタン）が押されたときに、メッセージ「右に移動」を送ることでネコが移動するようにします。こうすることで、キーボードでもタブレットでも遊べるゲームが作れます。</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3969/play-with-mobile-improved4.png"><img loading="lazy" decoding="async" width="497" height="237" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3969/play-with-mobile-improved4.png" alt="play-with-mobile-improved4" class="wp-image-3983" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3969/play-with-mobile-improved4.png 497w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/3969/play-with-mobile-improved4-300x143.png 300w" sizes="(max-width: 497px) 100vw, 497px" /></a></figure>



<div class="wp-block-cocoon-blocks-balloon-ex-box-1 speech-wrap sb-id-15 sbs-flat sbp-r sbis-cb cf block-box"><div class="speech-person"><figure class="speech-icon"><img decoding="async" src="https://scratch.earth-shop.net/wp-content/uploads/10_common/2_character/1_satoshi/5_satoshi_point.png" alt="サトシ先生" class="speech-icon-image"/></figure><div class="speech-name">サトシ先生</div></div><div class="speech-balloon">
<p class="wp-block-paragraph">「マウスがおされた」という条件はどうして必要でしょうか。これがなかったときはどのような動きになるか確認してみましょう。</p>
</div></div>



<h2 class="wp-block-heading"><span id="toc5">まとめ</span></h2>



<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-amber-border-color"><div class="caption-box-label block-box-label box-label fab-lightbulb"><span class="caption-box-label-text block-box-label-text box-label-text">今日のポイントのおさらい</span></div><div class="caption-box-content block-box-content box-content">
<ul class="wp-block-list">
<li>メッセージを使って、スマホやタブレットでも遊べるようにする</li>



<li>「ずっと」ブロックを使って、滑らかに動くようにする</li>
</ul>
</div></div>



<div class="wp-block-cocoon-blocks-balloon-ex-box-1 speech-wrap sb-id-13 sbs-flat sbp-r sbis-cb cf block-box"><div class="speech-person"><figure class="speech-icon"><img decoding="async" src="https://scratch.earth-shop.net/wp-content/uploads/10_common/2_character/1_satoshi/3_satoshi_here-1.png" alt="サトシ先生" class="speech-icon-image"/></figure><div class="speech-name">サトシ先生</div></div><div class="speech-balloon">
<p class="wp-block-paragraph">今回作成した作品はこちらです。</p>
</div></div>



<div class="wp-block-cocoon-blocks-blogcard blogcard-type bct-none">

<a rel="noopener" target="_blank" href="https://scratch.mit.edu/projects/923051278/" title="https://scratch.mit.edu/projects/923051278/" class="blogcard-wrap external-blogcard-wrap a-wrap cf"><div class="blogcard external-blogcard eb-left cf"><div class="blogcard-label external-blogcard-label"><span class="fa"></span></div><figure class="blogcard-thumbnail external-blogcard-thumbnail"><img loading="lazy" decoding="async" src="https://s.wordpress.com/mshots/v1/https%3A%2F%2Fscratch.mit.edu%2Fprojects%2F923051278%2F?w=160&#038;h=90" alt="" class="blogcard-thumb-image external-blogcard-thumb-image" width="160" height="90" /></figure><div class="blogcard-content external-blogcard-content"><div class="blogcard-title external-blogcard-title">https://scratch.mit.edu/projects/923051278/</div><div class="blogcard-snippet external-blogcard-snippet"></div></div><div class="blogcard-footer external-blogcard-footer cf"><div class="blogcard-site external-blogcard-site"><div class="blogcard-favicon external-blogcard-favicon"><img loading="lazy" decoding="async" src="https://www.google.com/s2/favicons?domain=https://scratch.mit.edu/projects/923051278/" alt="" class="blogcard-favicon-image external-blogcard-favicon-image" width="16" height="16" /></div><div class="blogcard-domain external-blogcard-domain">scratch.mit.edu</div></div></div></div></a>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://scratch.earth-shop.net/play-with-mobile-improved/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>【スーパーマリオ】コース（地面）を作成する</title>
		<link>https://scratch.earth-shop.net/pg-sp-mario-course-ground/</link>
					<comments>https://scratch.earth-shop.net/pg-sp-mario-course-ground/#respond</comments>
		
		<dc:creator><![CDATA[サトシ]]></dc:creator>
		<pubDate>Sat, 06 May 2023 23:41:31 +0000</pubDate>
				<category><![CDATA[有名なあのゲームを作る]]></category>
		<guid isPermaLink="false">https://scratch.earth-shop.net/?p=3707</guid>

					<description><![CDATA[完成した作品を確認 プログラミングの手順 作成する順番（全体像） 準備：リミックスする まずは、次の作品「#1左右に移動する」をリミックスします。マリオが、右や左に移動できます。 STEP①：コースのコスチュームを作成す [&#8230;]]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-amber-border-color"><div class="caption-box-label block-box-label box-label fab-lightbulb"><span class="caption-box-label-text block-box-label-text box-label-text">今日のポイント</span></div><div class="caption-box-content block-box-content box-content">
<ul class="wp-block-list">
<li>画像を読み込んだり、手書きしたりして、コースを作成する</li>



<li>重力（地面に落ちる力）をプログラミングする</li>
</ul>
</div></div>



<h2 class="wp-block-heading"><span id="toc1">完成した作品を確認</span></h2>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="【スクラッチ｜スーパーマリオ】#2コース（地面）を作成する" width="1256" height="707" src="https://www.youtube.com/embed/JD5GqfABYFM?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
</div></figure>



<h2 class="wp-block-heading"><span id="toc2">プログラミングの手順</span></h2>



<h3 class="wp-block-heading"><span id="toc3">作成する順番（全体像）</span></h3>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/blueprint.png"><img loading="lazy" decoding="async" width="800" height="484" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/blueprint-800x484.png" alt="blueprint" class="wp-image-3781" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/blueprint-800x484.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/blueprint-500x303.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/blueprint-300x182.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/blueprint-768x465.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/blueprint.png 1174w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<h4 class="wp-block-heading">準備：リミックスする</h4>



<p class="wp-block-paragraph">まずは、次の作品「#1左右に移動する」をリミックスします。マリオが、右や左に移動できます。</p>



<div class="wp-block-cocoon-blocks-blogcard blogcard-type bct-none">

<a rel="noopener" target="_blank" href="https://scratch.mit.edu/projects/817814830/" title="https://scratch.mit.edu/projects/817814830/" class="blogcard-wrap external-blogcard-wrap a-wrap cf"><div class="blogcard external-blogcard eb-left cf"><div class="blogcard-label external-blogcard-label"><span class="fa"></span></div><figure class="blogcard-thumbnail external-blogcard-thumbnail"><img loading="lazy" decoding="async" src="https://s.wordpress.com/mshots/v1/https%3A%2F%2Fscratch.mit.edu%2Fprojects%2F817814830%2F?w=160&#038;h=90" alt="" class="blogcard-thumb-image external-blogcard-thumb-image" width="160" height="90" /></figure><div class="blogcard-content external-blogcard-content"><div class="blogcard-title external-blogcard-title">https://scratch.mit.edu/projects/817814830/</div><div class="blogcard-snippet external-blogcard-snippet"></div></div><div class="blogcard-footer external-blogcard-footer cf"><div class="blogcard-site external-blogcard-site"><div class="blogcard-favicon external-blogcard-favicon"><img loading="lazy" decoding="async" src="https://www.google.com/s2/favicons?domain=https://scratch.mit.edu/projects/817814830/" alt="" class="blogcard-favicon-image external-blogcard-favicon-image" width="16" height="16" /></div><div class="blogcard-domain external-blogcard-domain">scratch.mit.edu</div></div></div></div></a>
</div>



<h4 class="wp-block-heading">STEP①：コースのコスチュームを作成する</h4>



<p class="wp-block-paragraph">下図の地面ブロック（ファイル名：ground.png）をダウンロードして、スクラッチにアップロードします。</p>



<figure class="wp-block-image size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/ground.png"><img loading="lazy" decoding="async" width="64" height="64" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/ground.png" alt="ground" class="wp-image-3732"/></a></figure>



<p class="wp-block-paragraph">下図のように、スプライトの「コスチューム」タブをクリックすると、コスチュームを編集する画面が表示されます。画面内にある描画ツール（ペンや消しゴム、塗りつぶし、など）を使って、コースを作成します。</p>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/1.png"><img loading="lazy" decoding="async" width="800" height="505" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/1-800x505.png" alt="1" class="wp-image-3733" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/1-800x505.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/1-500x316.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/1-300x190.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/1-768x485.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/1.png 1420w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<h4 class="wp-block-heading">STEP②：次のステージに進めるようにする</h4>



<p class="wp-block-paragraph">マリオが右端まで移動したときの、x座標を確認します。下図の場合、「245」です。</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/2.png"><img loading="lazy" decoding="async" width="497" height="590" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/2.png" alt="2" class="wp-image-3738" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/2.png 497w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/2-300x356.png 300w" sizes="(max-width: 497px) 100vw, 497px" /></a></figure>



<p class="wp-block-paragraph">マリオが右端まで移動したときに、次のステージに進めるようにプログラミングします。下図の赤枠内の値には、先ほど確認したマリオが右端に移動したときのx座標を入力します。また、次のステージを表示するために、スプライト「コース」にメッセージを送る必要があります。</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/2-2.png"><img loading="lazy" decoding="async" width="486" height="434" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/2-2.png" alt="2-2" class="wp-image-3768" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/2-2.png 486w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/2-2-300x268.png 300w" sizes="(max-width: 486px) 100vw, 486px" /></a></figure>



<p class="wp-block-paragraph">スプライト「コース」に、メッセージ「次のステージ」を受け取ったときのプログラムを書きます。ブロック「つぎのコスチュームにする」を使うことで、次のステージを表示します。コースは3つまでしか作っていないので、最後のコースまで進んだ時は「ゲームクリア」とします。</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/2-3.png"><img loading="lazy" decoding="async" width="735" height="303" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/2-3.png" alt="2-3" class="wp-image-3749" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/2-3.png 735w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/2-3-500x206.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/2-3-300x124.png 300w" sizes="(max-width: 735px) 100vw, 735px" /></a></figure>



<p class="wp-block-paragraph"><a rel="nofollow" target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/stage_clear.wav" data-type="URL" data-id="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/stage_clear.wav">ゲームクリア時の音</a>を用意しています。左のリンクからダウンロードして使ってください（ファイル名：stage_clear.wav）。</p>



<h4 class="wp-block-heading">STEP③：マリオが空中にいるときは、地面に落ちるようにする</h4>



<p class="wp-block-paragraph">コースに触れるまで（地面に着地するまで）、マリオが下に落ちていくようにします。</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/3.png"><img loading="lazy" decoding="async" width="458" height="357" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/3.png" alt="3" class="wp-image-3766" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/3.png 458w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/3-300x234.png 300w" sizes="(max-width: 458px) 100vw, 458px" /></a></figure>



<div class="wp-block-cocoon-blocks-blank-box-1 blank-box block-box">
<p class="wp-block-paragraph">空中にいるとき、マリオは地面に向かって落ちていきます。これは「重力」といって、地面の方向に引き付けられる力のことです。本物の「重力」をプログラミングするのは難しい（高校の物理で習います）ので、今回は簡単に考えるようにしています。</p>
</div>



<h2 class="wp-block-heading"><span id="toc4">まとめ</span></h2>



<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-amber-border-color"><div class="caption-box-label block-box-label box-label fab-lightbulb"><span class="caption-box-label-text block-box-label-text box-label-text">今日のポイントのおさらい</span></div><div class="caption-box-content block-box-content box-content">
<ul class="wp-block-list">
<li>画像を読み込んだり、手書きしたりして、コースを作成する</li>



<li>重力（地面に落ちる力）をプログラミングする</li>
</ul>
</div></div>



<div class="wp-block-cocoon-blocks-balloon-ex-box-1 speech-wrap sb-id-13 sbs-flat sbp-r sbis-cb cf block-box"><div class="speech-person"><figure class="speech-icon"><img decoding="async" src="https://scratch.earth-shop.net/wp-content/uploads/10_common/2_character/1_satoshi/3_satoshi_here-1.png" alt="サトシ先生" class="speech-icon-image"/></figure><div class="speech-name">サトシ先生</div></div><div class="speech-balloon">
<p class="wp-block-paragraph">今回作成した作品はこちらです。</p>
</div></div>



<div class="wp-block-cocoon-blocks-blogcard blogcard-type bct-none">

<a rel="noopener" target="_blank" href="https://scratch.mit.edu/projects/846655544/" title="https://scratch.mit.edu/projects/846655544/" class="blogcard-wrap external-blogcard-wrap a-wrap cf"><div class="blogcard external-blogcard eb-left cf"><div class="blogcard-label external-blogcard-label"><span class="fa"></span></div><figure class="blogcard-thumbnail external-blogcard-thumbnail"><img loading="lazy" decoding="async" src="https://s.wordpress.com/mshots/v1/https%3A%2F%2Fscratch.mit.edu%2Fprojects%2F846655544%2F?w=160&#038;h=90" alt="" class="blogcard-thumb-image external-blogcard-thumb-image" width="160" height="90" /></figure><div class="blogcard-content external-blogcard-content"><div class="blogcard-title external-blogcard-title">https://scratch.mit.edu/projects/846655544/</div><div class="blogcard-snippet external-blogcard-snippet"></div></div><div class="blogcard-footer external-blogcard-footer cf"><div class="blogcard-site external-blogcard-site"><div class="blogcard-favicon external-blogcard-favicon"><img loading="lazy" decoding="async" src="https://www.google.com/s2/favicons?domain=https://scratch.mit.edu/projects/846655544/" alt="" class="blogcard-favicon-image external-blogcard-favicon-image" width="16" height="16" /></div><div class="blogcard-domain external-blogcard-domain">scratch.mit.edu</div></div></div></div></a>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://scratch.earth-shop.net/pg-sp-mario-course-ground/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		<enclosure url="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3707/stage_clear.wav" length="249748" type="audio/wav" />

			</item>
		<item>
		<title>【スーパーマリオ】左右に移動する</title>
		<link>https://scratch.earth-shop.net/pg-sp-mario-move/</link>
					<comments>https://scratch.earth-shop.net/pg-sp-mario-move/#respond</comments>
		
		<dc:creator><![CDATA[サトシ]]></dc:creator>
		<pubDate>Fri, 24 Feb 2023 19:02:03 +0000</pubDate>
				<category><![CDATA[有名なあのゲームを作る]]></category>
		<guid isPermaLink="false">https://scratch.earth-shop.net/?p=3227</guid>

					<description><![CDATA[完成した作品を確認 動きを動画で確認する コードを確認する ①：チビマリオ コスチューム 「立っているマリオ」と「歩いているマリオ」の2つのコスチュームを使って、左右の移動を表現します。 スクリプト 「緑の旗」が押された [&#8230;]]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-cocoon-blocks-balloon-ex-box-1 speech-wrap sb-id-17 sbs-stn sbp-l sbis-cb cf block-box"><div class="speech-person"><figure class="speech-icon"><img decoding="async" src="https://scratch.earth-shop.net/wp-content/uploads/10_common/2_character/2_polar-bear/1_polar-bear_smile.png" alt="シロクマ生徒" class="speech-icon-image"/></figure><div class="speech-name">シロクマ生徒</div></div><div class="speech-balloon">
<p class="wp-block-paragraph">ついにマリオを作るんですね！</p>
</div></div>



<div class="wp-block-cocoon-blocks-balloon-ex-box-1 speech-wrap sb-id-14 sbs-flat sbp-r sbis-cb cf block-box"><div class="speech-person"><figure class="speech-icon"><img decoding="async" src="https://scratch.earth-shop.net/wp-content/uploads/10_common/2_character/1_satoshi/4_satoshi_fight.png" alt="サトシ先生" class="speech-icon-image"/></figure><div class="speech-name">サトシ先生</div></div><div class="speech-balloon">
<p class="wp-block-paragraph">はい！「マリオ」と言えばテレビゲームの代名詞といえるぐらい有名ですからね！ぜひチャレンジしてみましょう♪</p>
</div></div>



<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-amber-border-color"><div class="caption-box-label block-box-label box-label fab-lightbulb"><span class="caption-box-label-text block-box-label-text box-label-text">今日のポイント</span></div><div class="caption-box-content block-box-content box-content">
<ul class="wp-block-list">
<li>マリオを滑らかに移動させる</li>



<li>「ブロック定義」を使って、スクリプトを見やすくする</li>
</ul>
</div></div>



<h2 class="wp-block-heading"><span id="toc1">完成した作品を確認</span></h2>



<h3 class="wp-block-heading"><span id="toc2">動きを動画で確認する</span></h3>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="【スクラッチ｜スーパーマリオ】左右に移動する（作りたいもの）" width="1256" height="707" src="https://www.youtube.com/embed/wGD0_tuJOvA?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
</div></figure>



<h3 class="wp-block-heading"><span id="toc3">コードを確認する</span></h3>



<h4 class="wp-block-heading">①：チビマリオ</h4>



<h5 class="wp-block-heading">コスチューム</h5>



<p class="wp-block-paragraph">「立っているマリオ」と「歩いているマリオ」の2つのコスチュームを使って、左右の移動を表現します。</p>



<figure class="wp-block-image aligncenter size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/1.png"><img loading="lazy" decoding="async" width="107" height="193" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/1.png" alt="1" class="wp-image-3441"/></a></figure>



<h5 class="wp-block-heading">スクリプト</h5>



<p class="wp-block-paragraph">「緑の旗」が押されたとき、マリオの位置やコスチュームなどの初期設定をします。</p>



<figure class="wp-block-image size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/2.png"><img loading="lazy" decoding="async" width="404" height="236" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/2.png" alt="2" class="wp-image-3492" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/2.png 404w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/2-300x175.png 300w" sizes="(max-width: 404px) 100vw, 404px" /></a></figure>



<p class="wp-block-paragraph">「ずっと」ブロックを使用して、キー入力を監視します。また、ブロック定義などを使って、スクリプトを見やすくしています。</p>



<figure class="wp-block-image size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/3.png"><img loading="lazy" decoding="async" width="619" height="578" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/3.png" alt="3" class="wp-image-3493" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/3.png 619w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/3-500x467.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/3-300x280.png 300w" sizes="(max-width: 619px) 100vw, 619px" /></a></figure>



<h2 class="wp-block-heading"><span id="toc4">プログラミングの手順</span></h2>



<h3 class="wp-block-heading"><span id="toc5">動画の解説をみる</span></h3>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="【スクラッチ｜スーパーマリオ】左右に移動する" width="1256" height="707" src="https://www.youtube.com/embed/s1lpsL9qAtU?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
</div></figure>



<h3 class="wp-block-heading"><span id="toc6">テキストの解説をみる</span></h3>



<figure class="wp-block-image aligncenter size-large"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/blueprint.png"><img loading="lazy" decoding="async" width="800" height="596" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/blueprint-800x596.png" alt="blueprint" class="wp-image-3485" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/blueprint-800x596.png 800w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/blueprint-500x372.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/blueprint-300x223.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/blueprint-768x572.png 768w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/blueprint.png 909w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<h4 class="wp-block-heading">STEP①：リミックスする</h4>



<p class="wp-block-paragraph">次の作品をリミックスします。</p>



<div class="wp-block-cocoon-blocks-blogcard blogcard-type bct-none">

<a rel="noopener" target="_blank" href="https://scratch.mit.edu/projects/815442580/" title="https://scratch.mit.edu/projects/815442580/" class="blogcard-wrap external-blogcard-wrap a-wrap cf"><div class="blogcard external-blogcard eb-left cf"><div class="blogcard-label external-blogcard-label"><span class="fa"></span></div><figure class="blogcard-thumbnail external-blogcard-thumbnail"><img loading="lazy" decoding="async" src="https://s.wordpress.com/mshots/v1/https%3A%2F%2Fscratch.mit.edu%2Fprojects%2F815442580%2F?w=160&#038;h=90" alt="" class="blogcard-thumb-image external-blogcard-thumb-image" width="160" height="90" /></figure><div class="blogcard-content external-blogcard-content"><div class="blogcard-title external-blogcard-title">https://scratch.mit.edu/projects/815442580/</div><div class="blogcard-snippet external-blogcard-snippet"></div></div><div class="blogcard-footer external-blogcard-footer cf"><div class="blogcard-site external-blogcard-site"><div class="blogcard-favicon external-blogcard-favicon"><img loading="lazy" decoding="async" src="https://www.google.com/s2/favicons?domain=https://scratch.mit.edu/projects/815442580/" alt="" class="blogcard-favicon-image external-blogcard-favicon-image" width="16" height="16" /></div><div class="blogcard-domain external-blogcard-domain">scratch.mit.edu</div></div></div></div></a>
</div>



<h4 class="wp-block-heading">STEP②：ゲームの初期設定をする（緑の旗がおされたとき）</h4>



<p class="wp-block-paragraph">マリオの位置を設定します。</p>



<figure class="wp-block-image size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP2-1.png"><img loading="lazy" decoding="async" width="481" height="215" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP2-1.png" alt="STEP2-1" class="wp-image-3462" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP2-1.png 481w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP2-1-300x134.png 300w" sizes="(max-width: 481px) 100vw, 481px" /></a></figure>



<p class="wp-block-paragraph">BGMが流れるようにします。</p>



<figure class="wp-block-image size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP2-2.png"><img loading="lazy" decoding="async" width="794" height="296" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP2-2.png" alt="STEP2-2" class="wp-image-3461" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP2-2.png 794w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP2-2-500x186.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP2-2-300x112.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP2-2-768x286.png 768w" sizes="(max-width: 794px) 100vw, 794px" /></a></figure>



<h4 class="wp-block-heading">STEP③：右矢印キーが押されたときに、右に進むようにします</h4>



<p class="wp-block-paragraph">マリオを滑らかに移動させるために、「ずっと」ブロックを使用してキーボードの入力を監視します。滑らかに動かすための方法は、次の記事が参考になります。</p>



<div class="wp-block-cocoon-blocks-blogcard blogcard-type bct-reference">

<a target="_self" href="https://scratch.earth-shop.net/key-repeat/" title="【検証】滑らかに動かす方法（キーリピート機能）" class="blogcard-wrap internal-blogcard-wrap a-wrap cf"><div class="blogcard internal-blogcard ib-left cf"><div class="blogcard-label internal-blogcard-label"><span class="fa"></span></div><figure class="blogcard-thumbnail internal-blogcard-thumbnail"><img loading="lazy" decoding="async" width="160" height="90" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/eyecatch/key-repeat-160x90.png" class="blogcard-thumb-image internal-blogcard-thumb-image wp-post-image" alt="" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/eyecatch/key-repeat-160x90.png 160w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/eyecatch/key-repeat-120x68.png 120w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/game-tech/eyecatch/key-repeat-320x180.png 320w" sizes="(max-width: 160px) 100vw, 160px" /></figure><div class="blogcard-content internal-blogcard-content"><div class="blogcard-title internal-blogcard-title">【検証】滑らかに動かす方法（キーリピート機能）</div><div class="blogcard-snippet internal-blogcard-snippet">キャラクターが移動が、カクカクしていて滑らかに移動しないことがありませんか？それは、キーボード入力時に働く「キーリピート機能」が原因かもしれません。この機能をオフにすることはできませんが、スクリプトを工夫すれば解決することができます。</div></div><div class="blogcard-footer internal-blogcard-footer cf"><div class="blogcard-site internal-blogcard-site"><div class="blogcard-favicon internal-blogcard-favicon"><img loading="lazy" decoding="async" src="https://www.google.com/s2/favicons?domain=https://scratch.earth-shop.net" alt="" class="blogcard-favicon-image internal-blogcard-favicon-image" width="16" height="16" /></div><div class="blogcard-domain internal-blogcard-domain">scratch.earth-shop.net</div></div><div class="blogcard-date internal-blogcard-date"><div class="blogcard-post-date internal-blogcard-post-date">2023.03.02</div></div></div></div></a>
</div>



<figure class="wp-block-image size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP3-1.png"><img loading="lazy" decoding="async" width="567" height="413" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP3-1.png" alt="STEP3-1" class="wp-image-3468" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP3-1.png 567w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP3-1-500x364.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP3-1-300x219.png 300w" sizes="(max-width: 567px) 100vw, 567px" /></a></figure>



<p class="wp-block-paragraph">コスチュームを変えることで、歩くアニメーションを表現します。</p>



<figure class="wp-block-image size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP3-2.png"><img loading="lazy" decoding="async" width="611" height="720" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP3-2.png" alt="STEP3-2" class="wp-image-3469" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP3-2.png 611w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP3-2-500x589.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP3-2-300x354.png 300w" sizes="(max-width: 611px) 100vw, 611px" /></a></figure>



<h4 class="wp-block-heading">STEP④：左矢印キーが押されたときに、左に進むようにします</h4>



<p class="wp-block-paragraph">マリオが滑らかに移動するように、「ずっと」ブロックを使ってキー入力を監視します。</p>



<p class="wp-block-paragraph">コスチュームを変えることで、歩くアニメーションを表現します。</p>



<p class="wp-block-paragraph">「●度に向ける」ブロックを使って、画像の向きを変えます。</p>



<figure class="wp-block-image size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP4.png"><img loading="lazy" decoding="async" width="398" height="725" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP4.png" alt="STEP4" class="wp-image-3470" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP4.png 398w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP4-300x546.png 300w" sizes="(max-width: 398px) 100vw, 398px" /></a></figure>



<h4 class="wp-block-heading">STEP⑤：スクリプトを見やすくします</h4>



<p class="wp-block-paragraph">左右に移動する、という処理をブロック定義を使って1つにまとめます。</p>



<figure class="wp-block-image size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP5-1.png"><img loading="lazy" decoding="async" width="717" height="747" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP5-1.png" alt="STEP5-1" class="wp-image-3472" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP5-1.png 717w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP5-1-500x521.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP5-1-300x313.png 300w" sizes="(max-width: 717px) 100vw, 717px" /></a></figure>



<p class="wp-block-paragraph">共通する処理があるので、1つにまとめられるか検討します。</p>



<figure class="wp-block-image size-full"><a target="_self" href="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP5-2.png"><img loading="lazy" decoding="async" width="769" height="759" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP5-2.png" alt="STEP5-2" class="wp-image-3471" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP5-2.png 769w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP5-2-500x493.png 500w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP5-2-300x296.png 300w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/3227/STEP5-2-100x100.png 100w" sizes="(max-width: 769px) 100vw, 769px" /></a></figure>



<h2 class="wp-block-heading"><span id="toc7">まとめ</span></h2>



<div class="wp-block-cocoon-blocks-balloon-ex-box-1 speech-wrap sb-id-17 sbs-stn sbp-l sbis-cb cf block-box"><div class="speech-person"><figure class="speech-icon"><img decoding="async" src="https://scratch.earth-shop.net/wp-content/uploads/10_common/2_character/2_polar-bear/1_polar-bear_smile.png" alt="シロクマ生徒" class="speech-icon-image"/></figure><div class="speech-name">シロクマ生徒</div></div><div class="speech-balloon">
<p class="wp-block-paragraph">今日の説明は前回までの説明より分かりやすかったです（「フォートナイトの作り方」のこと）！</p>
</div></div>



<div class="wp-block-cocoon-blocks-balloon-ex-box-1 speech-wrap sb-id-14 sbs-flat sbp-r sbis-cb cf block-box"><div class="speech-person"><figure class="speech-icon"><img decoding="async" src="https://scratch.earth-shop.net/wp-content/uploads/10_common/2_character/1_satoshi/4_satoshi_fight.png" alt="サトシ先生" class="speech-icon-image"/></figure><div class="speech-name">サトシ先生</div></div><div class="speech-balloon">
<p class="wp-block-paragraph">はい、説明の仕方を少し工夫してみました。まだ分かりにくいところはありますか？どういった説明がわかりやすいか思いついた方は、「<a target="_self" href="https://scratch.earth-shop.net/contact/" data-type="URL" data-id="https://scratch.earth-shop.net/contact/">しつもん</a>」ページから教えてくださいね！</p>
</div></div>



<div class="wp-block-cocoon-blocks-caption-box-1 caption-box block-box has-border-color has-amber-border-color"><div class="caption-box-label block-box-label box-label fab-lightbulb"><span class="caption-box-label-text block-box-label-text box-label-text">今日のポイントのおさらい</span></div><div class="caption-box-content block-box-content box-content">
<ul class="wp-block-list">
<li>マリオを滑らかに移動させる<br>「ずっと」ブロックを使って、キー入力を監視します</li>



<li>「ブロック定義」を使って、スクリプトを見やすくする<br>まとまりのある処理（今回だと「左右に移動する」処理）は、ブロック定義で1つにまとめます</li>
</ul>
</div></div>
]]></content:encoded>
					
					<wfw:commentRss>https://scratch.earth-shop.net/pg-sp-mario-move/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>スーパーマリオをスクラッチで作ろう</title>
		<link>https://scratch.earth-shop.net/pg-sp-mario/</link>
					<comments>https://scratch.earth-shop.net/pg-sp-mario/#respond</comments>
		
		<dc:creator><![CDATA[サトシ]]></dc:creator>
		<pubDate>Fri, 24 Feb 2023 19:00:48 +0000</pubDate>
				<category><![CDATA[有名なあのゲームを作る]]></category>
		<guid isPermaLink="false">https://scratch.earth-shop.net/?p=3225</guid>

					<description><![CDATA[基本のプログラム まずは、基本のプログラムを作成しよう！まずは、マリオが左右に移動できるようにしよう。 次に、マリオが走り回るコースを作成しましょう。簡単な方法で、重力をプログラミングします。 応用編 基本のプログラムが [&#8230;]]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading"><span id="toc1">基本のプログラム</span></h2>



<p class="wp-block-paragraph">まずは、基本のプログラムを作成しよう！まずは、マリオが左右に移動できるようにしよう。</p>



<div class="wp-block-cocoon-blocks-blogcard blogcard-type bct-none">

<a target="_self" href="https://scratch.earth-shop.net/pg-sp-mario-move/" title="【スーパーマリオ】左右に移動する" class="blogcard-wrap internal-blogcard-wrap a-wrap cf"><div class="blogcard internal-blogcard ib-left cf"><div class="blogcard-label internal-blogcard-label"><span class="fa"></span></div><figure class="blogcard-thumbnail internal-blogcard-thumbnail"><img loading="lazy" decoding="async" width="160" height="90" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/sp-mario-move-160x90.jpg" class="blogcard-thumb-image internal-blogcard-thumb-image wp-post-image" alt="" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/sp-mario-move-160x90.jpg 160w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/sp-mario-move-120x68.jpg 120w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/sp-mario-move-320x180.jpg 320w" sizes="(max-width: 160px) 100vw, 160px" /></figure><div class="blogcard-content internal-blogcard-content"><div class="blogcard-title internal-blogcard-title">【スーパーマリオ】左右に移動する</div><div class="blogcard-snippet internal-blogcard-snippet">スーパーマリオをスクラッチで作っていきましょう！第一回目は、マリオが右に左に移動できるようにします！</div></div><div class="blogcard-footer internal-blogcard-footer cf"><div class="blogcard-site internal-blogcard-site"><div class="blogcard-favicon internal-blogcard-favicon"><img loading="lazy" decoding="async" src="https://www.google.com/s2/favicons?domain=https://scratch.earth-shop.net" alt="" class="blogcard-favicon-image internal-blogcard-favicon-image" width="16" height="16" /></div><div class="blogcard-domain internal-blogcard-domain">scratch.earth-shop.net</div></div><div class="blogcard-date internal-blogcard-date"><div class="blogcard-post-date internal-blogcard-post-date">2023.02.25</div></div></div></div></a>
</div>



<p class="wp-block-paragraph">次に、マリオが走り回るコースを作成しましょう。簡単な方法で、重力をプログラミングします。</p>



<div class="wp-block-cocoon-blocks-blogcard blogcard-type bct-none">

<a target="_self" href="https://scratch.earth-shop.net/pg-sp-mario-course-ground/" title="【スーパーマリオ】コース（地面）を作成する" class="blogcard-wrap internal-blogcard-wrap a-wrap cf"><div class="blogcard internal-blogcard ib-left cf"><div class="blogcard-label internal-blogcard-label"><span class="fa"></span></div><figure class="blogcard-thumbnail internal-blogcard-thumbnail"><img loading="lazy" decoding="async" width="160" height="90" src="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/course-160x90.png" class="blogcard-thumb-image internal-blogcard-thumb-image wp-post-image" alt="" srcset="https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/course-160x90.png 160w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/course-120x68.png 120w, https://scratch.earth-shop.net/wp-content/uploads/20_articles/3_posted/code/pg-famous-game/sp-mario/course-320x180.png 320w" sizes="(max-width: 160px) 100vw, 160px" /></figure><div class="blogcard-content internal-blogcard-content"><div class="blogcard-title internal-blogcard-title">【スーパーマリオ】コース（地面）を作成する</div><div class="blogcard-snippet internal-blogcard-snippet">第二回目は、マリオのコースを作成します！空中にいるときに地面に向かって落ちていくプログラミングをします。</div></div><div class="blogcard-footer internal-blogcard-footer cf"><div class="blogcard-site internal-blogcard-site"><div class="blogcard-favicon internal-blogcard-favicon"><img loading="lazy" decoding="async" src="https://www.google.com/s2/favicons?domain=https://scratch.earth-shop.net" alt="" class="blogcard-favicon-image internal-blogcard-favicon-image" width="16" height="16" /></div><div class="blogcard-domain internal-blogcard-domain">scratch.earth-shop.net</div></div><div class="blogcard-date internal-blogcard-date"><div class="blogcard-post-date internal-blogcard-post-date">2023.05.07</div></div></div></div></a>
</div>



<h2 class="wp-block-heading"><span id="toc2">応用編</span></h2>



<p class="wp-block-paragraph">基本のプログラムができたら、<br>気になる機能を追加してみよう！</p>
]]></content:encoded>
					
					<wfw:commentRss>https://scratch.earth-shop.net/pg-sp-mario/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
