バトルゲーム✖platformer! !

Instructions: 右矢印キー　左矢印キーで移動\n上矢印キーでジャンプ\nスペースキーで攻撃\nOKボタンでその武器を買う\n1回勝つごとに10コイン増えます\n負けたときはリトライボタンを押してください\n勝ったときは3秒待つとホームに戻ります\n\nバグがあります。

@Stage\n\nwhen flag clicked\nhide variable [hp v]\nhide variable [敵　hp v]\nshow variable [coin v]\nset [coin v] to [10]\nset [武器選択 v] to [no]\nbroadcast (ホーム v)\n\nwhen I receive [スタート v]\nstop [other scripts in sprite v]\nshow variable [hp v]\nshow variable [敵　hp v]\nhide variable [coin v]\nswitch backdrop to (背景3 v)\nforever\n    play sound (pick random (2) to (3)) until done\nend\n\nwhen I receive [武器選択 v]\nswitch backdrop to (背景3 v)\n\nwhen I receive [ホーム v]\nstop [other scripts in sprite v]\nswitch backdrop to (背景2 v)\nshow variable [coin v]\nforever\n    play sound [music v] until done\nend\n\n@プレイヤー\n\ndefine 初期設定\ngo to x: (-204) y: (-96)\npoint in direction (90)\nswitch costume to (プレイヤー 前 v)\nclear graphic effects\nset size to (100) %\ngo to [front v] layer\nshow\nset [x v] to [0]\nset [y v] to [0]\nset [hp v] to [100]\nset rotation style [left-right v]\n\nwhen I receive [スタート v]\n初期設定\nforever\n    switch costume to (プレイヤー 前 v)\n    if <key (right arrow v) pressed?> then\n        switch costume to (プレイヤー 右 v)\n        point in direction (90)\n        change [x v] by (0.8)\n    end\n    if <key (left arrow v) pressed?> then\n        switch costume to (プレイヤー 左 v)\n        point in direction (-90)\n        change [x v] by (-0.8)\n    end\n    set [x v] to ((X) * (0.9))\n    change x by (X)\n    if <touching (地面 v)?> then\n        change y by (1)\n        if <touching (地面 v)?> then\n            change y by (1)\n            if <touching (地面 v)?> then\n                change y by (1)\n                if <touching (地面 v)?> then\n                    change y by (1)\n                    if <touching (地面 v)?> then\n                        change y by (1)\n                        if <touching (地面 v)?> then\n                            change x by ((X) * (-1))\n                            change y by (-5)\n                            if <key (up arrow v) pressed?> then\n                                if <(X) > [0]> then\n                                    set [x v] to [-7]\n                                else\n                                    set [x v] to [7]\n                                end\n                                set [y v] to [20]\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 (地面 v)?> then\n        if <key (up arrow v) pressed?> then\n            start sound [Jump v]\n            set [y v] to [20]\n        end\n    end\n    change y by (1)\n    change [y v] by (-1)\n    change y by (Y)\n    if <touching (地面 v)?> then\n        change y by ((Y) * (-1))\n        set [y v] to [0]\n    end\n    if <touching (敵　武器 v)?> then\n        if <(敵　武器) = [木の剣]> then\n            change [hp v] by (-0.1)\n        else\n            if <(敵　武器) = [鉄の剣]> then\n                change [hp v] by (-0.3)\n            else\n                if <(敵　武器) = [金の剣]> then\n                    change [hp v] by (-0.5)\n                else\n                    if <(敵　武器) = [ダイヤモンドの剣]> then\n                        change [hp v] by (-0.8)\n                    else\n                    end\n                end\n            end\n        end\n    end\n    if <touching (敵　矢 v)?> then\n        if <(敵　武器) = [弓]> then\n            change [hp v] by (-0.6)\n        end\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [スタート v]\nforever\n    if <key (space v) pressed?> then\n        set [武器 v] to (武器)\n        broadcast (攻撃 v)\n        wait until <not <key (space v) pressed?>>\n    end\nend\n\nwhen I receive [スタート v]\nforever\n    if <[1] > (HP)> then\n        set [hp v] to [0]\n        stop [other scripts in sprite v]\n        repeat (50)\n            change [pixelate v] effect by (2)\n        end\n        broadcast (You lose v)\n        hide\n        stop [this script v]\n    end\nend\n\nwhen I receive [you win v]\nchange [coin v] by (10)\nhide variable [hp v]\nhide variable [敵　hp v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\n@敵\n\ndefine 初期設定\ngo to x: (204) y: (-96)\npoint in direction (90)\nswitch costume to (プレイヤー 前 v)\nclear graphic effects\nset size to (100) %\ngo to [front v] layer\nclear graphic effects\nshow\nset [敵　y v] to [0]\nset [ok v] to [1]\nset [敵　x v] to [0]\nset [敵　hp v] to [100]\nset rotation style [left-right v]\n\nwhen I receive [スタート v]\n初期設定\nforever\n    switch costume to (プレイヤー 前 v)\n    if <([x position v] of [プレイヤー v]) > (x position)> then\n        switch costume to (プレイヤー 右 v)\n        point in direction (90)\n        change [敵　x v] by (pick random (0.3) to (0.8))\n    end\n    if <(x position) > ([x position v] of [プレイヤー v])> then\n        switch costume to (プレイヤー 左 v)\n        point in direction (-90)\n        change [敵　x v] by (pick random (-0.3) to (-0.8))\n    end\n    set [敵　x v] to ((敵　X) * (0.9))\n    change x by (敵　X)\n    if <touching (地面 v)?> then\n        change y by (1)\n        if <touching (地面 v)?> then\n            change y by (1)\n            if <touching (地面 v)?> then\n                change y by (1)\n                if <touching (地面 v)?> then\n                    change y by (1)\n                    if <touching (地面 v)?> then\n                        change y by (1)\n                        if <touching (地面 v)?> then\n                            change x by ((敵　X) * (-1))\n                            change y by (-5)\n                            if <([y position v] of [プレイヤー v]) > ((y position) + (3))> then\n                                if <(敵　X) > [0]> then\n                                    set [敵　x v] to [-7]\n                                else\n                                    set [敵　x v] to [7]\n                                end\n                                set [敵　y v] to [20]\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 (地面 v)?> then\n        if <([y position v] of [プレイヤー v]) > ((y position) + (3))> then\n            set [敵　y v] to [20]\n        end\n    end\n    change y by (1)\n    change [敵　y v] by (-1)\n    change y by (敵　Y)\n    if <touching (地面 v)?> then\n        change y by ((敵　Y) * (-1))\n        set [敵　y v] to [0]\n    end\n    if <touching (武器 v)?> then\n        if <(武器) = [木の剣]> then\n            change [敵　hp v] by (-0.1)\n        else\n            if <(武器) = [鉄の剣]> then\n                change [敵　hp v] by (-0.3)\n            else\n                if <(武器) = [金の剣]> then\n                    change [敵　hp v] by (-0.5)\n                else\n                    if <(武器) = [ダイヤモンドの剣]> then\n                        change [敵　hp v] by (-0.8)\n                    else\n                    end\n                end\n            end\n        end\n    end\n    if <touching (矢 v)?> then\n        if <(武器) = [弓]> then\n            change [敵　hp v] by (-0.6)\n        end\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [スタート v]\nforever\n    if <<touching (プレイヤー v)?> or <[200] > (distance to [プレイヤー v])>> then\n        wait until <(OK) = [1]>\n        broadcast (敵　攻撃 v)\n    end\nend\n\nwhen I receive [スタート v]\nforever\n    if <[1] > (敵　HP)> then\n        set [敵　hp v] to [0]\n        stop [other scripts in sprite v]\n        repeat (50)\n            change [pixelate v] effect by (2)\n        end\n        broadcast (You win v)\n        hide\n        stop [this script v]\n    end\nend\n\nwhen I receive [you lose v]\nhide variable [hp v]\nhide variable [敵　hp v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\n@地面\n\nwhen flag clicked\nset [ステージ v] to []\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [スタート v]\nset [ステージ v] to (pick random (1) to (3))\nswitch costume to (ステージ)\nshow\n\nwhen I receive [ホーム v]\nhide\n\n@武器\n\nwhen flag clicked\nhide\n\nwhen I receive [攻撃 v]\nswitch costume to (武器)\ngo to [back v] layer\nshow\nif <(武器) = [弓]> then\n    if <(弓矢　OK) = [ok]> then\n        broadcast (弓矢発射 v)\n    end\nelse\n    if <([direction v] of [プレイヤー v]) = [90]> then\n        repeat (18)\n            turn right (20) degrees\n        end\n        hide\n    end\n    if <([direction v] of [プレイヤー v]) = [-90]> then\n        repeat (18)\n            turn left (20) degrees\n        end\n        hide\n    end\nend\n\nwhen I receive [スタート v]\nforever\n    go to (プレイヤー v)\n    go to [front v] layer\nend\n\nwhen I receive [スタート v]\nforever\n    if <(武器) = [弓]> then\n        point towards (敵 v)\n    end\nend\n\nwhen I receive [you lose v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\nwhen I receive [you win v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\nset [coin v] to [70]\n\n@敵　武器\n\nwhen flag clicked\nhide\n\nwhen I receive [敵　攻撃 v]\nswitch costume to (敵　武器)\ngo to [back v] layer\nshow\nset [ok v] to [0]\nif <(敵　武器) = [弓]> then\n    if <(敵弓矢　ok) = [ok]> then\n        broadcast (敵弓矢発射 v)\n    end\nelse\n    if <([direction v] of [敵 v]) = [90]> then\n        repeat (18)\n            turn right (20) degrees\n        end\n        hide\n        set [ok v] to [1]\n    end\n    if <([direction v] of [敵 v]) = [-90]> then\n        repeat (18)\n            turn left (20) degrees\n        end\n        hide\n        set [ok v] to [1]\n    end\nend\n\nwhen I receive [スタート v]\nforever\n    go to (敵 v)\n    go to [front v] layer\nend\n\nwhen I receive [スタート v]\nswitch costume to (pick random (1) to (5))\nforever\n    if <(costume [number v]) = [1]> then\n        set [敵　武器 v] to [木の剣]\n    else\n        if <(costume [number v]) = [2]> then\n            set [敵　武器 v] to [鉄の剣]\n        else\n            if <(costume [number v]) = [3]> then\n                set [敵　武器 v] to [金の剣]\n            else\n                if <(costume [number v]) = [4]> then\n                    set [敵　武器 v] to [ダイヤモンドの剣]\n                else\n                    if <(costume [number v]) = [5]> then\n                        set [敵　武器 v] to [弓]\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [スタート v]\nforever\n    if <(敵　武器) = [弓]> then\n        point towards (プレイヤー v)\n    end\nend\n\nwhen I receive [you win v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\nwhen I receive [you lose v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\n@スタートボタン\n\nwhen flag clicked\nhide\n\nwhen I receive [ホーム v]\ngo to x: (0) y: (-16)\nshow\nforever\n    if <(武器選択) = [yes]> then\n        hide\n        stop [other scripts in sprite v]\n        stop [this script v]\n    else\n        set size to (90) %\n        if <touching (mouse-pointer v)?> then\n            set size to (100) %\n            if <mouse down?> then\n                broadcast (スタート v)\n                wait until <not <mouse down?>>\n                hide\n                stop [other scripts in sprite v]\n                stop [this script v]\n            end\n        end\n    end\nend\n\n@武器選択ボタン\n\nwhen flag clicked\nhide\n\nwhen I receive [ホーム v]\ngo to x: (0) y: (-109)\nshow\nforever\n    if <(武器選択) = [yes]> then\n        hide\n        stop [other scripts in sprite v]\n        stop [this script v]\n    else\n        set size to (90) %\n        if <touching (mouse-pointer v)?> then\n            set size to (100) %\n            if <mouse down?> then\n                wait until <not <mouse down?>>\n                broadcast (武器選択 v)\n                set [武器選択 v] to [yes]\n                hide\n                stop [other scripts in sprite v]\n                stop [this script v]\n            end\n        end\n    end\nend\n\nwhen I receive [スタート v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\n@武器選択\n\nwhen flag clicked\nswitch costume to (木の剣 v)\nhide\n\nwhen I receive [武器選択 v]\nswitch costume to (木の剣 v)\ngo to x: (0) y: (104)\nset size to (109) %\nshow\n\nwhen I receive [ホーム v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\nwhen I receive [next v]\nif <(武器選択) = [yes]> then\n    next costume\nend\n\nwhen I receive [スタート v]\nforever\n    if <(costume [name v]) = [木の剣]> then\n        set [武器 v] to [木の剣]\n    else\n        if <(costume [name v]) = [鉄の剣]> then\n            set [武器 v] to [鉄の剣]\n        else\n            if <(costume [name v]) = [金の剣]> then\n                set [武器 v] to [金の剣]\n            else\n                if <(costume [name v]) = [ダイヤモンドの剣]> then\n                    set [武器 v] to [ダイヤモンドの剣]\n                else\n                    if <(costume [name v]) = [弓]> then\n                        set [武器 v] to [弓]\n                    end\n                end\n            end\n        end\n    end\nend\n\n@next\n\nwhen flag clicked\nhide\n\nwhen I receive [ホーム v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\nwhen I receive [武器選択 v]\ngo to x: (166) y: (24)\nshow\nforever\n    if <(武器選択) = [yes]> then\n        set size to (100) %\n        if <touching (mouse-pointer v)?> then\n            set size to (110) %\n            if <mouse down?> then\n                broadcast (next v)\n                wait until <not <mouse down?>>\n            end\n        end\n    else\n        hide\n        stop [other scripts in sprite v]\n        stop [this script v]\n    end\nend\n\n@OKボタン\n\nwhen flag clicked\nhide\n\nwhen I receive [武器選択 v]\ngo to x: (0) y: (-123)\nshow\nforever\n    if <(武器選択) = [yes]> then\n        set size to (90) %\n        if <touching (mouse-pointer v)?> then\n            set size to (100) %\n            if <mouse down?> then\n                if <([costume name v] of [武器選択 v]) = [木の剣]> then\n                    if <(coin) > [-1]> then\n                        wait until <not <mouse down?>>\n                        broadcast (ホーム v)\n                        set [武器選択 v] to [no]\n                        hide\n                        stop [other scripts in sprite v]\n                        stop [this script v]\n                    else\n                        say [買えません] for (2) seconds\n                    end\n                end\n                if <([costume name v] of [武器選択 v]) = [鉄の剣]> then\n                    if <(coin) > [9]> then\n                        change [coin v] by (-10)\n                        wait until <not <mouse down?>>\n                        broadcast (ホーム v)\n                        set [武器選択 v] to [no]\n                        hide\n                        stop [other scripts in sprite v]\n                        stop [this script v]\n                    else\n                        say [買えません] for (2) seconds\n                    end\n                end\n                if <([costume name v] of [武器選択 v]) = [金の剣]> then\n                    if <(coin) > [49]> then\n                        change [coin v] by (-50)\n                        wait until <not <mouse down?>>\n                        broadcast (ホーム v)\n                        set [武器選択 v] to [no]\n                        hide\n                        stop [other scripts in sprite v]\n                        stop [this script v]\n                    else\n                        say [買えません] for (2) seconds\n                    end\n                end\n                if <([costume name v] of [武器選択 v]) = [ダイヤモンドの剣]> then\n                    if <(coin) > [99]> then\n                        change [coin v] by (-100)\n                        wait until <not <mouse down?>>\n                        broadcast (ホーム v)\n                        set [武器選択 v] to [no]\n                        hide\n                        stop [other scripts in sprite v]\n                        stop [this script v]\n                    else\n                        say [買えません] for (2) seconds\n                    end\n                end\n                if <([costume name v] of [武器選択 v]) = [弓]> then\n                    if <(coin) > [69]> then\n                        change [coin v] by (-70)\n                        wait until <not <mouse down?>>\n                        broadcast (ホーム v)\n                        set [武器選択 v] to [no]\n                        hide\n                        stop [other scripts in sprite v]\n                        stop [this script v]\n                    else\n                        say [買えません] for (2) seconds\n                    end\n                end\n            end\n        end\n    else\n        hide\n        stop [other scripts in sprite v]\n        stop [this script v]\n    end\nend\n\nwhen I receive [スタート v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\n@判定\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [you lose v]\nswitch costume to (gameover v)\nshow\n\nwhen I receive [you win v]\nswitch costume to (you win v)\nshow\n\nwhen I receive [ホーム v]\nhide\n\n@リトライ\n\nwhen flag clicked\nhide\n\nwhen I receive [you lose v]\ngo to x: (0) y: (-109)\ngo to [front v] layer\nshow\nforever\n    if <(武器選択) = [yes]> then\n        hide\n        stop [other scripts in sprite v]\n        stop [this script v]\n    else\n        set size to (90) %\n        if <touching (mouse-pointer v)?> then\n            set size to (100) %\n            if <mouse down?> then\n                wait until <not <mouse down?>>\n                broadcast (ホーム v)\n                hide\n                stop [other scripts in sprite v]\n                stop [this script v]\n            end\n        end\n    end\nend\n\nwhen I receive [スタート v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\nwhen I receive [ホーム v]\nhide\n\nwhen I receive [you win v]\nwait (3) seconds\nbroadcast (ホーム v)\nstop [other scripts in sprite v]\nstop [this script v]\n\n@矢\n\nwhen flag clicked\nset [弓矢　ok v] to [ok]\nhide\n\nwhen I receive [弓矢発射 v]\ncreate clone of (_myself_ v)\nset [弓矢　ok v] to [no]\n\nwhen I start as a clone\ngo to (プレイヤー v)\npoint towards (敵 v)\nshow\nrepeat until <<<touching (敵 v)?> or <touching (_edge_ v)?>> or <touching (地面 v)?>>\n    move (10) steps\nend\nset [弓矢　ok v] to [ok]\ndelete this clone\n\n@敵　矢\n\nwhen flag clicked\nset [敵弓矢　ok v] to [ok]\nhide\n\nwhen I receive [敵弓矢発射 v]\ncreate clone of (_myself_ v)\nset [敵弓矢　ok v] to [no]\n\nwhen I start as a clone\ngo to (敵 v)\npoint towards (プレイヤー v)\nshow\nrepeat until <<<touching (プレイヤー v)?> or <touching (_edge_ v)?>> or <touching (地面 v)?>>\n    move (10) steps\nend\nset [敵弓矢　ok v] to [ok]\nset [ok v] to [1]\ndelete this clone\n\n@スプライト1\n\nwhen flag clicked\nforever\n    go to x: (0) y: (0)\n    set [ghost v] effect to (100)\n    show\nend\n\n