Minecraft platformer


@Stage\n\nwhen [m v] key pressed\nset [mouse v] to (join ((mouse x) + (SCROLL X)) (join [, ] ((mouse y) + (SCROLL Y))))\nshow variable [mouse v]\n\nwhen [h v] key pressed\nhide variable [mouse v]\n\nwhen flag clicked\n\n@Blank \n\nwhen flag clicked\nforever\n    go to [front v] layer\n    go to x: (0) y: (0)\nend\n\n@Cute gold block\n\nwhen flag clicked\nbroadcast (Green flag v) and wait\nbroadcast (Play game v) and wait\nbroadcast (Position tiles v)\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\n\nwhen I receive [play game v]\nset [level v] to [1]\nforever\n    broadcast (reset v) and wait\n    broadcast (setup v) and wait\n    Game on\n    repeat until <(EXIT) > []>\n        Tick\n        broadcast (Tick v)\n    end\n    if <(EXIT) = [Win]> then\n        Game - win\n    else\n        Game - fall\n    end\nend\n\ndefine Game on\nset [x v] to [0]\nset [y v] to [0]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset [sx v] to [0]\nset [sy v] to [0]\nset [in air v] to [0]\nset [exit v] to []\nset size to (100) %\nset [ghost v] effect to (0)\nshow\n\ndefine Tick\nif <key (left arrow v) pressed?> then\n    change [sx v] by (-2)\nend\nif <key (right arrow v) pressed?> then\n    change [sx v] by (2)\nend\nset [sx v] to ((sx) * (0.8))\nif <([abs v] of (sx) ) > [0.9]> then\n    Change gold block x by (round (sx))\nend\nif <key (up arrow v) pressed?> then\n    if <(in air) < [4]> then\n        set [sy v] to [20]\n    end\nend\nif <(sy) > [-20]> then\n    change [sy v] by (-2)\nend\nChange gold block y by (sy)\nTest - fall\nset [scroll x v] to (x)\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\nend\nchange [scroll y v] by (round (((y) - (SCROLL Y)) / (10)))\nif <(SCROLL Y) < [0]> then\n    set [scroll y v] to [0]\nend\nPosition\nif <(y) < [-180]> then\n    set [exit v] to [Fall]\nend\n\ndefine Change gold block y by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nPosition\nrepeat until <not <touching (platform v)?>>\n    if <(sy) > [0]> then\n        change [y v] by (-1)\n    else\n        change [y v] by (1)\n        set [in air v] to [0]\n    end\n    Position\n    set [sy v] to [0]\nend\n\ndefine Position\ngo to x: ((x) - (SCROLL X)) y: ((y) - (SCROLL Y))\n\ndefine Change gold block x by (sx)\nchange [x v] by (sx)\nPosition\nif <touching (platform v)?> then\n    repeat (10)\n        change [y v] by (1)\n        Position\n        if <not <touching (platform v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-10)\n    if <key (up arrow v) pressed?> then\n        if <(sx) > [0]> then\n            set [sx v] to [-10]\n        else\n            set [sx v] to [10]\n        end\n        set [in air v] to [0]\n    else\n        set [sx v] to [0]\n    end\n    repeat until <not <touching (platform v)?>>\n        if <(sx) > [0]> then\n            change [x v] by (-1)\n        else\n            change [x v] by (1)\n        end\n        Position\n    end\nend\n\nwhen [s v] key pressed\nnext costume\n\ndefine Game - fall\nset [exit v] to []\nrepeat (5)\n    hide\n    wait (0.1) seconds\n    show\n    wait (0.1) seconds\nend\nhide\nwait (0.5) seconds\n\ndefine Test - fall\nif <touching (danger v)?> then\n    set [exit v] to [Fall]\nend\n\ndefine Game - win\nrepeat (50)\n    point towards (exit  v)\n    turn right (65) degrees\n    move ((distance to [exit  v]) / (2)) steps\n    change size by (-1)\n    change [ghost v] effect by (2)\nend\nhide\nchange [level v] by (1)\nwait (1) seconds\n\nwhen flag clicked\nforever\n    \n        \n            if <key (space v) pressed?> then\n                change size by (10)\n            end\n            if <(size) > [800]> then\n                set size to (100) %\n            end\n        end\n    end\nend\n\nforever\n\nwhen I receive [green flag v]\nif <touching (potion v)?> then\n    broadcast (Show  v)\n    \n        if <key (left arrow v) pressed?> then\n            change [sx v] by (-1)\n        end\n        if <key (right arrow v) pressed?> then\n            change [sx v] by (1)\n        end\n    end\n    broadcast (hide v)\nend\n\n@Exit \n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <<(costume [number v]) = [4]> and <touching (cute gold block v)?>> then\n    set [exit v] to [Win]\nend\n\nwhen I receive [setup v]\nhide\nset [collected v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (glowstone v)\n    Duplicate at x: [1444] y: [-41]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (glowstone v)\n        Duplicate at x: [734] y: [477]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (glowstone v)\n            Duplicate at x: [857] y: [850]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (glowstone v)\n                Duplicate at x: [1951] y: [474]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (glowstone v)\n                    Duplicate at x: [1414] y: [1006]\n                else\n                    if <(LEVEL) = [6]> then\n                        switch costume to (glowstone v)\n                        Duplicate at x: [702] y: [2772]\n                    else\n                        if <(LEVEL) = [7]> then\n                            switch costume to (glowstone v)\n                            Duplicate at x: [702] y: [2772]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Duplicate at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\n\nwhen I receive [open portal v]\nswitch costume to (glowstone2 v)\n\n@Glow stone dust \n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <touching (cute gold block v)?> then\n    change [collected v] by (1)\n    if <(Collected) = (Collected max)> then\n        broadcast (Open portal v)\n    end\n    delete this clone\nend\n\nwhen I receive [setup v]\nhide\nset [collected v] to [0]\nset [collected max v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (glowstone_dust v)\n    Duplicate at x: [50] y: [-20]\n    Duplicate at x: [130] y: [10]\n    Duplicate at x: [413] y: [14]\n    Duplicate at x: [810] y: [20]\n    Duplicate at x: [1190] y: [1]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (glowstone_dust v)\n        Duplicate at x: [-115] y: [-41]\n        Duplicate at x: [162] y: [53]\n        Duplicate at x: [-105] y: [114]\n        Duplicate at x: [-194] y: [241]\n        Duplicate at x: [612] y: [477]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (glowstone_dust v)\n            Duplicate at x: [2] y: [287]\n            Duplicate at x: [-41] y: [615]\n            Duplicate at x: [264] y: [713]\n            Duplicate at x: [-194] y: [241]\n            Duplicate at x: [697] y: [837]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (glowstone_dust v)\n                Duplicate at x: [1834] y: [445]\n                Duplicate at x: [1197] y: [315]\n                Duplicate at x: [699] y: [141]\n                Duplicate at x: [186] y: [-76]\n                Duplicate at x: [697] y: [140]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (glowstone_dust v)\n                    Duplicate at x: [1137] y: [1588]\n                    Duplicate at x: [1313] y: [972]\n                    Duplicate at x: [513] y: [300]\n                    Duplicate at x: [-192] y: [577]\n                    Duplicate at x: [622] y: [1665]\n                else\n                    if <(LEVEL) = [6]> then\n                        switch costume to (glowstone_dust v)\n                        Duplicate at x: [271] y: [690]\n                        Duplicate at x: [-29] y: [787]\n                        Duplicate at x: [692] y: [1388]\n                        Duplicate at x: [760] y: [1680]\n                        Duplicate at x: [798] y: [2755]\n                    end\n                end\n            end\n        end\n    end\nend\nset [x v] to [-999999]\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Duplicate at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\nchange [collected max v] by (1)\ncreate clone of (_myself_ v)\n\n@Danger\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\ngo to [back v] layer\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 v)\n    Duplicate at x: [380] y: [0]\n    Duplicate at x: [380] y: [0]\n    Duplicate at x: [380] y: [0]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (level 5 v)\n        Duplicate at x: [0] y: [350]\n        Duplicate at x: [450] y: [0]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 7 v)\n            Duplicate at x: [0] y: [350]\n            Duplicate at x: [100] y: [270]\n            Duplicate at x: [400] y: [200]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (level 11 v)\n                Duplicate at x: [520] y: [0]\n                Duplicate at x: [500] y: [200]\n                Duplicate at x: [640] y: [260]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (level 16 v)\n                    Duplicate at x: [525] y: [232]\n                    Duplicate at x: [-500] y: [150]\n                    Duplicate at x: [130] y: [280]\n                    Duplicate at x: [400] y: [200]\n                    Duplicate at x: [550] y: [80]\n                else\n                    if <(LEVEL) = [6]> then\n                        switch costume to (level 21 v)\n                        Duplicate at x: [250] y: [570]\n                        Duplicate at x: [250] y: [500]\n                        Duplicate at x: [400] y: [500]\n                        Duplicate at x: [500] y: [460]\n                        Duplicate at x: [-120] y: [430]\n                    else\n                        if <(LEVEL) = [7]> then\n                            switch costume to (costume1 v)\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Duplicate at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\ncreate clone of (_myself_ v)\nchange [x v] by (400)\nnext costume\ncreate clone of (_myself_ v)\nchange [x v] by (400)\nnext costume\n\n@Platform\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 1 v)\n    Duplicate at x: [380] y: [0]\n    Duplicate at x: [380] y: [0]\n    Duplicate at x: [380] y: [0]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (level 2 1 v)\n        Duplicate at x: [0] y: [350]\n        Duplicate at x: [450] y: [0]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3 1 v)\n            Duplicate at x: [0] y: [350]\n            Duplicate at x: [100] y: [270]\n            Duplicate at x: [400] y: [200]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (level 4 1 v)\n                Duplicate at x: [520] y: [0]\n                Duplicate at x: [500] y: [200]\n                Duplicate at x: [640] y: [260]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (level 5 1 v)\n                    Duplicate at x: [525] y: [232]\n                    Duplicate at x: [-500] y: [150]\n                    Duplicate at x: [130] y: [280]\n                    Duplicate at x: [400] y: [200]\n                    Duplicate at x: [550] y: [80]\n                else\n                    if <(LEVEL) = [6]> then\n                        switch costume to (level 6 1 v)\n                        Duplicate at x: [250] y: [570]\n                        Duplicate at x: [250] y: [500]\n                        Duplicate at x: [400] y: [500]\n                        Duplicate at x: [500] y: [460]\n                        Duplicate at x: [-120] y: [430]\n                    else\n                        if <(LEVEL) = [7]> then\n                            switch costume to (level 7 1 v)\n                            Duplicate at x: [770] y: [115]\n                            Duplicate at x: [770] y: [115]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Duplicate at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\n