プラットフォーマーアドベンチャー　Platformer adventure

Instructions: 今回はプラットフォーマーを作りました！今回はキャラ選択やステージ選択をできるようにしました！操作方法は下にあります！\n【過去に作ったゲーム】\n早撃ちガンマン\nhttps://scratch.mit.edu/projects/843429723/\nスクロールするプラフォ\nhttps://scratch.mit.edu/projects/828987547/\n【操作】\n右へ移動：右矢印キー\n左へ移動：左矢印キー\nジャンプ：上矢印キー\nーーーーーーーーーークレジットーーーーーーーーー

@Stage\n\nwhen flag clicked\nswitch backdrop to (背景2 v)\n\nwhen I receive [start v]\nif <(ステージ暗号) = [1]> then\n    switch backdrop to (背景2 v)\n    repeat until <(clear road) = (ゴール)>\n        play sound [Sugar_Zone.mp3 v] until done\n    end\nend\nif <(ステージ暗号) = [2]> then\n    switch backdrop to (洞窟道中 v)\n    repeat until <(clear road) = (ゴール)>\n        play sound [Teruto_Among v] until done\n    end\nend\nif <(ステージ暗号) = [3]> then\n    switch backdrop to (背景2 v)\n    broadcast (曲を流す２ v)\n    wait until <(clear road) > [10.1]>\n    switch backdrop to (洞窟道中 v)\nend\n\nwhen flag clicked\n\nwhen flag clicked\nset volume to (40) %\nstart sound [草原 v]\n\nwhen I receive [曲を流す v]\nstart sound [Starship v]\n\nwhen I receive [ゴール v]\nstop all sounds\nplay sound [クリア v] until done\n\nwhen I receive [曲を流す２ v]\nrepeat until <(clear road) = (ゴール)>\n    play sound [1 v] until done\nend\n\n@player\n\nwhen I receive [suta-to  v]\nset volume to (100) %\n\nwhen flag clicked\nset size to (60) %\ngo to x: (-220) y: (50)\nset [ghost v] effect to (100)\ngo to [back v] layer\nhide\n\nwhen flag clicked\nforever\n    if <(キャラ暗号) = [1]> then\n        set [方向 v] to [1]\n        set [左方向 v] to [2]\n        set [右方向 v] to [3]\n    end\n    if <(キャラ暗号) = [2]> then\n        set [方向 v] to [4]\n        set [左方向 v] to [5]\n        set [右方向 v] to [6]\n    end\n    if <(キャラ暗号) = [3]> then\n        set [方向 v] to [7]\n        set [左方向 v] to [8]\n        set [右方向 v] to [9]\n    end\n    if <(キャラ暗号) = [4]> then\n        set [方向 v] to [10]\n        set [左方向 v] to [11]\n        set [右方向 v] to [12]\n    end\n    if <(キャラ暗号) = [5]> then\n        set [方向 v] to [13]\n        set [左方向 v] to [14]\n        set [右方向 v] to [15]\n    end\n    if <(キャラ暗号) = [6]> then\n        set [方向 v] to [16]\n        set [左方向 v] to [17]\n        set [右方向 v] to [18]\n    end\nend\n\nwhen I receive [start v]\nswitch costume to (方向)\nshow\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\nset rotation style [left-right v]\npoint in direction (90)\nset [x v] to [0]\nset [y v] to [0]\nforever\n    switch costume to (方向)\n    if <<touching (spike v)?> or <<touching (spike2 v)?> or <touching (spike3 v)?>>> then\n        start sound [crashed oof v]\n        repeat (10)\n            change [ghost v] effect by (7)\n        end\n        clear graphic effects\n        go to x: (-210) y: (100)\n    end\n    if <<<(x position) > (mouse x)> and <mouse down?>> or <key (left arrow v) pressed?>> then\n        change [xのやつ v] by (-0.9)\n        switch costume to (左方向)\n    end\n    if <<<(mouse x) > (x position)> and <mouse down?>> or <key (right arrow v) pressed?>> then\n        change [xのやつ v] by (0.9)\n        switch costume to (右方向)\n    end\n    set [xのやつ v] to ((xのやつ) * (0.9))\n    change x by (xのやつ)\n    if <touching (road- v)?> then\n        change y by (1)\n        if <touching (road- v)?> then\n            change y by (1)\n            if <touching (road- v)?> then\n                change y by (1)\n                if <touching (road- v)?> then\n                    change y by (1)\n                    if <touching (road- v)?> then\n                        change y by (1)\n                        if <touching (road- v)?> then\n                            change x by ((xのやつ) * (-1))\n                            change y by (-5)\n                            if <<key (up arrow v) pressed?> or <<(mouse y) > (y position)> and <mouse down?>>> then\n                                start sound [ニュッ v]\n                                if <(xのやつ) > [0]> then\n                                    set [xのやつ v] to [-7]\n                                else\n                                    set [xのやつ v] to [7]\n                                end\n                                set [ｙだー v] to [15]\n                            else\n                                set [xのやつ v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (-1)\n    if <touching (road- v)?> then\n        if <<key (up arrow v) pressed?> or <<(mouse y) > (y position)> and <mouse down?>>> then\n            set [ｙだー v] to [15.3]\n            start sound [ニュッ v]\n        end\n    end\n    change y by (1)\n    change [ｙだー v] by (-1)\n    change y by (ｙだー)\n    if <touching (road- v)?> then\n        change y by ((ｙだー) * (-1))\n        set [ｙだー v] to [0]\n    end\n    if <(x position) > [230]> then\n        broadcast (next v)\n        start sound [Rip v]\n        wait (0.5) seconds\n        go to x: (-216) y: (50)\n    end\nend\n\nwhen I receive [ゴール v]\nstop [other scripts in sprite v]\n\n@spike\n\nwhen flag clicked\nhide\n\nwhen I receive [next v]\nwait (0.3) seconds\nnext costume\nif <(costume [number v]) = [1]> then\n    switch costume to (コスチューム1 v)\nend\nif <(costume [number v]) = [2]> then\n    switch costume to (コスチューム2 v)\nend\nif <(costume [number v]) = [3]> then\n    switch costume to (コスチューム3 v)\nend\nif <(costume [number v]) = [4]> then\n    switch costume to (コスチューム4 v)\nend\nif <(costume [number v]) = [5]> then\n    switch costume to (コスチューム5 v)\nend\nif <(costume [number v]) = [6]> then\n    switch costume to (コスチューム6 v)\nend\nif <(costume [number v]) = [7]> then\n    switch costume to (コスチューム7 v)\nend\nif <(costume [number v]) = [8]> then\nif <(costume [number v]) = [9]> then\nif <(costume [number v]) = [10]> then\nif <(costume [number v]) = [11]> then\nif <(costume [number v]) = [12]> then\n\nwhen I receive [start v]\nswitch costume to (ステージ背景)\ngo to [front v] layer\nshow\n\nwhen flag clicked\ngo to x: (-4) y: (95)\nrepeat until <(sw3) = [0]>\n    if <(ステージ暗号) = [1]> then\n        set [ステージ背景 v] to [1]\n        set [ゴール v] to [11]\n    end\n    if <(ステージ暗号) = [2]> then\n        set [ステージ背景 v] to [12]\n        set [ゴール v] to [21]\n    end\n    if <(ステージ暗号) = [3]> then\n        set [ステージ背景 v] to [1]\n        set [ゴール v] to [21]\n    end\nend\n\n@road-\n\nwhen I receive [next v]\nwait (0.3) seconds\nchange [clear road v] by (1)\nnext costume\nif <(costume [number v]) = [1]> then\n    switch costume to (コスチューム2 v)\nend\nif <(costume [number v]) = [2]> then\n    switch costume to (コスチューム3 v)\nend\nif <(costume [number v]) = [3]> then\nif <(costume [number v]) = [4]> then\nif <(costume [number v]) = [5]> then\nif <(costume [number v]) = [6]> then\nif <(costume [number v]) = [7]> then\nif <(costume [number v]) = [8]> then\nif <(costume [number v]) = [9]> then\nif <(costume [number v]) = [10]> then\nif <(costume [number v]) = [11]> then\nif <(costume [number v]) = [12]> then\nif <(clear road) = (ゴール)> then\n    broadcast (ゴール v)\nend\n\nwhen flag clicked\nswitch costume to (コスチューム2 v)\nset [ghost v] effect to (100)\ngo to x: (-10) y: (5)\n\nwhen I receive [suta-to  v]\n\nwhen flag clicked\nset [☁ world record v] to (☁ world record)\nset [time v] to [0]\nhide variable [time 表示 v]\n\nwhen I receive [ゴール v]\nhide variable [time v]\nset [time 表示 v] to (time)\nshow variable [time 表示 v]\n\nrepeat until <(costume [number v]) = [11]>\n    wait (1) seconds\n    change [time v] by (1)\nend\n\nif <(costume [number v]) = [11]> then\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nshow\nswitch costume to (ステージ背景)\nset [clear road v] to [0]\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\n\nwhen flag clicked\nrepeat until <(sw3) = [0]>\n    if <(ステージ暗号) = [1]> then\n        set [ステージ背景 v] to [1]\n        set [ゴール v] to [11]\n    end\n    if <(ステージ暗号) = [2]> then\n        set [ステージ背景 v] to [12]\n        set [ゴール v] to [10]\n    end\n    if <(ステージ暗号) = [3]> then\n        set [ステージ背景 v] to [1]\n        set [ゴール v] to [21]\n    end\nend\n\nwhen I receive [ステージ選択 v]\n\nwhen I receive [ゴール v]\nstop [other scripts in sprite v]\n\n@spike2\n\nwhen flag clicked\nhide\ngo to x: (77) y: (-64)\n\nwhen I receive [next v]\nwait (0.3) seconds\nnext costume\nif <(costume [number v]) = [1]> then\n    switch costume to (コスチューム1 v)\nend\nif <(costume [number v]) = [2]> then\n    switch costume to (コスチューム2 v)\nend\nif <(costume [number v]) = [3]> then\n    switch costume to (コスチューム3 v)\nend\nif <(costume [number v]) = [4]> then\n    switch costume to (コスチューム4 v)\nend\nif <(costume [number v]) = [5]> then\n    switch costume to (コスチューム5 v)\nend\nif <(costume [number v]) = [6]> then\n    switch costume to (コスチューム6 v)\nend\nif <(costume [number v]) = [7]> then\n    switch costume to (コスチューム7 v)\nend\nif <(costume [number v]) = [8]> then\nif <(costume [number v]) = [9]> then\nif <(costume [number v]) = [10]> then\nif <(costume [number v]) = [11]> then\nif <(costume [number v]) = [12]> then\n\nwhen flag clicked\npoint in direction (90)\nforever\n    if <(costume [number v]) = [10]> then\n        turn right (5) degrees\n    end\nend\n\nwhen I receive [start v]\nswitch costume to (ステージ背景)\ngo to [back v] layer\nshow\n\n@スプライト1\n\n@TIME\n\nwhen flag clicked\nhide\nhide variable [time v]\ngo to x: (-183) y: (148)\n\nwhen I receive [start v]\nshow\ngo to [front v] layer\nshow variable [time v]\nforever\n    change [time v] by (1)\n    wait (1) seconds\nend\n\nwhen I receive [ゴール v]\nhide\n\n@結果画面\n\nwhen I receive [ゴール v]\nshow\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\n\n@サムネ\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\nshow\n\nwhen I receive [start v]\nhide\n\n@PLAYボタン\n\nwhen flag clicked\nswitch costume to (コスチューム1 v)\nset [ghost v] effect to (100)\nwait (1) seconds\nshow\ngo to [front v] layer\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\ngo to x: (0) y: (-134)\nset [sw v] to [1]\nrepeat until <(sw) = [0]>\n    switch costume to (コスチューム1 v)\n    if <touching (mouse-pointer v)?> then\n        switch costume to (コスチューム2 v)\n        if <mouse down?> then\n            broadcast (曲を流す v)\n            stop all sounds\n            play sound [コイン v] until done\n            set [sw v] to [0]\n            broadcast (色の選択 v)\n            hide\n        end\n    end\nend\n\n@spike3\n\nwhen flag clicked\nhide\n\nwhen I receive [next v]\nwait (0.3) seconds\nnext costume\nif <(costume [number v]) = [1]> then\n    switch costume to (コスチューム1 v)\n    if <(costume [number v]) = [2]> then\n        switch costume to (コスチューム2 v)\n    end\n    if <(costume [number v]) = [3]> then\n        switch costume to (コスチューム3 v)\n    end\n    if <(costume [number v]) = [4]> then\n        switch costume to (コスチューム4 v)\n    end\n    if <(costume [number v]) = [5]> then\n        switch costume to (コスチューム5 v)\n    end\n    if <(costume [number v]) = [6]> then\n        switch costume to (コスチューム6 v)\n    end\n    if <(costume [number v]) = [7]> then\n        switch costume to (コスチューム7 v)\n    end\n    if <(costume [number v]) = [8]> then\n    if <(costume [number v]) = [9]> then\n    if <(costume [number v]) = [10]> then\n    if <(costume [number v]) = [11]> then\n    if <(costume [number v]) = [16]> then\n        go to x: (14) y: (-82)\n        go to [back v] layer\n    end\n    if <(costume [number v]) = [19]> then\n        go to x: (-1) y: (18)\n        go to [back v] layer\n    end\n    if <(costume [number v]) = [19]> then\n        go to x: (162) y: (-73)\n        go to [back v] layer\n    end\nend\n\nwhen flag clicked\ngo to x: (14) y: (-82)\npoint in direction (90)\nforever\n    if <<(costume [number v]) = [16]> or <<(costume [number v]) = [19]> or <(costume [number v]) = [20]>>> then\n        turn right (5) degrees\n    end\nend\n\nwhen I receive [start v]\nswitch costume to (ステージ背景)\ngo to [back v] layer\nshow\n\n@色選択画面\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\n\nwhen I receive [色の選択 v]\ngo to [front v] layer\nshow\n\nwhen I receive [start v]\nhide\n\n@キャラ変更ボタン\n\nwhen flag clicked\ngo to x: (110) y: (-12)\nhide\nswitch costume to (コスチューム1 v)\nset [ghost v] effect to (100)\n\nwhen I receive [色の選択 v]\nwait (0.5) seconds\ngo to [front v] layer\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nset [sw2 v] to [1]\nrepeat until <(sw2) = [0]>\n    switch costume to (コスチューム1 v)\n    if <touching (mouse-pointer v)?> then\n        switch costume to (コスチューム2 v)\n        if <mouse down?> then\n            wait until <not <mouse down?>>\n            broadcast (キャラ変更 v)\n        end\n    end\nend\n\nwhen I receive [start v]\nhide\n\n@キャラ選択\n\nwhen I receive [色の選択 v]\nwait (0.5) seconds\ngo to [front v] layer\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\nwhen flag clicked\ngo to x: (7) y: (6)\nset [キャラ暗号 v] to [1]\nswitch costume to (plafo v)\nset [ghost v] effect to (100)\n\nwhen I receive [キャラ変更 v]\nstart sound [ポップ v]\nnext costume\nchange [キャラ暗号 v] by (1)\nif <[6] < (キャラ暗号)> then\n    switch costume to (plafo v)\n    set [キャラ暗号 v] to [1]\nend\n\nwhen I receive [start v]\nhide\n\nwhen I receive [ステージ選択 v]\nhide\n\n@キャラ決定ボタン\n\nwhen flag clicked\ngo to x: (12) y: (-87)\nhide\nset [ghost v] effect to (100)\n\nwhen I receive [色の選択 v]\nwait (1) seconds\ngo to [front v] layer\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nrepeat until <(sw2) = [0]>\n    switch costume to (コスチューム1 v)\n    if <touching (mouse-pointer v)?> then\n        switch costume to (コスチューム2 v)\n        if <mouse down?> then\n            play sound [Magic Spell v] until done\n            set [sw2 v] to [0]\n            broadcast (ステージ選択 v)\n            hide\n        end\n    end\nend\n\nwhen I receive [start v]\nhide\n\n@ステージ選択\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\nswitch costume to (コスチューム1 v)\nset [ステージ暗号 v] to [1]\nset [sw3 v] to [1]\n\nwhen I receive [start v]\nhide\n\nwhen I receive [ステージ変更 v]\nstart sound [ポップ v]\nnext costume\nchange [ステージ暗号 v] by (1)\nif <(ステージ暗号) = [4]> then\n    switch costume to (コスチューム1 v)\n    set [ステージ暗号 v] to [1]\nend\n\nwhen I receive [ステージ選択 v]\nshow\ngo to [front v] layer\n\n@ステージ変更ボタン\n\nwhen flag clicked\nhide\nswitch costume to (コスチューム1 v)\nset [ghost v] effect to (100)\ngo to x: (204) y: (-19)\n\nwhen I receive [ステージ選択 v]\nwait (0.5) seconds\ngo to [front v] layer\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nset [sw3 v] to [1]\nrepeat until <(sw3) = [0]>\n    switch costume to (コスチューム1 v)\n    if <touching (mouse-pointer v)?> then\n        switch costume to (コスチューム2 v)\n        if <mouse down?> then\n            wait until <not <mouse down?>>\n            broadcast (ステージ変更 v)\n        end\n    end\nend\n\nwhen I receive [start v]\nhide\n\n@STARTボタン\n\nwhen flag clicked\ngo to x: (0) y: (126)\nhide\nset [ghost v] effect to (100)\n\nwhen I receive [ステージ選択 v]\nwait (1) seconds\ngo to [front v] layer\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nrepeat until <(sw3) = [0]>\n    switch costume to (コスチューム1 v)\n    if <touching (mouse-pointer v)?> then\n        switch costume to (コスチューム2 v)\n        if <mouse down?> then\n            stop all sounds\n            play sound [Magic Spell v] until done\n            set [sw3 v] to [0]\n            broadcast (START v)\n            hide\n        end\n    end\nend\n\nwhen I receive [start v]\nhide\n\n