100% Pen Scrolling Platformer Engine
@Stage\n\n@Pen Platformer Engine\n\ndefine draw square x (x) y (y) size (size)\npen up\ngo to x: ((x) - (size)) y: ((y) + (size))\npen down\ngo to x: ((x) + (size)) y: ((y) + (size))\ngo to x: ((x) + (size)) y: ((y) - (size))\ngo to x: ((x) - (size)) y: ((y) - (size))\ngo to x: ((x) - (size)) y: ((y) + (size))\npen up\ngo to x: (x) y: (y)\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset [volume v] to [100]\nset [level v] to [1]\nforever\n    set [player x v] to [0]\n    set [player y v] to [35]\n    set [scroll x v] to [200]\n    set [scroll y v] to [35]\n    set [in air v] to [0]\n    set [speed x v] to [0]\n    set [speed y v] to [0]\n    set [life v] to [1]\n    set [touching lava v] to [0]\n    set [touching platform v] to [0]\n    repeat until <not <(Life) = [1]>>\n        Render + Move\n    end\n    if <(Life) = [Next Level]> then\n        change [level v] by (1)\n    end\nend\n\nwhen flag clicked\nforever\n    play sound [unlimited v] until done\nend\n\ndefine Move <left> <right> <up> Walk Speed (walk speed) Jump Height (jump height) Friction (friction) Maximum Fall Speed (maximum fall speed) Fall Acceleration (fall acceleration) Scrolling Smoothness (scrolling smoothness) Player X Minimum (player x minimum) Scroll X minimum (scroll x minimum) Scroll Y minimum (scroll y minimum)\nset pen color to (#003bff)\nif <left> then\n    change [speed x v] by ((walk speed) * (-1))\nend\nif <right> then\n    change [speed x v] by (walk speed)\nend\nif <up> then\n    if <(In Air) < [4]> then\n        set [speed y v] to (jump height)\n    end\nend\nTouching Bouncy\nif <(Touching Bouncy) = [1]> then\n    set [speed y v] to ((jump height) * (1.5))\nend\nif <(Speed Y) > ((maximum fall speed) * (-1))> then\n    change [speed y v] by ((fall acceleration) * (-1))\nend\nChange Player Y by (Speed Y)\nset [speed x v] to ((Speed X) * (friction))\nChange Player X by (Speed X) <up> ((walk speed) * (8))\nchange [scroll x v] by (((Player X) - (Scroll X)) / (scrolling smoothness))\nchange [scroll y v] by (((Player Y) - (Scroll Y)) / (scrolling smoothness))\nif <(Player X) < (player x minimum)> then\n    set [player x v] to (player x minimum)\n    set [speed x v] to [0]\nend\nif <(Player Y) < [-180]> then\n    set [life v] to [OOF]\nend\nTouching Lava\nif <(Touching Lava) = [1]> then\n    set [life v] to [OOF]\nend\nTouching Win\nif <(Touching Win) = [1]> then\n    set [life v] to [Next Level]\nend\nif <(Scroll X) < (scroll x minimum)> then\n    set [scroll x v] to (scroll x minimum)\nend\nif <(Scroll Y) < (scroll y minimum)> then\n    set [scroll y v] to (scroll y minimum)\nend\nset [# v] to [0]\nrepeat (25)\n    change [# v] by (1)\n    draw square x ((Player X) - (Scroll X)) y ((Player Y) - (Scroll Y)) size (#)\nend\nset volume to (Volume) %\n\ndefine add platform x1 y1 x2 y2 (x1) (y1) (x2) (y2)\nadd (x1) to [platform v]\nadd (y1) to [platform v]\nadd (x2) to [platform v]\nadd (y2) to [platform v]\npen up\ngo to x (x1) y (y1)\npen down\ngo to x (x2) y (y1)\ngo to x (x2) y (y2)\ngo to x (x1) y (y2)\ngo to x (x1) y (y1)\n\ndefine go to x (x) y (y)\ngo to x: ((x) - (Scroll X)) y: ((y) - (Scroll Y))\n\ndefine Change Player Y by (y)\nchange [player y v] by (y)\nchange [in air v] by (1)\nTouching Platform\nif <(Touching Platform) = [1]> then\n    repeat until <(Touching Platform) = [0]>\n        if <(Speed Y) > [0]> then\n            change [player y v] by (-1)\n        else\n            if <(Speed Y) < [0]> then\n                change [player y v] by (1)\n                set [in air v] to [0]\n            else\n                if <(Speed Y) = [0]> then\n                    change [player y v] by (1)\n                end\n            end\n        end\n        Touching Platform\n    end\n    set [speed y v] to [0]\nend\n\ndefine Touching Platform\nset [touching platform v] to [0]\nset [block check v] to [1]\nrepeat ((length of [platform v]) / (4))\n    if < and <<<(Player Y) < (item ((Block Check) + (1)) of [platform v])> and <(Player Y) > (item ((Block Check) + (3)) of [platform v])>> or <<<((Player Y) - (25)) < (item ((Block Check) + (1)) of [platform v])> and <((Player Y) + (-25)) > (item ((Block Check) + (3)) of [platform v])>> or <<((Player Y) + (25)) > (item ((Block Check) + (3)) of [platform v])> and <((Player Y) + (25)) < (item ((Block Check) + (1)) of [platform v])>>>>> then\n        set [touching platform v] to [1]\n    end\n    change [block check v] by (4)\nend\n\ndefine Change Player X by (x) <up> (push power)\nchange [player x v] by (x)\nTouching Platform\nif <(Touching Platform) = [1]> then\n    repeat until <(Touching Platform) = [0]>\n        if <(Speed X) > [0]> then\n            change [player x v] by (-1)\n        else\n            if <(Speed X) < [0]> then\n                change [player x v] by (1)\n            end\n        end\n        Touching Platform\n    end\n    if <up> then\n        if <(Speed X) > [0]> then\n            set [speed x v] to ((push power) * (-1))\n        else\n            if <(Speed X) < [0]> then\n                set [speed x v] to (push power)\n            end\n        end\n        set [in air v] to [0]\n    else\n        set [speed x v] to [0]\n    end\nend\n\ndefine Render + Move\ndelete all of [platform v]\ndelete all of [lava v]\ndelete all of [bouncy v]\ndelete all of [win v]\nswitch costume to (blank v)\nset size to (108000) %\nswitch costume to (dot\(pls dont complain i forced to do this\) v)\nhide\nerase all\npen up\ngo to x: (0) y: (0)\nset pen color to (#f5f5f5)\nset pen size to (7)\ngo to x: ((-215) - (((Scroll X) + ((timer) * (-50))) mod (50))) y: ((155) - (((Scroll Y) + ((timer) * (-50))) mod (-50)))\nrepeat (11)\n    set x to ((-215) - (((Scroll X) + ((timer) * (-50))) mod (50)))\n    repeat (11)\n        draw square x (x position) y (y position) size [25]\n        change x by (50)\n    end\n    change y by (-50)\nend\npen up\nDraw Level\nMove <key (left arrow v) pressed?> <key (right arrow v) pressed?> <key (up arrow v) pressed?> Walk Speed [2] Jump Height [16] Friction [0.85] Maximum Fall Speed [14] Fall Acceleration [2] Scrolling Smoothness [10] Player X Minimum [-10] Scroll X minimum [200] Scroll Y minimum [0]\n\ndefine Touching Lava\nset [touching lava v] to [0]\nset [block check v] to [1]\nrepeat ((length of [lava v]) / (4))\n    if < and <<<(Player Y) < (item ((Block Check) + (1)) of [lava v])> and <(Player Y) > (item ((Block Check) + (3)) of [lava v])>> or <<<((Player Y) - (25)) < (item ((Block Check) + (1)) of [lava v])> and <((Player Y) + (-25)) > (item ((Block Check) + (3)) of [lava v])>> or <<((Player Y) + (25)) > (item ((Block Check) + (3)) of [lava v])> and <((Player Y) + (25)) < (item ((Block Check) + (1)) of [lava v])>>>>> then\n        set [touching lava v] to [1]\n    end\n    change [block check v] by (4)\nend\n\ndefine add lava x1 y1 x2 y2 (x1) (y1) (x2) (y2)\nadd (x1) to [lava v]\nadd (y1) to [lava v]\nadd (x2) to [lava v]\nadd (y2) to [lava v]\npen up\ngo to x (x1) y (y1)\npen down\ngo to x (x2) y (y1)\ngo to x (x2) y (y2)\ngo to x (x1) y (y2)\ngo to x (x1) y (y1)\n\ndefine add win block x1 y1 x2 y2 (x1) (y1) (x2) (y2)\nadd (x1) to [win v]\nadd (y1) to [win v]\nadd (x2) to [win v]\nadd (y2) to [win v]\npen up\ngo to x (x1) y (y1)\npen down\ngo to x (x2) y (y1)\ngo to x (x2) y (y2)\ngo to x (x1) y (y2)\ngo to x (x1) y (y1)\n\ndefine add bounce x1 y1 x2 y2 (x1) (y1) (x2) (y2)\nadd (x1) to [bouncy v]\nadd (y1) to [bouncy v]\nadd (x2) to [bouncy v]\nadd (y2) to [bouncy v]\npen up\ngo to x (x1) y (y1)\npen down\ngo to x (x2) y (y1)\ngo to x (x2) y (y2)\ngo to x (x1) y (y2)\ngo to x (x1) y (y1)\n\ndefine Touching Win\nset [touching win v] to [0]\nset [block check v] to [1]\nrepeat ((length of [win v]) / (4))\n    if < and <<<(Player Y) < (item ((Block Check) + (1)) of [win v])> and <(Player Y) > (item ((Block Check) + (3)) of [win v])>> or <<<((Player Y) - (25)) < (item ((Block Check) + (1)) of [win v])> and <((Player Y) + (-25)) > (item ((Block Check) + (3)) of [win v])>> or <<((Player Y) + (25)) > (item ((Block Check) + (3)) of [win v])> and <((Player Y) + (25)) < (item ((Block Check) + (1)) of [win v])>>>>> then\n        set [touching win v] to [1]\n    end\n    change [block check v] by (4)\nend\n\ndefine Touching Bouncy\nset [touching bouncy v] to [0]\nset [block check v] to [1]\nrepeat ((length of [bouncy v]) / (4))\n    if < and <<<(Player Y) < (item ((Block Check) + (1)) of [bouncy v])> and <(Player Y) > (item ((Block Check) + (3)) of [bouncy v])>> or <<<((Player Y) - (25)) < (item ((Block Check) + (1)) of [bouncy v])> and <((Player Y) + (-25)) > (item ((Block Check) + (3)) of [bouncy v])>> or <<((Player Y) + (25)) > (item ((Block Check) + (3)) of [bouncy v])> and <((Player Y) + (25)) < (item ((Block Check) + (1)) of [bouncy v])>>>>> then\n        set [touching bouncy v] to [1]\n    end\n    change [block check v] by (4)\nend\n\ndefine Draw Level\nif <(Level) = [1]> then\n    set pen color to (#ff0000)\n    add lava x1 y1 x2 y2 [300] [110] [500] [70]\n    add lava x1 y1 x2 y2 [300] [310] [500] [270]\n    set pen color to (#1dff00)\n    add platform x1 y1 x2 y2 [-50] [10] [200] [-180]\n    add platform x1 y1 x2 y2 [-50] [240] [200] [140]\n    add platform x1 y1 x2 y2 [-50] [440] [200] [340]\n    set pen color to (#fff600)\n    add bounce x1 y1 x2 y2 [-50] [470] [0] [440]\n    set pen color to (#00b6ff)\n    add win block x1 y1 x2 y2 [-50] [690] [0] [645]\nelse\n    set pen color to (#1dff00)\n    add platform x1 y1 x2 y2 [-50] [10] [200] [-180]\nend\n\n@Thumbnail penformer\n\nwhen flag clicked\nshow\nset [ghost v] effect to (100)\n\n
700+ Blocks, VERY SMOOTH and use it with credit!\n\nOpenly admit resharing