2P Battle! || - a Scrolling platformer

Instructions: || English\n\n| 1P(RED)\nJump with the w key\nMove with the a and d keys\n(It can also be operated with a mouse)\n| 2P(BLUE)\nJump with the up key\nMove with the left and right keys\n\n|| 日本語\n\n| 1P（赤）\nwキーでジャンプ\naキーとdキーで移動\n（マウスでも操作できます）\n| 2P（青）\n上キーでジャンプ\n左右のキーで移動

@Stage\n\nwhen flag clicked\nswitch backdrop to (背景 v)\nbroadcast (Intro End v)\n\n@Stage\n\nwhen flag clicked\nset [sx v] to [0]\nhide\n準備\nswitch costume to (none v)\n\ndefine ステージ配置 (x座標) (y座標) (ステージ番号)\nswitch costume to (none v)\nset [my_x v] to (x座標)\nset [my_y v] to (y座標)\nswitch costume to ((ステージ番号) + (1))\nset [my_n v] to ((ステージ番号) + (1))\ncreate clone of (_myself_ v)\nchange [sx v] by (1)\n\ndefine 移動 (x) (y)\nswitch costume to (none v)\ngo to x: (x) y: (y)\nif <<([abs v] of (x) ) > ([abs v] of (x position) )> or <([abs v] of (y) ) > ([abs v] of (y position) )>> then\n    hide\nelse\n    show\nend\nswitch costume to (My_n)\n\nwhen I receive [プログラム2 v]\nif <(costume [number v]) = [1]> then\n    broadcast (プログラム v)\n    hide\nelse\n    移動 [] ((My_y) - (Cy))\nend\n\nwhen I start as a clone\nhide\n\ndefine 準備\nrepeat (7)\n    ステージ配置 [0] ((sx) * (360)) ((sx) + (1))\nend\n\nwhen I receive [intro end v]\nshow\nbroadcast (プログラム v)\n\nwhen I receive [free intro #5 v]\nhide\ndelete this clone\n\n@Goal\n\nwhen flag clicked\nset [sx v] to [0]\nhide\n準備\nswitch costume to (none v)\n\ndefine ステージ配置 (x座標) (y座標) (ステージ番号)\nswitch costume to (none v)\nset [my_x v] to (x座標)\nset [my_y v] to (y座標)\nswitch costume to ((ステージ番号) + (1))\nset [my_n v] to ((ステージ番号) + (1))\ncreate clone of (_myself_ v)\nchange [sx v] by (1)\n\ndefine 移動 (x) (y)\nswitch costume to (none v)\ngo to x: (0) y: (y)\nif <<([abs v] of (x) ) > ([abs v] of (x position) )> or <([abs v] of (y) ) > ([abs v] of (y position) )>> then\n    hide\nelse\n    show\nend\nswitch costume to (My_n)\n\nwhen I receive [プログラム2 v]\nif <(costume [number v]) = [1]> then\n    hide\nelse\n    移動 [0] ((My_y) - (Cy))\n    if <touching (player v)?> then\n        broadcast (red v)\n    end\nend\n\nwhen I start as a clone\nhide\n\ndefine 準備\nrepeat (10)\n    ステージ配置 [0] ((sx) * (360)) ((sx) + (1))\nend\n\nwhen I receive [intro end v]\nshow\n\nwhen I receive [free intro #5 v]\nhide\ndelete this clone\n\n@Player\n\nwhen flag clicked\ngo to [front v] layer\ngo to x: (-120) y: (-20)\nset [x_ v] to [0]\nset [y_ v] to [0]\nset [cx v] to [-120]\nset [cy v] to [-20]\nset [x v] to [-120]\nset [y v] to [-20]\nset [m? v] to [n]\npoint in direction (90)\nset size to (55) %\nhide\n\ndefine 動作\nswitch costume to (1 v)\nif <(M?) = [y]> then\n    change [y_ v] by (-1)\n    if <<key (d v) pressed?> or <<(mouse x) > [0]> and <mouse down?>>> then\n        change [x_ v] by (1)\n    end\n    if <<key (a v) pressed?> or <<[0] > (mouse x)> and <mouse down?>>> then\n        change [x_ v] by (-1)\n    end\n    set [x_ v] to ((x_) * (0.88))\n    change x by (x_)\n    repeat (6)\n        if <touching (stage v)?> then\n            change y by (1)\n        end\n    end\n    if <touching (stage v)?> then\n        change y by (-6)\n        位置補正x (() - ((x_) / ([abs v] of (x_) ))) ([ceiling v] of ([abs v] of (x_) ) )\n        if <<key (w v) pressed?> or <<(mouse y) > [0]> and <mouse down?>>> then\n            set [y_ v] to [12]\n            set [x_ v] to ((7) - (<(x_) > [0]> * (14)))\n        else\n            set [x_ v] to [0]\n        end\n    end\n    change y by (y_)\n    if <touching (stage v)?> then\n        位置補正y (() - ((y_) / ([abs v] of (y_) ))) ([ceiling v] of ([abs v] of (y_) ) )\n    end\n    change y by (-1.1)\n    if <<touching (stage v)?> and <<key (w v) pressed?> or <<(mouse y) > [0]> and <mouse down?>>>> then\n        set [y_ v] to [15]\n    end\n    change y by (1.1)\n    if  then\n        初期位置\n    end\nend\n処理\nif <not <(M?) = [e]>> then\n    broadcast (プログラム2 v)\nend\n\nwhen I receive [プログラム v]\n動作\n\ndefine 処理\nchange [x v] by ((x position) - ((X) - (Cx)))\nchange [y v] by ((y position) - (((Y) - (Cy)) - (20)))\nchange [cy v] by ([floor v] of (((Y) - (Cy)) * (0.2)) )\nset x to ((X) - (Cx))\nset y to (((Y) - (Cy)) - (20))\nif <[0] < (x position)> then\n    set x to (0)\n    set [x_ v] to [0]\nend\nif <(Y22) < (Y)> then\n    switch costume to (2 v)\nend\n\nchange [cx v] by ([floor v] of (((X) - (Cx)) * (0.1)) )\n\ndefine 位置補正x (向き) (回数)\nif <(x_) = [0]> then\n    stop [this script v]\nend\nset [i v] to [0]\nrepeat until <<not <touching (stage v)?>> or <(i) = ((回数) + (1))>>\n    change [i v] by (1)\n    change x by (向き)\nend\nchange x by (() - ((向き) * (((回数) + (1)) * <<(i) = ((回数) + (1))> and <touching (stage v)?>>)))\n\ndefine 位置補正y (向き) (回数)\nif <(y_) = [0]> then\n    stop [this script v]\nend\nset [i v] to [0]\nrepeat until <<not <touching (stage v)?>> or <(i) = ((回数) + (1))>>\n    change [i v] by (1)\n    change y by (向き)\nend\nchange y by (() - ((向き) * (((回数) + (1)) * <<(i) = ((回数) + (1))> and <touching (stage v)?>>)))\nset [y_ v] to [0]\n\ndefine 初期位置\ngo to x: (-120) y: (-20)\nset [x_ v] to [0]\nset [y_ v] to [0]\nset [cx v] to [-120]\nset [cy v] to [-20]\nset [x v] to [-120]\nset [y v] to [-20]\n\nwhen I receive [intro end v]\nshow\n\nwhen I receive [free intro #5 v]\nhide\n\n@Eye\n\nwhen I receive [プログラム2 v]\nchange [ex v] by (((x_) - (eX)) / (5))\nchange [ey v] by (((y_) - (eY)) / (5))\ngo to x: (((X) - (Cx)) + ((eX) * (.5))) y: ((((Y) - (Cy)) - (20)) + ((eY) * (.3)))\n\nwhen flag clicked\nhide\nrepeat (10)\n    wait (0) seconds\n    go to [front v] layer\nend\n\nwhen I receive [intro end v]\nshow\n\nwhen I receive [free intro #5 v]\nhide\n\n@3-2-1\n\ndefine (#)\nhide\ngo to x: (0) y: (-50)\npoint in direction (-90)\nset [ghost v] effect to (100)\nswitch costume to (#)\ngo to [front v] layer\nset size to (1) %\nshow\nrepeat (22)\n    change y by ((() - (y position)) / (5))\n    turn right (((90) - (direction)) / (5)) degrees\n    change [ghost v] effect by (-10)\n    change size by (((100) - (size)) / (3))\nend\nif <(costume [number v]) = [4]> then\n    set [m? v] to [y]\n    set [m?? v] to [y]\n    repeat (11)\n        change x by (((240) - (x position)) / (5))\n        change y by (((180) - (y position)) / (5))\n        turn right (((180) - (direction)) / (5)) degrees\n        change [ghost v] effect by (10)\n        change size by (((50) - (size)) / (3))\n    end\nelse\n    repeat (11)\n        change y by (((-50) - (y position)) / (5))\n        turn right (((-90) - (direction)) / (5)) degrees\n        change [ghost v] effect by (10)\n        change size by ((() - (size)) / (3))\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [intro end v]\n[3]\n[2]\n[1]\n[go]\nhide\n\n@Stage2\n\nwhen flag clicked\nset [sx v] to [0]\nhide\n準備\nswitch costume to (none v)\n\ndefine ステージ配置 (x座標) (y座標) (ステージ番号)\nswitch costume to (none v)\nset [my_x v] to (x座標)\nset [my_y v] to (y座標)\nswitch costume to ((ステージ番号) + (1))\nset [my_n v] to ((ステージ番号) + (1))\ncreate clone of (_myself_ v)\nchange [sx v] by (1)\n\ndefine 移動 (x) (y)\nswitch costume to (none v)\ngo to x: (x) y: (y)\nif <<([abs v] of (x) ) > ([abs v] of (x position) )> or <([abs v] of (y) ) > ([abs v] of (y position) )>> then\n    hide\nelse\n    show\nend\nswitch costume to (My_n)\n\nwhen I receive [プログラム2 v]\nif <(costume [number v]) = [1]> then\n    hide\nelse\n    移動 [0] ((My_y) - (Cy2))\nend\n\nwhen I start as a clone\nhide\n\ndefine 準備\nrepeat (7)\n    ステージ配置 [0] ((sx) * (360)) ((sx) + (1))\nend\n\nwhen I receive [intro end v]\nshow\n\nwhen I receive [free intro #5 v]\nhide\ndelete this clone\n\n@Player2\n\nwhen flag clicked\ngo to [front v] layer\ngo to x: (120) y: (-20)\nset [x_2 v] to [0]\nset [y_2 v] to [0]\nset [cx2 v] to [120]\nset [cy2 v] to [-20]\nset [x22 v] to [120]\nset [y22 v] to [-20]\nset [m?? v] to [n]\npoint in direction (90)\nset size to (55) %\nhide\n\ndefine 動作\nswitch costume to (1 v)\nif <(M??) = [y]> then\n    change [y_2 v] by (-1)\n    if <key (right arrow v) pressed?> then\n        change [x_2 v] by (1)\n    end\n    if <key (left arrow v) pressed?> then\n        change [x_2 v] by (-1)\n    end\n    set [x_2 v] to ((x_2) * (0.88))\n    change x by (x_2)\n    repeat (6)\n        if <touching (stage2 v)?> then\n            change y by (1)\n        end\n    end\n    if <touching (stage2 v)?> then\n        change y by (-6)\n        位置補正x (() - ((x_2) / ([abs v] of (x_2) ))) ([ceiling v] of ([abs v] of (x_2) ) )\n        if <key (up arrow v) pressed?> then\n            set [y_2 v] to [12]\n            set [x_2 v] to ((7) - (<(x_2) > [0]> * (14)))\n        else\n            set [x_2 v] to [0]\n        end\n    end\n    change y by (y_2)\n    if <touching (stage2 v)?> then\n        位置補正y (() - ((y_2) / ([abs v] of (y_2) ))) ([ceiling v] of ([abs v] of (y_2) ) )\n    end\n    change y by (-1.1)\n    if <<touching (stage2 v)?> and <key (up arrow v) pressed?>> then\n        set [y_2 v] to [15]\n    end\n    change y by (1.1)\n    if <<(Y22) < [-400]> or > then\n        初期位置\n    end\nend\n処理\n\nwhen I receive [プログラム v]\n動作\n\ndefine 処理\nchange [x22 v] by ((x position) - ((X22) - (Cx2)))\nchange [y22 v] by ((y position) - (((Y22) - (Cy2)) - (20)))\nchange [cy2 v] by ([floor v] of (((Y22) - (Cy2)) * (0.2)) )\nset x to ((X22) - (Cx2))\nset y to (((Y22) - (Cy2)) - (20))\nif <(x position) < [0]> then\n    set x to (0)\n    set [x_2 v] to [0]\nend\nif <(Y) < (Y22)> then\n    switch costume to (2 v)\nend\n\nchange [cx v] by ([floor v] of (((X) - (Cx)) * (0.1)) )\n\ndefine 位置補正x (向き) (回数)\nif <(x_2) = [0]> then\n    stop [this script v]\nend\nset [ii v] to [0]\nrepeat until <<not <touching (stage2 v)?>> or <(ii) = ((回数) + (1))>>\n    change [ii v] by (1)\n    change x by (向き)\nend\nchange x by (() - ((向き) * (((回数) + (1)) * <<(ii) = ((回数) + (1))> and <touching (stage2 v)?>>)))\n\ndefine 位置補正y (向き) (回数)\nif <(y_2) = [0]> then\n    stop [this script v]\nend\nset [ii v] to [0]\nrepeat until <<not <touching (stage2 v)?>> or <(ii) = ((回数) + (1))>>\n    change [ii v] by (1)\n    change y by (向き)\nend\nchange y by (() - ((向き) * (((回数) + (1)) * <<(ii) = ((回数) + (1))> and <touching (stage2 v)?>>)))\nset [y_2 v] to [0]\n\ndefine 初期位置\ngo to x: (-120) y: (-20)\nset [x_2 v] to [0]\nset [y_2 v] to [0]\nset [cx2 v] to [-120]\nset [cy2 v] to [-20]\nset [x22 v] to [-120]\nset [y22 v] to [-20]\n\nwhen I receive [intro end v]\nshow\n\nwhen I receive [free intro #5 v]\nhide\n\n@Eye2\n\nwhen I receive [プログラム2 v]\nchange [ex2 v] by (((x_2) - (eX2)) / (5))\nchange [ey2 v] by (((y_2) - (eY2)) / (5))\ngo to x: (((X22) - (Cx2)) + ((eX2) * (.5))) y: ((((Y22) - (Cy2)) - (20)) + ((eY2) * (.3)))\n\nwhen flag clicked\nhide\nrepeat (10)\n    wait (0) seconds\n    go to [front v] layer\nend\n\nwhen I receive [intro end v]\nshow\n\nwhen I receive [free intro #5 v]\nhide\n\n@Goal2\n\nwhen flag clicked\nset [sx v] to [0]\nhide\n準備\nswitch costume to (none v)\n\ndefine ステージ配置 (x座標) (y座標) (ステージ番号)\nswitch costume to (none v)\nset [my_x v] to (x座標)\nset [my_y v] to (y座標)\nswitch costume to ((ステージ番号) + (1))\nset [my_n v] to ((ステージ番号) + (1))\ncreate clone of (_myself_ v)\nchange [sx v] by (1)\n\ndefine 移動 (x) (y)\nswitch costume to (none v)\ngo to x: (0) y: (y)\nif <<([abs v] of (x) ) > ([abs v] of (x position) )> or <([abs v] of (y) ) > ([abs v] of (y position) )>> then\n    hide\nelse\n    show\nend\nswitch costume to (My_n)\n\nwhen I receive [プログラム2 v]\nif <(costume [number v]) = [1]> then\n    hide\nelse\n    移動 [0] ((My_y) - (Cy2))\n    if <touching (player2 v)?> then\n        broadcast (blue v)\n    end\nend\n\nwhen I start as a clone\nhide\n\ndefine 準備\nrepeat (10)\n    ステージ配置 [0] ((sx) * (360)) ((sx) + (1))\nend\n\nwhen I receive [intro end v]\nshow\n\nwhen I receive [free intro #5 v]\nhide\ndelete this clone\n\n@m\n\ndefine 文字を書く (明るさ) (色) 文字を始める地点 (x) (y) 間隔とか (文字) (間隔) 大きさ (大きさ) 特殊 (特殊)\nset [brightness v] effect to (明るさ)\nset [color v] effect to ((色) * (2))\nif <(大きさ) = []> then\n    set size to (100) %\nelse\n    set size to (大きさ) %\nend\ngo to x: (x) y: (y)\nif <(特殊) = [time]> then\n    switch costume to (time v)\n    create clone of (_myself_ v)\nelse\n    if <(特殊) = [score]> then\n        switch costume to (score v)\n        create clone of (_myself_ v)\n    end\nend\nset [番目 v] to [0]\nrepeat (length of (文字))\n    change [番目 v] by (1)\n    switch costume to (letter (番目) of (文字))\n    create clone of (_myself_ v)\n    if <(間隔) = []> then\n        change x by ((size) * (0.3))\n    else\n        change x by (間隔)\n    end\nend\n\nwhen I receive [文字一旦消える v]\ndelete this clone\n\nwhen I start as a clone\nshow\n\nforever\n    文字を書く [] [] 文字を始める地点 [] [] 間隔とか [] [] 大きさ [] 特殊 []\n    wait (.1) seconds\nend\n\n文字を書く [明るさ] [色] 文字を始める地点 [X座標] [Y座標] 間隔とか [表示する数字] [文字の間隔] 大きさ [大きさ] 特殊 []\n\nwhen I receive [intro end v]\nforever\n    broadcast (文字一旦消える v)\n    文字を書く [10] [0] 文字を始める地点 [-230] [166] 間隔とか ((round ((Y) / (10))) + (2)) [15] 大きさ [50] 特殊 []\n    文字を書く [-20] [60] 文字を始める地点 [10] [166] 間隔とか ((round ((Y22) / (10))) + (2)) [15] 大きさ [50] 特殊 []\nend\n\nwhen I receive [free intro #5 v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\n@win\n\nwhen I receive [red v]\nswitch costume to (１ v)\ni>\n\nwhen I receive [blue v]\nswitch costume to (２ v)\ni>\n\ndefine i>\nset [ghost v] effect to (100)\nset [m? v] to [e]\nset [m?? v] to [n]\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\n    go to [front v] layer\nend\nwait (1) seconds\nbroadcast (Free Intro #5 v)\nrepeat (10)\n    change [brightness v] effect by (10)\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen flag clicked\nhide\n\n@s\n\nwhen flag clicked\nset [ghost v] effect to (100)\nshow\nforever\n    go to [front v] layer\nend\n\n