Pen Platformer

Instructions: Arrow keys/WASD/Mobile to move.\nAvoid red.\nBounce on yellow stuff.

@Stage\n\nwhen flag clicked\nplay sound [Popsicle v] until done\n\n@pen\n\nwhen flag clicked\nforever\n    if <(x position) > [220]> then\n        broadcast (NEXT LEVEL v)\n        set [xv v] to [0]\n        set [yv v] to [0]\n    end\nend\n\nwhen flag clicked\nset [yv v] to [0]\nset [xv v] to [0]\nset [level v] to [1]\nswitch costume to (costume1 v)\ngo to x: (-193) y: (-80)\nhide\nforever\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n        change [xv v] by (1)\n    end\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n        change [xv v] by (-1)\n    end\n    set [xv v] to ((Xv) * (0.9))\n    change x by (Xv)\n    if <touching color (#00ff43)?> then\n        change y by (1)\n        if <touching color (#00ff43)?> then\n            change y by (1)\n            if <touching color (#00ff43)?> then\n                change y by (1)\n                if <touching color (#00ff43)?> then\n                    change y by (1)\n                    if <touching color (#00ff43)?> then\n                        change y by (1)\n                        if <touching color (#00ff43)?> then\n                            change x by ((Xv) * (-1))\n                            change y by (-5)\n                            if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > ((y position) + (20))>>> then\n                                if <(Xv) > [0]> then\n                                    set [xv v] to [-8]\n                                else\n                                    set [xv v] to [8]\n                                end\n                                set [yv v] to [13]\n                            else\n                                set [xv v] to [0]\n                            end\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 (#00ff43)?> then\n        change y by ((Yv) * (-1))\n        set [yv v] to [0]\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > ((y position) + (20))>>> then\n            set [yv v] to [15]\n        end\n    end\n    if <touching color (#ff0000)?> then\n        go to x: (-193) y: (-80)\n        set [xv v] to [0]\n        set [yv v] to [0]\n    end\n    if <touching color (#ffbb00)?> then\n        set [yv v] to [20]\n    end\nend\n\nwhen I receive [next level v]\ngo to x: (-193) y: (-80)\nchange [level v] by (1)\n\nwhen flag clicked\nforever\n    set pen color to (#000000)\n    set pen size to (15)\n    pen down\n    pen up\nend\n\nwhen I receive [aaaa v]\nset pen color to (#000000)\nset pen size to (15)\npen down\npen up\n\n@level\n\nwhen flag clicked\nhide\nforever\n    if <(Level) = [1]> then\n        draw ground\n    end\n    if <(Level) = [2]> then\n        draw ground\n        line at x: [-110] y: [-100] to x: [-110] y: [50]\n        line at x: [22] y: [-22] to x: [170] y: [-100]\n    end\n    if <(Level) = [3]> then\n        draw ground\n        lava at x: [-100] y: [-100] to x: [-50] y: [-100]\n        lava at x: [0] y: [-100] to x: [50] y: [-100]\n        lava at x: [100] y: [-100] to x: [150] y: [-100]\n        lava at x: [200] y: [-100] to x: [250] y: [-100]\n    end\n    if <(Level) = [4]> then\n        draw ground\n        bouncy at x: [-75] y: [-100] to x: [-25] y: [-100]\n        lava at x: [0] y: [-100] to x: [125] y: [-100]\n        line at x: [145] y: [-100] to x: [145] y: [130]\n        lava at x: [200] y: [-30] to x: [200] y: [250]\n    end\n    if <(Level) = [5]> then\n        draw ground\n        lava at x: [-100] y: [-200] to x: [-100] y: ((([sin v] of ((timer) * (100)) ) * (100)) + (-110))\n        lava at x: [-45] y: [-200] to x: [-45] y: ((([sin v] of ((timer) * (100)) ) * (100)) + (-110))\n        bouncy at x: [15] y: [-200] to x: [15] y: ((([sin v] of ((timer) * (100)) ) * (30)) + (-110))\n        lava at x: [50] y: [-100] to x: [50] y: [80]\n        bouncy at x: [100] y: [-200] to x: [100] y: ((([sin v] of ((timer) * (100)) ) * (30)) + (-110))\n        lava at x: [135] y: [-100] to x: [135] y: [80]\n        lava at x: [200] y: [-30] to x: [200] y: [250]\n    end\n    if <(Level) = [6]> then\n        draw ground\n        lava at x: [-100] y: [-100] to x: [170] y: [-100]\n        line at x: [-110] y: [-100] to x: [-110] y: [50]\n        line at x: [-50] y: [65] to x: [-10] y: [65]\n        lava at x: [25] y: [-200] to x: [25] y: ((([sin v] of ((timer) * (150)) ) * (250)) + (-110))\n        line at x: [75] y: [40] to x: [125] y: [40]\n        line at x: [200] y: [-30] to x: [200] y: [250]\n    end\n    if <(Level) = [7]> then\n        draw ground\n        lava at x: [-100] y: [-100] to x: [145] y: [-100]\n        line at x: [25] y: [-200] to x: [25] y: ((([sin v] of ((timer) * (100)) ) * (250)) + (-110))\n    end\n    if <(Level) = [8]> then\n        draw ground\n        line at x: [0] y: [-100] to x: [0] y: [0]\n        line at x: [0] y: [0] to x: [-75] y: [0]\n        line at x: [-75] y: [-200] to x: [-75] y: ((([sin v] of ((timer) * (150)) ) * (180)) + (-110))\n        lava at x: [50] y: [250] to x: [50] y: ((([sin v] of ((timer) * (150)) ) * (200)) + (100))\n        bouncy at x: [80] y: [-100] to x: [250] y: [-100]\n        line at x: [-250] y: [80] to x: [250] y: [80]\n        line at x: [100] y: [-200] to x: [100] y: ((([sin v] of ((timer) * (150)) ) * (180)) + (-110))\n        lava at x: [150] y: [250] to x: [150] y: ((([sin v] of ((timer) * (150)) ) * (200)) + (100))\n    end\n    if <(Level) = [9]> then\n        draw ground\n        line at x: [0] y: [-100] to x: [0] y: [0]\n        line at x: [0] y: [0] to x: [-180] y: [0]\n        line at x: [-65] y: [-50] to x: [-250] y: [-50]\n        line at x: [-250] y: [80] to x: [0] y: [80]\n        lava at x: [50] y: [-100] to x: [50] y: [100]\n        line at x: [175] y: [-200] to x: [175] y: ((([sin v] of ((timer) * (150)) ) * (180)) + (-110))\n        line at x: [100] y: [-200] to x: [100] y: ((([sin v] of ((timer) * (150)) ) * (180)) + (-110))\n        lava at x: [50] y: [-100] to x: [250] y: [-100]\n    end\n    if <(Level) = [10]> then\n        draw ground\n        line at x: [220] y: [-100] to x: [220] y: [250]\n        set pen size to (10)\n        go to x: (-137) y: (153)\n        set pen color to (#000000)\n        pen down\n        change x by (50)\n        pen up\n        go to x: (-137) y: (153)\n        pen down\n        change y by (-90)\n        change x by (50)\n        pen up\n        change y by (45)\n        change x by (-50)\n        pen down\n        change x by (50)\n        pen up\n        go to x: (-60) y: (153)\n        pen down\n        change y by (-90)\n        pen up\n        go to x: (-60) y: (153)\n        pen down\n        change x by (50)\n        change y by (-90)\n        pen up\n        go to x: (10) y: (153)\n        pen down\n        change y by (-90)\n        change x by (50)\n        change y by (90)\n        change x by (-50)\n    end\nend\n\ndefine draw ground\nbroadcast (aaaa v)\nerase all\npen up\ngo to x: (0) y: (0)\nset pen color to (#86c4f5)\nset pen size to (100000)\npen down\nset pen size to (20)\nset pen color to (#00ff43)\npen up\ngo to x: (-300) y: (-100)\npen down\ngo to x: (300) y: (-100)\npen up\nset pen size to (80)\nset pen color to (#f57600)\ngo to x: (-300) y: (-150)\npen down\ngo to x: (300) y: (-150)\npen up\nset pen size to (80)\nset pen color to (#d86800)\ngo to x: (-300) y: (-175)\npen down\ngo to x: (300) y: (-175)\npen up\nset pen size to (40)\nset pen color to (#b95900)\ngo to x: (-300) y: (-200)\npen down\ngo to x: (300) y: (-200)\nset pen size to (10)\nset pen color to (#00ff43)\npen up\ngo to x: (-200) y: (-100)\npen down\ngo to x: (-200) y: (-150)\npen up\nset pen size to (15)\nset pen color to (#00ff43)\npen up\ngo to x: (-150) y: (-100)\npen down\ngo to x: (-150) y: (-180)\npen up\nset pen size to (8)\nset pen color to (#00ff43)\npen up\ngo to x: (-100) y: (-100)\npen down\ngo to x: (-100) y: (-165)\npen up\nset pen size to (12)\nset pen color to (#00ff43)\npen up\ngo to x: (-50) y: (-100)\npen down\ngo to x: (-50) y: (-140)\npen up\nset pen size to (14)\nset pen color to (#00ff43)\npen up\ngo to x: (0) y: (-100)\npen down\ngo to x: (0) y: (-150)\npen up\nset pen size to (10)\nset pen color to (#00ff43)\npen up\ngo to x: (50) y: (-100)\npen down\ngo to x: (50) y: (-150)\npen up\nset pen size to (13)\nset pen color to (#00ff43)\npen up\ngo to x: (100) y: (-100)\npen down\ngo to x: (100) y: (-175)\npen up\nset pen size to (15)\nset pen color to (#00ff43)\npen up\ngo to x: (150) y: (-100)\npen down\ngo to x: (150) y: (-125)\npen up\nset pen size to (11)\nset pen color to (#00ff43)\npen up\ngo to x: (200) y: (-100)\npen down\ngo to x: (200) y: (-160)\npen up\n\ndefine line at x: (x1) y: (y1) to x: (x2) y: (y2)\npen up\nset pen color to (#00ff43)\nset pen size to (15)\ngo to x: (x1) y: (y1)\npen down\ngo to x: (x2) y: (y2)\npen up\n\ndefine lava at x: (x1) y: (y1) to x: (x2) y: (y2)\npen up\nset pen color to (#ff0000)\nset pen size to (20)\ngo to x: (x1) y: (y1)\npen down\ngo to x: (x2) y: (y2)\npen up\n\ndefine bouncy at x: (x1) y: (y1) to x: (x2) y: (y2)\npen up\nset pen color to (#ffbb00)\nset pen size to (20)\ngo to x: (x1) y: (y1)\npen down\ngo to x: (x2) y: (y2)\npen up\n\ndefine tree at x: (x) y: (y) tree height: (height)\npen up\nset pen color to (#d87314)\nset pen size to ((height) / (3))\ngo to x: (x) y: (y)\npen down\ngo to x: (x) y: ((y) + (height))\npen up\nset pen color to (#00e81e)\nset pen size to ((height) / (2.5))\ngo to x: ((x) - ((height) / (2))) y: ((y) + (height))\npen down\ngo to x: ((x) + ((height) / (2))) y: ((y) + (height))\npen up\nset pen color to (#00ff21)\nset pen size to ((height) / (3))\ngo to x: ((x) - ((height) / (3))) y: ((y) + ((height) * (1.35)))\npen down\ngo to x: ((x) + ((height) / (3))) y: ((y) + ((height) * (1.35)))\npen up\nset pen color to (#24ff41)\nset pen size to ((height) / (3.5))\ngo to x: ((x) - ((height) / (4.5))) y: ((y) + ((height) * (1.65)))\npen down\ngo to x: ((x) + ((height) / (4.5))) y: ((y) + ((height) * (1.65)))\n\nwhen flag clicked\nhide\nforever\n    if <(Level) = [1]> then\n        tree at x: [0] y: [-85] tree height: [60]\n        tree at x: [70] y: [-85] tree height: [70]\n        tree at x: [-80] y: [-85] tree height: [80]\n        tree at x: [176] y: [-85] tree height: [60]\n        tree at x: [-150] y: [-85] tree height: [50]\n    end\n    if <(Level) = [2]> then\n        tree at x: [-40] y: [-85] tree height: [60]\n        tree at x: [-175] y: [-85] tree height: [50]\n        tree at x: [190] y: [-85] tree height: [70]\n    end\n    if <(Level) = [3]> then\n        tree at x: [-25] y: [-85] tree height: [60]\n        tree at x: [-175] y: [-85] tree height: [70]\n        tree at x: [180] y: [-85] tree height: [65]\n    end\n    if <(Level) = [4]> then\n        tree at x: [-175] y: [-85] tree height: [65]\n        tree at x: [-12] y: [-85] tree height: [50]\n    end\n    if <(Level) = [5]> then\n        tree at x: [-165] y: [-85] tree height: [70]\n    end\n    if <(Level) = [6]> then\n        tree at x: [-165] y: [-85] tree height: [70]\n    end\n    if <(Level) = [7]> then\n        tree at x: [-165] y: [-85] tree height: [70]\n        tree at x: [190] y: [-85] tree height: [60]\n    end\n    if <(Level) = [8]> then\n        tree at x: [-165] y: [-85] tree height: [50]\n    end\n    if <(Level) = [10]> then\n        tree at x: [0] y: [-85] tree height: [60]\n        tree at x: [70] y: [-85] tree height: [70]\n        tree at x: [-80] y: [-85] tree height: [80]\n        tree at x: [176] y: [-85] tree height: [60]\n        tree at x: [-150] y: [-85] tree height: [50]\n    end\nend\n\n@sun\n\nwhen flag clicked\nhide\npen up\ngo to x: (-300) y: (300)\nset pen color to (#ffe900)\npen down\nforever\n    pen down\n    set pen size to ((([sin v] of ((timer) * (100)) ) * (20)) + (120))\nend\n\n@Sprite1\n\n