[{ "x": 40, "y": 284, "constructorName": "PuppetBlock", "variables": { "name": "アイコン", "fold": "-", "image": "icon0.png", "behavior": { "x": 0, "y": 0, "constructorName": "DisplayBlock", "variables": { "appeartype": "standAlone", "interval": "30", "initial": "10" }, "next": { "x": 0, "y": 0, "constructorName": "FrameBlock", "variables": { "prop": "scaleX", "value": "4" }, "next": { "x": 0, "y": 0, "constructorName": "FrameBlock", "variables": { "prop": "scaleY", "value": "4" }, "next": { "x": 0, "y": 0, "constructorName": "FrameSequenceBlock", "variables": { "sequence": [26], "times": "2" }, "next": { "x": 0, "y": 0, "constructorName": "ListenerBlock", "variables": { "eventType": "sceneTouchend", "fold": "-", "handler": { "x": 0, "y": 0, "constructorName": "IfBlock", "variables": { "condition": { "x": 0, "y": 0, "constructorName": "ProbBlock", "variables": { "value": "20" } }, "fold": "-", "thenDo": { "x": 0, "y": 0, "constructorName": "SEBlock", "variables": { "sesrc": "explosion.wav" }, "next": { "x": 0, "y": 0, "constructorName": "GameOverBlock", "variables": {}, "next": null } } }, "next": null } }, "next": null } } } } } } }]
Author: furukawa
サウンドブロックのサンプルのセーブデータ
[{ "x": -402, "y": -20, "constructorName": "PuppetBlock", "variables": { "name": "アイコン", "fold": "-", "image": "icon0.png", "behavior": { "x": 0, "y": 0, "constructorName": "DisplayBlock", "variables": { "appeartype": "randomSetup", "interval": "30", "initial": "10" }, "next": { "x": 0, "y": 0, "constructorName": "FrameSequenceBlock", "variables": { "sequence": [14], "times": "2" }, "next": { "x": 0, "y": 0, "constructorName": "ListenerBlock", "variables": { "eventType": "touchend", "fold": "-", "handler": { "x": 0, "y": 0, "constructorName": "AddBehaviorBlock", "variables": { "fold": "-", "behavior": { "x": 0, "y": 0, "constructorName": "SpecialBlock", "variables": { "type": "die", "biggerdir": "X", "smallerdir": "X", "rotdir": "5" }, "next": null } }, "next": { "x": 0, "y": 0, "constructorName": "SEBlock", "variables": { "sesrc": "coin.wav" }, "next": null } } }, "next": null } } } } }]
ナイトのモンスター退治のセーブデータ
[{ "x": 47, "y": 71, "constructorName": "PuppetBlock", "variables": { "name": "ナイト", "fold": "-", "image": "chara5.png", "behavior": { "x": 0, "y": 0, "constructorName": "DisplayBlock", "variables": { "appeartype": "standAlone", "interval": "30", "initial": "10" }, "next": { "x": 0, "y": 0, "constructorName": "FrameSequenceBlock", "variables": { "sequence": [31], "times": "2" }, "next": { "x": 0, "y": 0, "constructorName": "MoveBlock", "variables": { "type": "tapChase", "zigzagdirection": "X", "tapdirection": "X", "movedirection": "Left", "dx": "0", "dy": "0" }, "next": { "x": 0, "y": 0, "constructorName": "FrameBlock", "variables": { "prop": "x", "value": "144" }, "next": { "x": 0, "y": 0, "constructorName": "FrameBlock", "variables": { "prop": "y", "value": "280" }, "next": { "x": 0, "y": 0, "constructorName": "ListenerBlock", "variables": { "eventType": "enterframe", "fold": "-", "handler": { "x": 0, "y": 0, "constructorName": "IfBlock", "variables": { "condition": { "x": 0, "y": 0, "constructorName": "PuppetExpressionBlock", "variables": { "condition": "enchant.puppet.Theatre.instance.frame % 10 == 9" } }, "fold": "-", "thenDo": { "x": 0, "y": 0, "constructorName": "NewPuppetBlock", "variables": { "name": "アイコン", "fold": "-", "behavior": null }, "next": null } }, "next": null } }, "next": null } } } } } } } }, { "x": 469, "y": 79, "constructorName": "PuppetBlock", "variables": { "name": "アイコン", "fold": "-", "image": "icon0.png", "behavior": { "x": 0, "y": 0, "constructorName": "FrameSequenceBlock", "variables": { "sequence": [48], "times": "2" }, "next": { "x": 0, "y": 0, "constructorName": "MoveBlock", "variables": { "type": "move", "zigzagdirection": "X", "tapdirection": "X", "movedirection": "Up", "dx": "0", "dy": "0" }, "next": { "x": 0, "y": 0, "constructorName": "FrameBlock", "variables": { "prop": "speed", "value": "50" }, "next": null } } } } }, { "x": 464, "y": 342, "constructorName": "PuppetBlock", "variables": { "name": "モンスター", "fold": "-", "image": "chara6.png", "behavior": { "x": 0, "y": 0, "constructorName": "DisplayBlock", "variables": { "appeartype": "randomAppearTop", "interval": "5", "initial": "10" }, "next": { "x": 0, "y": 0, "constructorName": "FrameSequenceBlock", "variables": { "sequence": [4], "times": "2" }, "next": { "x": 0, "y": 0, "constructorName": "CollisionBlock", "variables": { "className": "アイコン", "whenHit": "\"hitAndDie\", ", "score": "10" }, "next": { "x": 0, "y": 0, "constructorName": "ListenerBlock", "variables": { "eventType": "enterframe", "fold": "-", "handler": { "x": 0, "y": 0, "constructorName": "IfBlock", "variables": { "condition": { "x": 0, "y": 0, "constructorName": "AndBlock", "variables": { "a": { "x": 0, "y": 0, "constructorName": "PropertyBlock", "variables": { "name": "y" } }, "op": ">=", "b": { "x": 0, "y": 0, "constructorName": "NumberBlock", "variables": { "value": "320" } } } }, "fold": "-", "thenDo": { "x": 0, "y": 0, "constructorName": "GameOverBlock", "variables": {}, "next": null } }, "next": null } }, "next": null } } } } } }, { "x": 48, "y": 725, "constructorName": "ScoreBoardBlock", "variables": { "fold": "-", "behavior": null } }, { "x": 47, "y": 832, "constructorName": "BackgroundBlock", "variables": { "bgsrc": "rpg.png" } }]
クマさんのリンゴ狩りのセーブデータ
[{ "x": 69, "y": 396, "constructorName": "PuppetBlock", "variables": { "name": "アイコン", "fold": "-", "image": "icon0.png", "behavior": { "x": 0, "y": 0, "constructorName": "DisplayBlock", "variables": { "appeartype": "randomSetup", "interval": "30", "initial": "10" }, "next": { "x": 0, "y": 0, "constructorName": "FrameSequenceBlock", "variables": { "sequence": [15], "times": "2" }, "next": { "x": 0, "y": 0, "constructorName": "CollisionBlock", "variables": { "className": "くま", "whenHit": "\"hitAndDie\", ", "score": "0" }, "next": { "x": 0, "y": 0, "constructorName": "ListenerBlock", "variables": { "eventType": "actordieall", "fold": "-", "handler": { "x": 0, "y": 0, "constructorName": "GameClearBlock", "variables": {}, "next": null } }, "next": null } } } } } }, { "x": 69, "y": 212, "constructorName": "PuppetBlock", "variables": { "name": "くま", "fold": "-", "image": "chara1.png", "behavior": { "x": 0, "y": 0, "constructorName": "DisplayBlock", "variables": { "appeartype": "standAlone", "interval": "30", "initial": "10" }, "next": { "x": 0, "y": 0, "constructorName": "MoveBlock", "variables": { "type": "tapChase", "zigzagdirection": "X", "tapdirection": "", "movedirection": "Left", "dx": "0", "dy": "0" }, "next": null } } } }, { "x": 70, "y": 784, "constructorName": "TimerBoardBlock", "variables": { "countdir": "countup", "fold": "-", "seconds": "10", "behavior": null } }]
ナイトのモンスター退治
ナイトを操作して迫りくるモンスターから村を守るゲームです。ナイトが投げる剣がモンスターに当たれば得点になります。モンスターが画面下に行くと村が守れずゲームオーバーになります。
プログラムは次の通りです。
クマさんのリンゴ狩りを作る
クマさんを操作してリンゴをひろうゲームを作りましょう。
(1)「パペットブロック」をワークスペースに配置し、「出現ブロック」と「動きブロック」を組み込みましょう。「動きブロック」には”タップしたところに向かって移動”と”全方向”を指定します。これでクマさんがタップしたところに移動するようになります。
(2)「パペットブロック」をもう1つワークスペースに配置し、「クマさん」の絵をタップし、「1」のアイコンを選択します。そして「出現ブロック」を組み込み、”たくさんでる”を指定します。
(3)アイコンの「パペットブロック」に「フレームシーケンスブロック」(ビヘイビアキットの1番下のブロック)を組み込み、絵柄をリンゴに変更しましょう。絵柄一覧の下端に表示されているのが選択した絵柄です。絵柄は複数選択してアニメーションさせることができますが、今回はリンゴ1枚だけで良いので、いらない絵柄はタップで消してください。
(4)アイコンの「パペットブロック」に「当たり判定ブロック」を組み込み、当たる相手に”くま”、あたるとに”消える”を指定します。これで衝突するとリンゴが消えるようになります。
(5)アイコンの「パペットブロック」に「リアクションキット」の「リアクションブロック」を組み込み、”全滅した”を指定します。そして「リアクションブロック」に「ゲームキット」の「ゲームクリアブロック」を組み込みます。これでリンゴを全て拾った時にゲームクリアになります。
(6)「ゲームキット」の「タイマーボードブロック」をワークスペースに配置し、”カウントアップ”を指定します。これでゲームクリアまでの時間を画面に表示します。
(7)最後に画面下の方の「Runボタン」を押してプログラムを実行しましょう。
確率ブロックの使い方
サウンドブロックの使い方
「サウンドブロック」は音を鳴らすブロックです。
・コインアラーム
・ピンポン
・ブー
・ばくはつ
・ボヨン
・ガシャン
・ゲームオーバー
・ジャーン
サウンドブロックの例として、コインをタッチすると音を鳴らしながら消えるプログラムを作ります。
プログラムは次の通りです。