The Impossible Platformer

Instructions:                            The Guy - Platformer\n\n1. Controls:\nW / ▲ - Jump\nA / ◀ - Left\nD / ▶ - Right\nX / M - Interaction\nZ / N - Attack\nR - Reset\n(1, 2, 3 - DEBUG)\n

@Stage\n\n@Sprite1\n\nwhen flag clicked\nset [xv v] to [0]\nset [yv v] to [0]\nset [scroll x v] to [230]\nset [scroll y v] to [30]\nshow\nforever\n    Movement\nend\n\ndefine Movement\nforever\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change [xv v] by (-1)\n    end\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        change [xv v] by (1)\n    end\n    if <not <<key (left arrow v) pressed?> and <key (right arrow v) pressed?>>> then\n    \n    set [xv v] to ((Xv) * (0.9))\n    change x by (Xv)\n    if <touching color (#353535)?> then\n        change y by (1)\n        if <touching color (#353535)?> then\n            change y by (1)\n            if <touching color (#353535)?> then\n                change y by (1)\n                if <touching color (#353535)?> then\n                    change y by (1)\n                end\n                if <touching color (#353535)?> then\n                    change y by (1)\n                    if <touching color (#353535)?> then\n                        change x by ((Xv) * (-1))\n                        change y by (-5)\n                        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                            switch costume to (idle/jump v)\n                            if <(Xv) > [0]> then\n                                set [xv v] to [-5]\n                            else\n                                set [xv v] to [5]\n                            end\n                            set [yv v] to [12]\n                        else\n                            set [xv v] to [0]\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [yv v] by (-1)\n    change y by (Yv)\n    if <touching color (#333333)?> then\n        change y by ((Yv) * (-1))\n        set [yv v] to [0]\n    end\n    change y by (-1)\n    if <touching color (#333333)?> then\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            switch costume to (idle/jump v)\n            set [yv v] to [12]\n        end\n    end\n    change y by (1)\n    change [scroll x v] by ((x position) * (-1))\n    change [scroll y v] by ((y position) * (-1))\n    go to x: (0) y: (0)\n    if <<<touching (sprite3 v)?> or <touching (sprite7 v)?>> or <<(Scroll Y) > [500]> or <touching (sprite8 v)?>>> then\n        switch costume to (dead v)\n        broadcast (oof v)\n        repeat (20)\n            change [ghost v] effect by (5)\n        end\n        switch costume to (idle/jump v)\n        set [scroll x v] to [230]\n        set [scroll y v] to [30]\n        set [xv v] to [0]\n        set [yv v] to [0]\n        set [ghost v] effect to (0)\n    end\n    if <touching color (#000000)?> then\n        broadcast (Next Level v)\n        set [scroll x v] to [230]\n        set [scroll y v] to [30]\n        set [xv v] to [0]\n        set [yv v] to [0]\n    end\nend\n\nwhen flag clicked\nforever\n\nwhen flag clicked\nswitch costume to (idle/jump v)\nset rotation style [left-right v]\nforever\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<key (right arrow v) pressed?> or <key (d v) pressed?>>> then\n        wait (0.05) seconds\n        switch costume to (run1 v)\n        if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<key (right arrow v) pressed?> or <key (d v) pressed?>>> then\n            wait (0.05) seconds\n            switch costume to (run2 v)\n        end\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        point in direction (-90)\n    end\n    if <<key (down arrow v) pressed?> or <key (s v) pressed?>> then\n        wait (0.05) seconds\n        switch costume to (crouch1 v)\n    end\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        point in direction (90)\n    end\nend\n\nset instrument to (20 v)\n\nplay note (60) for (0.15) beats\n\nplay note (60) for (0.25) beats\n\nwhen flag clicked\nset volume to (100) %\n\n@Sprite2\n\nwhen flag clicked\nset [level v] to [1]\nswitch costume to (1 v)\nforever\n    go to x: (Scroll X) y: (Scroll Y)\n    if <(costume [number v]) = [11]> then\n        broadcast (birbs v)\n    end\n    if <(costume [number v]) = [12]> then\n        broadcast (morebirbs v)\n    end\n    if <(costume [number v]) = [13]> then\n        broadcast (nobirbs v)\n    end\nend\n\nwhen I receive [next level v]\n\nwhen I receive [next level v]\nnext costume\nchange [level v] by (1)\n\n@Sprite3\n\nwhen flag clicked\nswitch costume to (1 v)\nforever\n    go to x: (Scroll X) y: (Scroll Y)\nend\n\nwhen I receive [next level v]\nnext costume\n\n@Sprite4\n\n@Sprite5\n\n@Sprite6\n\nwhen I receive [oof v]\nshow\nset [ghost v] effect to (75)\nwait (0.6) seconds\nhide\n\nwhen flag clicked\nhide\n\n@Sprite7\n\nwhen flag clicked\nswitch costume to (1 v)\nforever\n    go to x: (Scroll X) y: (Scroll Y)\nend\n\nwhen flag clicked\nforever\n    wait (0.5) seconds\n    next costume\nend\n\nwhen I receive [birbs v]\nshow\n\nwhen flag clicked\nhide\n\nwhen I receive [morebirbs v]\nhide\n\n@Sprite8\n\nwhen flag clicked\nswitch costume to (1 v)\nforever\n    go to x: (Scroll X) y: (Scroll Y)\nend\n\nwhen flag clicked\nhide\nforever\n    wait (0.5) seconds\n    next costume\nend\n\nwhen I receive [morebirbs v]\nshow\n\nwhen I receive [nobirbs v]\nhide\n\n@Sprite9\n\nwhen flag clicked\nset volume to (100) %\nhide\n\n@Sprite10\n\nwhen flag clicked\nforever\n    play sound [Undertale OST 100 - Megalovania v] until done\nend\n\n