Cube - Platformer

Instructions: RU:\nДобро пожаловать в новый платформер "Cube" где вы играете за куба который проходит испытания.\nВаша задача пройти все уровни.\n\nОткройте проект в TurboWarp если у вас лагает \n( https://turbowarp.org/635892045 )\n\nУправление:\nСтрелки\n\nEN:\nWelcome to the new platformer "Cube" where you play as a cube that is being tested.\nYour task is to complete all levels.\n\nOpen the project in TurboWarp if you have a lag \n( https://turbowarp.org/635892045 )\n\nControl:\nArrows

@Stage\n\nwhen flag clicked\nset [millisecond v] to [00]\nset [second v] to [00]\nset [minute v] to [0]\nwait until <<key (right arrow v) pressed?> or <key (left arrow v) pressed?>>\nrepeat until <(level) = [8]>\n    wait () seconds\n    change [millisecond v] by (1)\nend\n\nwhen flag clicked\nforever\n    if <(millisecond) = [10]> then\n        set [millisecond v] to [0]\n        change [second v] by (1)\n    end\n    if <(second) = [60]> then\n        set [second v] to [0]\n        change [minute v] by (1)\n    end\nend\n\nwhen flag clicked\nforever\n    set [time v] to (join (minute) (join [.] (join (second) (join [.] (millisecond)))))\nend\n\nwhen flag clicked\nforever\n    play sound [music v] until done\nend\n\n@player\n\nwhen flag clicked\ngo to x: (-152) y: (-66)\nset [# x v] to [0]\nset [# jump? v] to [0]\nset [# force of gravity v] to [0]\nforever\n    if <key (up arrow v) pressed?> then\n        jump\n    end\nend\n\ndefine jump\nset [# jump? v] to [1]\nrepeat (10)\n    change [# force of gravity v] by (1)\nend\nset [# jump? v] to [0]\nwait until <touching (levels v)?>\n\nwhen flag clicked\nforever\n    change y by (# force of gravity)\nend\n\ndefine check ground touch\nif <(# jump?) = [0]> then\n    if <<<touching (levels v)?> or <touching (let2 v)?>> or <touching (platform v)?>> then\n        set [# force of gravity v] to [3]\n    else\n        change [# force of gravity v] by (-1)\n    end\nend\n\nwhen flag clicked\nforever\n    check ground touch\nend\n\ndefine left\npoint in direction (-90)\nif <[-7] < (# x)> then\n    repeat (7)\n        change [# x v] by (-1)\n    end\nend\n\ndefine right\npoint in direction (90)\nif <[7] > (# x)> then\n    repeat (7)\n        change [# x v] by (1)\n    end\nend\n\nwhen flag clicked\nforever\n    change x by (# x)\nend\n\nwhen flag clicked\nforever\n    if <key (left arrow v) pressed?> then\n        left\n    else\n        repeat until <(# x) = [0]>\n            if <not <key (right arrow v) pressed?>> then\n                if <(# x) < [0]> then\n                    change [# x v] by (1)\n                end\n                if <(# x) > [0]> then\n                    change [# x v] by (-1)\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <<(y position) = [-345]> or <touching (let hitbox v)?>> then\n        broadcast (restart v)\n    end\nend\n\nwhen I receive [restart v]\nset [# x v] to [0]\nset [# jump? v] to [0]\nset [# force of gravity v] to [0]\nif <(level) = [3]> then\n    go to x: (-213) y: (-86)\nelse\n    if <(level) = [8]> then\n        go to x: (-128) y: (-94)\n    else\n        go to x: (-152) y: (-66)\n    end\nend\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\nwhen flag clicked\nforever\n    if <(x position) > [257]> then\n        set [# x v] to [0]\n        set [# jump? v] to [0]\n        set [# force of gravity v] to [0]\n        if <(level) = [3]> then\n            go to x: (-213) y: (-86)\n        else\n            if <(level) = [8]> then\n                go to x: (-128) y: (-94)\n            else\n                go to x: (-152) y: (-66)\n            end\n        end\n        broadcast (next level v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(wall on the left) = [1]> then\n        set [# x v] to [1]\n    end\n    if <(wall on the right) = [1]> then\n        set [# x v] to [-1]\n    end\nend\n\n\n\nwhen flag clicked\nforever\n    if <key (right arrow v) pressed?> then\n        right\n    else\n        if <not <key (left arrow v) pressed?>> then\n            repeat until <(# x) = [0]>\n                if <(# x) < [0]> then\n                    change [# x v] by (1)\n                end\n                if <(# x) > [0]> then\n                    change [# x v] by (-1)\n                end\n            end\n        end\n    end\nend\n\n@levels\n\nwhen flag clicked\nswitch costume to (level 1 v)\n\nwhen I receive [next level v]\nnext costume\n\nwhen flag clicked\nforever\n    set [level v] to (costume [number v])\nend\n\n@hitbox left\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    go to (player v)\n    if <<<touching (levels v)?> or <touching (let v)?>> or <touching (let2 v)?>> then\n        set [wall on the left v] to [1]\n    else\n        set [wall on the left v] to [0]\n    end\nend\n\n@hitbox right\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    go to (player v)\n    if <<<touching (levels v)?> or <touching (let v)?>> or <touching (let2 v)?>> then\n        set [wall on the right v] to [1]\n    else\n        set [wall on the right v] to [0]\n    end\nend\n\n@lava\n\nwhen flag clicked\nset [# y v] to [0]\ngo to x: (0) y: (0)\nforever\n    repeat (10)\n        change [# y v] by (0.1)\n        change y by (# y)\n    end\n    repeat (10)\n        change [# y v] by (-0.1)\n        change y by (# y)\n    end\n    wait (1) seconds\n    repeat (10)\n        change [# y v] by (-0.1)\n        change y by (# y)\n    end\n    repeat (10)\n        change [# y v] by (0.1)\n        change y by (# y)\n    end\nend\n\nwhen flag clicked\nforever\n    switch costume to (level)\nend\n\n@let\n\nwhen flag clicked\ngo to x: (76) y: (156)\ngo to [back v] layer\nforever\n    glide (1) secs to x: (76) y: (10)\n    wait (3) seconds\n    glide (1) secs to x: (76) y: (156)\n    wait (1) seconds\nend\n\nwhen flag clicked\nforever\n    if <(level) = [4]> then\n        show\n    else\n        hide\n    end\nend\n\n@let hitbox\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    go to (let v)\nend\n\nwhen flag clicked\nforever\n    if <(level) = [4]> then\n        show\n    else\n        hide\n    end\nend\n\n@let2\n\nwhen flag clicked\ngo to x: (0) y: (20)\nforever\n    glide (1) secs to x: (0) y: (-105)\n    wait (1) seconds\n    glide (1) secs to x: (0) y: (20)\n    wait (1) seconds\nend\n\nwhen flag clicked\nforever\n    if <(level) = [5]> then\n        show\n    else\n        hide\n    end\nend\n\n@platform\n\nwhen flag clicked\ngo to x: (-120) y: (0)\nforever\n    change x by (4)\n    if <(x position) > [350]> then\n        go to x: (-120) y: (0)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(level) = [7]> then\n        show\n    else\n        hide\n    end\nend\n\n@cube platformer\n\nwhen flag clicked\nhide\n\n