【#19】スクロールPlatformerチュートリアル

Instructions: プレイしながら特徴をつかんでください!\n(すべてのスプライトをバックパックするだけでサンプルを使用できます)\n\n中を見てコメントの説明をよく見て自分で作ってみてください!

@Stage\n\nwhen flag clicked\nset [color v] effect to (pick random (1) to (200))\n\n@プレイヤー\n\nwhen flag clicked\n初期化\nforever\n    物理\n    broadcast (レベル v) and wait\nend\n\ndefine 物理\nif <<key (d v) pressed?> or <<key (right arrow v) pressed?> or <<mouse down?> and <[0] < (mouse x)>>>> then\n    change [x v] by (1)\nend\nif <<key (a v) pressed?> or <<key (left arrow v) pressed?> or <<mouse down?> and <(mouse x) < [0]>>>> then\n    change [x v] by (-1)\nend\nset [x v] to ((x) * (.9))\nchange x by (x)\nif <touching (レベル v)?> then\n    change y by (1)\nend\nif <touching (レベル v)?> then\n    change x by ((x) * (-1))\n    change y by (-1)\n    if <<<mouse down?> and <[0] < (mouse y)>> or <<key (w v) pressed?> or <key (up arrow v) pressed?>>> 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 [y v] to [15]\n    else\n        set [x v] to [0]\n    end\nend\nchange y by (-1)\nif <touching (レベル v)?> then\n    if <<<mouse down?> and <[0] < (mouse y)>> or <<key (w v) pressed?> or <key (up arrow v) pressed?>>> then\n        start sound [ジャンプ v]\n        set [y v] to [15]\n    end\nend\nif <touching (バネ v)?> then\n    start sound [大ジャンプ v]\n    set [y v] to [15]\n    if <<<mouse down?> and <[0] < (mouse y)>> or <<key (w v) pressed?> or <key (up arrow v) pressed?>>> then\n        set [y v] to [20]\n    end\nend\nchange y by (1)\nchange [y v] by (-1)\nchange y by (y)\nif <touching (レベル v)?> then\n    change y by ((-1) * (y))\n    set [y v] to [0]\nend\nif <(ステージY) > [360]> then\n    初期化\nend\nif <touching (障害物 v)?> then\n    初期化\nend\nif <touching (ゴール v)?> then\n    broadcast (ゴール v)\nend\nset [ステージx v] to ((ステージX) - ([ceiling v] of (((x position) + (x)) / (9)) ))\nset [ステージy v] to ((ステージY) - ([ceiling v] of (((y position) + (y)) / (12)) ))\nset x to ((x position) - ([ceiling v] of (((x position) + (x)) / (9)) ))\nset y to ((y position) - ([ceiling v] of (((y position) + (y)) / (12)) ))\n\ndefine 初期化\ngo to x: (0) y: (-50)\nswitch costume to (コスチューム1 v)\nset [x v] to [0]\nset [y v] to [0]\nset [ステージx v] to [100]\nset [ステージy v] to [0]\n\nwhen I receive [ゴール v]\nstop [other scripts in sprite v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\n@レベル\n\nwhen I receive [レベル v]\nif <(costume [number v]) = [1]> then\n    stop [this script v]\nelse\n    レベル ((ステージX) + (x)) ((ステージY) + (y))\nend\n\ndefine レベル (x) (y)\nswitch costume to (削除しないで 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 (レベル数)\n\nwhen flag clicked\nクローン\n\ndefine クローン\nswitch costume to (削除しないで v)\nrepeat (8)\n    set [x v] to ((480) * ((costume [number v]) - (1)))\n    set [y v] to [0]\n    switch costume to ((costume [number v]) + (1))\n    set [レベル数 v] to (costume [number v])\n    create clone of (_myself_ v)\nend\n\n@障害物\n\nwhen I receive [レベル v]\nif <(costume [number v]) = [1]> then\n    stop [this script v]\nelse\n    レベル ((ステージX) + (x)) ((ステージY) + (y))\nend\n\ndefine レベル (x) (y)\nswitch costume to (削除しないで 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 (レベル数)\n\nwhen flag clicked\nクローン\n\ndefine クローン\nswitch costume to (削除しないで v)\nrepeat (8)\n    set [x v] to ((480) * ((costume [number v]) - (1)))\n    set [y v] to [0]\n    switch costume to ((costume [number v]) + (1))\n    set [レベル数 v] to (costume [number v])\n    create clone of (_myself_ v)\nend\n\n@バネ\n\nwhen I receive [レベル v]\nif <(costume [number v]) = [1]> then\n    stop [this script v]\nelse\n    レベル ((ステージX) + (x)) ((ステージY) + (y))\nend\n\ndefine レベル (x) (y)\nswitch costume to (削除しないで 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 (レベル数)\n\nwhen flag clicked\nクローン\n\ndefine クローン\nswitch costume to (削除しないで v)\nrepeat (8)\n    set [x v] to ((480) * ((costume [number v]) - (1)))\n    set [y v] to [0]\n    switch costume to ((costume [number v]) + (1))\n    set [レベル数 v] to (costume [number v])\n    create clone of (_myself_ v)\nend\n\n@飾り\n\nwhen I receive [レベル v]\nif <(costume [number v]) = [1]> then\n    stop [this script v]\nelse\n    レベル ((ステージX) + (x)) ((ステージY) + (y))\nend\n\ndefine レベル (x) (y)\nswitch costume to (削除しないで 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 (レベル数)\n\nwhen flag clicked\nクローン\n\ndefine クローン\nswitch costume to (削除しないで v)\nrepeat (8)\n    set [x v] to ((480) * ((costume [number v]) - (1)))\n    set [y v] to [0]\n    switch costume to ((costume [number v]) + (1))\n    set [レベル数 v] to (costume [number v])\n    create clone of (_myself_ v)\nend\n\n@ゴール\n\nwhen I receive [レベル v]\nif <(costume [number v]) = [1]> then\n    stop [this script v]\nelse\n    レベル ((ステージX) + (x)) ((ステージY) + (y))\nend\n\ndefine レベル (x) (y)\nswitch costume to (削除しないで 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 (レベル数)\n\nwhen flag clicked\nクローン\n\ndefine クローン\nswitch costume to (削除しないで v)\nrepeat (8)\n    set [x v] to ((480) * ((costume [number v]) - (1)))\n    set [y v] to [0]\n    switch costume to ((costume [number v]) + (1))\n    set [レベル数 v] to (costume [number v])\n    create clone of (_myself_ v)\nend\n\n