platformer cat v5.1

Instructions: (<-) scroll x -3\n(->) scroll x 3\nit's game platformer\nPlatformer cat v5.1 3 levels\nspace x mouse+ Scrollx and y mouse+ Scrolly

@Stage\n\nwhen [space v] key pressed\nset [mols v] to (join ((mouse x) + (scrollx)) (join [.] ((mouse y) + (scrolly))))\nshow variable [mols v]\n\nwhen flag clicked\nhide variable [mols v]\n\nwhen I receive [play v]\nforever\n    play sound [Itty Bitty 8 Bit v] until done\nend\n\n@cat\n\nwhen flag clicked\nbroadcast (masaze v) and wait\nbroadcast (play v) and wait\n\nwhen I receive [сообщение1 v]\nhide\ngo to [front v] layer\n\nwhen I receive [play v]\nset [level v] to [1]\nforever\n    broadcast (rezer v) and wait\n    broadcast (stup v) and wait\n    game\n    repeat until <(exit) > []>\n        set [costume v] to [1]\n        tick\n        broadcast (tick v) and wait\n    end\n    if <(exit) = [vin]> then\n        exit\n    else\n        not exit\n    end\nend\n\ndefine game\nset [exit v] to []\nset [si v] to [0]\nset [х v] to [0]\nset [у v] to [0]\nset [sx v] to [0]\nset [scrollx v] to [0]\nset [scrolly v] to [0]\nset size to (30) %\nset [ghost v] effect to (0)\nshow\n\ndefine tick\nset [speed v] to ((speed) * (0.7))\nif <<<(mouse x) < (x position)> and <mouse down?>> or <key (left arrow v) pressed?>> then\n    point in direction (-90)\n    change [speed v] by (-3)\n    sand (speed)\nend\nif <<<(mouse x) > (x position)> and <mouse down?>> or <key (right arrow v) pressed?>> then\n    point in direction (90)\n    change [speed v] by (3)\n    sand (speed)\nend\nif <<<(mouse y) > (y position)> and <mouse down?>> or <key (up arrow v) pressed?>> then\n    if <(sx) < [4]> then\n        set [si v] to [16]\n    end\nend\nchange [si v] by (-2)\nclante (si)\ntest die\nset [scrollx v] to (х)\nif <(scrollx) < [0]> then\n    set [scrollx v] to [0]\nend\nchange [scrolly v] by (round (((у) - (scrolly)) / (10)))\nif <(scrolly) < [0]> then\n    set [scrolly v] to [0]\nend\nscrolling\nif <(у) < [-180]> then\n    set [exit v] to [die]\nend\nif <<touching (_ma v)?> and <(si) = [0]>> then\n    set [exit v] to [die]\nend\nif <<touching (_ma2 v)?> and <(si) = [0]>> then\n    set [exit v] to [die]\nend\n\ndefine clante (si)\nchange [у v] by (si)\nchange [sx v] by (1)\nscrolling\nrepeat until <not <touching (map v)?>>\n    if <(si) > [0]> then\n        change [у v] by (-1)\n    else\n        change [у v] by (1)\n        set [sx v] to [0]\n    end\n    scrolling\n    set [si v] to [0]\n    set [sx v] to [0]\nend\n\ndefine scrolling\ngo to x: ((х) - (scrollx)) y: ((у) - (scrolly))\n\ndefine sand (sx)\nchange [х v] by (sx)\nscrolling\nif <touching (map v)?> then\n    repeat (12)\n        change [у v] by (1)\n        scrolling\n        if <not <touching (map v)?>> then\n            stop [this script v]\n        end\n    end\n    change [у v] by (-8)\n    repeat until <not <touching (map v)?>>\n        if <(sx) > [0]> then\n            change [х v] by (-1)\n        else\n            change [х v] by (1)\n        end\n        scrolling\n    end\nend\n\ndefine not exit\nset [exit v] to []\nset [costume v] to []\nswitch costume to (die v)\nwait (0.1) seconds\nswitch costume to (ouch v)\nwait (0.1) seconds\nswitch costume to (ouch2 v)\nwait (0.1) seconds\nhide\nwait (0.5) seconds\n\ndefine test die\nif <touching (map 2 v)?> then\n    set [exit v] to [die]\nend\n\ndefine exit\nrepeat (50)\n    point towards (flag v)\n    turn right (65) degrees\n    move ((distance to [flag 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\nshow\n\nwhen I receive [play v]\nforever\n    if <not <(costume) = []>> then\n        if <<<<(mouse x) < (x position)> and <mouse down?>> or <<(mouse x) > (x position)> and <mouse down?>>> or <<key (left arrow v) pressed?> or <key (right arrow v) pressed?>>> then\n            if <not <(si) > [0]>> then\n                if <not <[-1] > (si)>> then\n                    switch costume to (walk1 v)\n                    repeat (9)\n                        if <<<<(mouse x) < (x position)> and <mouse down?>> or <<(mouse x) > (x position)> and <mouse down?>>> or <<key (left arrow v) pressed?> or <key (right arrow v) pressed?>>> then\n                            next costume\n                            wait (0.1) seconds\n                        end\n                    end\n                    switch costume to (walk1 v)\n                end\n            end\n        else\n            if <(si) > [0]> then\n                switch costume to (jump_1 v)\n            else\n                if <[-1] > (si)> then\n                    switch costume to (fall_1 v)\n                else\n                    switch costume to (stand_1 v)\n                end\n            end\n        end\n    end\nend\n\nrepeat (5)\n\nbroadcast (сообщение1 v)\n\nswitch costume to ([sqrt v] of (х) )\n\n@map\n\nwhen I receive [masaze v]\nhide\n\nwhen I receive [tick v]\nscroll (((х) - (scrollx)) - (1)) ((у) - (scrolly))\n\nwhen I receive [stup v]\nhide\nset [id v] to [0]\nset [х v] to [0]\nset [у v] to [0]\nif <(level) = [1]> then\n    switch costume to (10 v)\n    х [360] у [0]\n    change [id v] by (1)\n    х [360] у [0]\n    change [id v] by (1)\n    х [360] у [0]\n    change [id v] by (1)\nelse\n    if <(level) = [2]> then\n        switch costume to (4 v)\n        х [0] у [400]\n        х [360] у [0]\n    else\n        if <(level) = [3]> then\n            switch costume to (9 v)\n            х [360] у [0]\n        else\n            switch costume to (10 v)\n        end\n    end\nend\n\ndefine scroll (х) (у)\ngo to x: (х) y: (у)\nif <<(х) = (x position)> and <(у) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [rezer v]\ndelete this clone\n\ndefine х (х) у (у)\nnext costume\ncreate clone of (_myself_ v)\nchange [х v] by (х)\nchange [у v] by (у)\n\n@maney\n\nwhen I receive [masaze v]\nshow\n\nwhen I receive [tick v]\nscroll (((х) - (scrollx)) - (1)) ((у) - (scrolly))\nif <touching (cat v)?> then\n    start sound [collect v]\n    change [maney v] by (1)\n    if <(maney) = (maney maks)> then\n        broadcast (open v)\n    end\n    delete this clone\nend\n\nwhen I receive [stup v]\nhide\nset [maney maks v] to [0]\nset [maney v] to [0]\nset [х v] to [0]\nset [у v] to [0]\nif <(level) = [1]> then\n    switch costume to (maney v)\n    х [50] у [0]\n    х [100] у [50]\n    х [363] у [63]\n    х [721] у [-34]\nelse\n    if <(level) = [2]> then\n        switch costume to (maney v)\n        х [-116] у [14]\n        х [137] у [68]\n        х [-6] у [149]\n        х [-128] у [228]\n    else\n        if <(level) = [3]> then\n            switch costume to (maney v)\n            х [-116] у [14]\n            х [137] у [68]\n            х [-6] у [149]\n        end\n    end\nend\nset [х v] to [-99999]\n\ndefine scroll (х) (у)\ngo to x: (х) y: (у)\nif <<(х) = (x position)> and <(у) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [rezer v]\ndelete this clone\n\ndefine х (х) у (у)\nchange [х v] by (х)\nchange [у v] by (у)\nchange [maney maks v] by (1)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nforever\n    next costume\n    wait (0.0) seconds\nend\n\n@map 2\n\nwhen I receive [masaze v]\nshow\n\nwhen I receive [tick v]\nscroll (((х) - (scrollx)) - (1)) ((у) - (scrolly))\n\nwhen I receive [stup v]\nhide\nset [х v] to [0]\nset [у v] to [0]\nif <(level) = [1]> then\n    switch costume to (9 v)\n    х [360] у [0]\n    х [360] у [0]\n    х [360] у [0]\nelse\n    if <(level) = [2]> then\n        switch costume to (5 v)\n        х [0] у [400]\n        х [360] у [0]\n    else\n        switch costume to (9 v)\n    end\nend\n\ndefine scroll (х) (y)\ngo to x: (х) y: (y)\nif <<(х) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [rezer v]\ndelete this clone\n\ndefine х (х) у (у)\nnext costume\ncreate clone of (_myself_ v)\nchange [х v] by (х)\nchange [у v] by (у)\n\n@flag\n\nwhen I receive [masaze v]\nshow\n\nwhen I receive [tick v]\nscroll (((х) - (scrollx)) - (1)) ((у) - (scrolly))\nif <(costume [number v]) = [2]> then\n    if <touching (cat v)?> then\n        set [exit v] to [vin]\n    end\nend\n\nwhen I receive [stup v]\nhide\nset [maney v] to [0]\nset [х v] to [0]\nset [у v] to [0]\nif <(level) = [1]> then\n    switch costume to (flag2 v)\n    х [1500] у [22]\nelse\n    if <(level) = [2]> then\n        switch costume to (flag2 v)\n        х [744] у [478]\n    else\n        if <(level) = [3]> then\n            switch costume to (flag2 v)\n            х [350] у [60]\n        else\n            set [х v] to [-99999]\n        end\n    end\nend\n\ndefine scroll (х) (y)\ngo to x: (х) y: (y)\nif <<(х) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [rezer v]\ndelete this clone\n\ndefine х (х) у (у)\nchange [х v] by (х)\nchange [у v] by (у)\n\nwhen I receive [open v]\nswitch costume to (flag v)\n\n@_ma\n\nwhen I receive [stup v]\nhide\nset [х v] to [0]\nset [у v] to [0]\nif <(level) = [1]> then\n    switch costume to (_ma3 v)\n    х [400] у [-20]\nelse\n    if <(level) = [3]> then\n        switch costume to (_ma3 v)\n        х [400] у [-60]\n        х [400] у [-60]\n        х [400] у [-60]\n        х [400] у [-60]\n        х [400] у [-60]\n    end\nend\nset [х v] to [-99999]\n\nх [137] у [68]\nх [-6] у [149]\nх [-128] у [228]\n\ndefine scroll (х) (у)\ngo to x: (х) y: (у)\nif <<(х) = (x position)> and <(у) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [rezer v]\ndelete this clone\n\nwhen I start as a clone\nforever\n    switch costume to (_ma3 v)\n    wait (0.1) seconds\n    switch costume to (_ma v)\n    wait (0.1) seconds\nend\n\ndefine х (х) у (у)\nchange [х v] by (х)\nchange [у v] by (у)\ncreate clone of (_myself_ v)\n\nwhen I receive [tick v]\nscroll (((х) - ((scrollx) - (sx))) - (1)) ((у) - ((scrolly) - (sy)))\nif <touching (cat v)?> then\n    if <(si) < [-1]> then\n        stop [other scripts in sprite v]\n        switch costume to (_ma4 v)\n        wait (0.1) seconds\n        switch costume to (_ma5 v)\n        wait (0.1) seconds\n        switch costume to (_masq v)\n        wait (0.1) seconds\n        delete this clone\n    end\nend\n\nwhen I receive [masaze v]\nshow\n\nх [50] у []\n\nх [363] у [63]\nх [721] у [-34]\n\nwhen I start as a clone\nset rotation style [left-right v]\nforever\n    repeat (200)\n        point in direction (-90)\n        change [sx v] by (-1)\n    end\n    wait (1) seconds\n    repeat (200)\n        point in direction (90)\n        change [sx v] by (1)\n    end\n    wait (1) seconds\nend\n\n@map fon\n\nwhen flag clicked\nset [ox v] to [0]\ncreate clone of (_myself_ v)\nset [ox v] to [372]\nhide\nforever\n    go to [back v] layer\nend\n\nwhen I start as a clone\nshow\nforever\n    go to [back v] layer\n    go to x: (((((scrollx) * (-0.5)) mod (372)) + (ox)) - (372)) y: (0)\nend\n\n@_ma2\n\nwhen I receive [stup v]\nhide\nset [х v] to [0]\nset [у v] to [0]\nif <(level) = [2]> then\n    switch costume to (_mf v)\n    х [-116] у [14]\n    х [137] у [68]\n    х [-6] у [149]\n    х [-128] у [228]\nend\nset [х v] to [-99999]\n\nif <(level) = [1]> then\n    switch costume to (_ma3 v)\n    х [400] у [-20]\nend\n\ndefine scroll (х) (у)\ngo to x: (х) y: (у)\nif <<(х) = (x position)> and <(у) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [rezer v]\ndelete this clone\n\nwhen I start as a clone\nforever\n    switch costume to (_mf v)\n    wait (0.1) seconds\n    switch costume to (_mf2 v)\n    wait (0.1) seconds\nend\n\ndefine х (х) у (у)\nchange [х v] by (х)\nchange [у v] by (у)\ncreate clone of (_myself_ v)\n\nwhen I receive [tick v]\nscroll (((х) - ((scrollx) - (sx))) - (1)) ((у) - ((scrolly) - (sy)))\nif <touching (cat v)?> then\n    if <(si) < [-1]> then\n        stop [other scripts in sprite v]\n        switch costume to (_mfsq v)\n        wait (0.1) seconds\n        delete this clone\n    end\nend\n\nwhen I receive [masaze v]\nshow\n\nх [50] у []\n\nх [363] у [63]\nх [721] у [-34]\n\nwhen I start as a clone\nset rotation style [left-right v]\nforever\n    repeat (200)\n        point in direction (-90)\n        change [sx v] by (-1)\n    end\n    wait (1) seconds\n    repeat (200)\n        point in direction (90)\n        change [sx v] by (1)\n    end\n    wait (1) seconds\nend\n\n@foto\n\nwhen flag clicked\nforever\n    show\n    go to x: (0) y: (0)\n    go to [front v] layer\n    set [ghost v] effect to (100)\nend\n\n