第1回Platformer講座
@Stage\n\ndefine 字幕 (なにを)\nset [どこ v] to [0]\nset [字幕 v] to []\nrepeat (length of (なにを))\n    change [どこ v] by (1)\n    set [字幕 v] to (join (字幕) (letter (どこ) of (なにを)))\n    wait (0.06) seconds\nend\nwait until <<mouse down?> or <key (space v) pressed?>>\nwait until <<mouse down?> or <not <key (space v) pressed?>>>\n\nwhen flag clicked\nset [字幕 v] to []\n字幕 [動かしてみよう！]\nbroadcast (0 v)\n字幕 [こんなプログラムみんなつくってない？]\n字幕 [これじゃあ、なんか滑らかじゃないな～]\n字幕 [今日は滑らかな横の動きをつくるよ]\n字幕 [滑らかな動きにするには変数が必要だよ]\n字幕 [とりあえず変数xをつくろう！]\nbroadcast (1 v)\n字幕 [はい、できたね]\nbroadcast (2 v)\n字幕 [ここまで作ってみよう]\n字幕 [まあ、楽勝だね]\n字幕 [次に左右キー関係をつくるよ]\nbroadcast (3 v)\n字幕 [ここまで作ろう（がんばって！）]\n字幕 [なんかできたね]\nbroadcast (動かす v)\n字幕 [でもこのまま動かすと・・・（動かしてみて）]\n字幕 [あ～～～いっちゃった]\n字幕 [なにかxを小さくする方法はないかな～]\nbroadcast (5 v)\n字幕 [これだ！！！]\n字幕 [xを0.9倍ずつすればだんだん0になる！！！]\n字幕 [ここで問題]\nask [10×0.9は？] and wait\nif <<(answer) = [9]> or <(answer) = [9]>> then\n    字幕 [そう答えは9]\n    字幕 [0に近づいてるね]\nelse\n    字幕 [え？こたえは9だよ]\n    字幕 [0に近づいてるね]\nend\n字幕 [もう1問]\nask [-10×0.9は？] and wait\nif <<(answer) = [-9]> or <(answer) = [-9]>> then\n    字幕 [そう答えは-9]\n    字幕 [こっちも、0に近づいてるね]\nelse\n    字幕 [え？こたえは-9だよ]\n    字幕 [こっちも、0に近づいてるね]\nend\n字幕 [じゃあこれをさっきのプログラムにつけよう]\nbroadcast (6 v)\n字幕 [こんな感じになったね]\nbroadcast (動かす2 v)\n字幕 [動かしてみてね]\n字幕 [滑らかになったね！]\nbroadcast (動かす3 v)\n字幕 [比べてみよう（A,Dで最初のやつ、左右キーで滑らかなやつ）]\n字幕 [全然違うね！]\n字幕 [これで横の動きはできるよ]\n字幕 [これに向きをつけると・・・]\nbroadcast (7 v)\n字幕 [こうなるね（画質悪くてごめんね）]\nbroadcast (動かす5 v)\n字幕 [動かしてみよう]\n字幕 [でもこれはまだ壁貫通しちゃうからね]\n字幕 [次回は・・・]\n字幕 [つくるかも]\n字幕 [じゃーねー]\n\n@説明\n\nwhen I receive [1 v]\nswitch costume to (1 v)\ngo to x: (0) y: (0)\nshow\nset size to (200) %\n\nwhen flag clicked\nhide\n\nwhen I receive [2 v]\nswitch costume to (2 v)\ngo to x: (0) y: (0)\nshow\nset size to (120) %\n\nwhen I receive [3 v]\nswitch costume to (3 v)\ngo to x: (0) y: (5)\nshow\nset size to (100) %\n\nwhen I receive [0 v]\nswitch costume to (4 v)\ngo to x: (0) y: (0)\nshow\nset size to (100) %\n\nwhen I receive [5 v]\nswitch costume to (5 v)\ngo to x: (0) y: (0)\nshow\nset size to (150) %\n\nset [x v] to ((x) * (0.9))\n\nwhen I receive [6 v]\nswitch costume to (6 v)\ngo to x: (0) y: (0)\nshow\nset size to (180) %\n\nwhen I receive [7 v]\nswitch costume to (7 v)\ngo to x: (0) y: (0)\nshow\nset size to (130) %\n\n@スプライト1\n\nwhen flag clicked\ngo to x: (0) y: (-90)\ngo to [front v] layer\npoint in direction (90)\nforever\n    if <key (left arrow v) pressed?> then\n        change x by (-5)\n    end\n    if <key (right arrow v) pressed?> then\n        change x by (5)\n    end\nend\n\nwhen I receive [動かす v]\nstop [other scripts in sprite v]\nset [x v] to [0]\nforever\n    if <key (left arrow v) pressed?> then\n        change [x v] by (-1)\n    end\n    if <key (right arrow v) pressed?> then\n        change [x v] by (1)\n    end\n    change x by (x)\nend\n\nwhen I receive [動かす2 v]\nstop [other scripts in sprite v]\nset [x v] to [0]\nforever\n    if <key (left arrow v) pressed?> then\n        change [x v] by (-1)\n    end\n    if <key (right arrow v) pressed?> then\n        change [x v] by (1)\n    end\n    change x by (x)\n    set [x v] to ((x) * (0.9))\nend\n\nwhen I receive [動かす3 v]\nstop [other scripts in sprite v]\nset [x v] to [0]\nforever\n    if <key (left arrow v) pressed?> then\n        change [x v] by (-1)\n    end\n    if <key (right arrow v) pressed?> then\n        change [x v] by (1)\n    end\n    change x by (x)\n    set [x v] to ((x) * (0.9))\n    if <key (a v) pressed?> then\n        change x by (-5)\n    end\n    if <key (d v) pressed?> then\n        change x by (5)\n    end\nend\n\nwhen I receive [動かす5 v]\nstop [other scripts in sprite v]\nset rotation style [left-right v]\nset [x v] to [0]\nforever\n    if <key (left arrow v) pressed?> then\n        change [x v] by (-1)\n        point in direction (-90)\n    end\n    if <key (right arrow v) pressed?> then\n        change [x v] by (1)\n        point in direction (90)\n    end\n    change x by (x)\n    set [x v] to ((x) * (0.9))\nend\n\n
クリックまたはスペースキーで進みます\n\nまあまあ頑張って作りました\n\nhttps://scratch.mit.edu/projects/391325958/\n☝第2回\nhttps://scratch.mit.edu/projects/391595275/\n☝第3回