Rectangular || 100% Pen Scrolling Platformer⠀⠀⠀⠀⠀⠀⠀⠀#All #Games

Instructions: Rectangular || 100% Pen Scrolling Platformer\nUse arrow keys to move.\nOnly 3 levels.\nS to skip and R to respawn.\nEnjoy :D\n#All #Games #Pen\nOMG #11 on trending thanks!

@Stage\n\n@level\n\ndefine Draw (type) from x: (start x) to x: (end x) and from y: (start y) to y: (end y) width: (width)\npen up\nset pen size to (width)\nif <(type) = [5]> then\n    set pen color to (#000000)\n    go to x: (start x) y: (start y)\n    pen down\n    go to x: (end x) y: (start y)\n    go to x: (end x) y: (end y)\n    go to x: (start x) y: (end y)\n    go to x: (start x) y: (start y)\n    pen down\nelse\n    if <(type) = [1]> then\n        set pen color to (#15d007)\n    end\n    if <(type) = [2]> then\n        set pen color to (#f90808)\n    end\n    if <(type) = [3]> then\n        set pen color to (#ffdd00)\n    end\n    if <(type) = [4]> then\n        set pen color to (#00bfff)\n    end\n    go to (start x) (start y) with camera scrolling.\n    pen down\n    go to (end x) (start y) with camera scrolling.\n    go to (end x) (end y) with camera scrolling.\n    go to (start x) (end y) with camera scrolling.\n    go to (start x) (start y) with camera scrolling.\n    pen down\n    if <(type) = [1]> then\n        add (start x) to [ground detection v]\n        add (end x) to [ground detection v]\n        add (start y) to [ground detection v]\n        add (end y) to [ground detection v]\n    end\n    if <(type) = [2]> then\n        add (start x) to [danger detection v]\n        add (end x) to [danger detection v]\n        add (start y) to [danger detection v]\n        add (end y) to [danger detection v]\n    end\n    if <(type) = [3]> then\n        add (start x) to [bounce detection v]\n        add (end x) to [bounce detection v]\n        add (start y) to [bounce detection v]\n        add (end y) to [bounce detection v]\n    end\n    if <(type) = [4]> then\n        add (start x) to [end detection v]\n        add (end x) to [end detection v]\n        add (start y) to [end detection v]\n        add (end y) to [end detection v]\n    end\nend\n\ndefine Backdrop Setup\ngo to x: (0) y: (0)\nset pen size to (1000)\nset pen color to (#000000)\npen down\npen up\n\ndefine go to (x) (y) with camera scrolling.\ngo to x: ((x) - (-CAMERA X)) y: ((y) - (-CAMERA Y))\n\nwhen flag clicked\nhide\nforever\n    erase all\n    delete all of [ground detection v]\n    delete all of [bounce detection v]\n    delete all of [danger detection v]\n    delete all of [end detection v]\n    Backdrop Setup\n    if <(LEVEL) = [1]> then\n        Draw [1] from x: [-240] to x: [260] and from y: [-180] to y: [-160] width: [10]\n        Draw [1] from x: [-60] to x: [-10] and from y: [-150] to y: [-110] width: [10]\n        Draw [1] from x: [210] to x: [260] and from y: [-150] to y: [-110] width: [10]\n        Draw [2] from x: [0] to x: [200] and from y: [-150] to y: [-130] width: [10]\n        Draw [1] from x: [360] to x: [460] and from y: [60] to y: [80] width: [10]\n        Draw [3] from x: [210] to x: [260] and from y: [-100] to y: [-80] width: [10]\n        Draw [4] from x: [410] to x: [460] and from y: [90] to y: [110] width: [10]\n    else\n        if <(LEVEL) = [2]> then\n            Draw [1] from x: [-240] to x: [-120] and from y: [-180] to y: [-160] width: [10]\n            Draw [1] from x: [60] to x: [120] and from y: [-180] to y: [-160] width: [10]\n            Draw [1] from x: [130] to x: [150] and from y: [-180] to y: [-80] width: [10]\n            Draw [2] from x: [160] to x: [200] and from y: [-70] to y: [-50] width: [10]\n            Draw [1] from x: [160] to x: [370] and from y: [-100] to y: [-80] width: [10]\n            Draw [2] from x: [280] to x: [320] and from y: [-70] to y: [-50] width: [10]\n            Draw [3] from x: [330] to x: [370] and from y: [-70] to y: [-50] width: [10]\n            Draw [1] from x: [480] to x: [600] and from y: [-140] to y: [-120] width: [10]\n            Draw [2] from x: [280] to x: [500] and from y: [130] to y: [150] width: [10]\n            Draw [3] from x: [560] to x: [600] and from y: [-110] to y: [-90] width: [10]\n            Draw [1] from x: [800] to x: [1000] and from y: [60] to y: [80] width: [10]\n            Draw [4] from x: [940] to x: [1000] and from y: [90] to y: [130] width: [10]\n        else\n            if <(LEVEL) = [3]> then\n                Draw [1] from x: [-240] to x: [1040] and from y: [-180] to y: [-160] width: [10]\n                Draw [2] from x: [-100] to x: [-60] and from y: [-150] to y: [-130] width: [10]\n                Draw [2] from x: [0] to x: [40] and from y: [-150] to y: [-130] width: [10]\n                Draw [2] from x: [100] to x: [140] and from y: [-150] to y: [-130] width: [10]\n                Draw [2] from x: [200] to x: [240] and from y: [-150] to y: [-130] width: [10]\n                Draw [2] from x: [300] to x: [340] and from y: [-150] to y: [-130] width: [10]\n                Draw [2] from x: [400] to x: [440] and from y: [-150] to y: [-130] width: [10]\n                Draw [2] from x: [500] to x: [540] and from y: [-150] to y: [-130] width: [10]\n                Draw [2] from x: [600] to x: [640] and from y: [-150] to y: [-130] width: [10]\n                Draw [2] from x: [700] to x: [740] and from y: [-150] to y: [-130] width: [10]\n                Draw [2] from x: [800] to x: [840] and from y: [-150] to y: [-130] width: [10]\n                Draw [2] from x: [900] to x: [940] and from y: [-150] to y: [-130] width: [10]\n                Draw [4] from x: [1000] to x: [1040] and from y: [-150] to y: [-130] width: [10]\n            else\n                Draw [1] from x: [-240] to x: [-160] and from y: [-180] to y: [-160] width: [10]\n            end\n        end\n    end\n    change [-camera x v] by (((x) - (-CAMERA X)) / (10))\n    change [-camera y v] by (((y) - (-CAMERA Y)) / (10))\n    Draw [5] from x: [-240] to x: [240] and from y: [-180] to y: [180] width: [10]\nend\n\n@player\n\nwhen flag clicked\nhide\nset [y spawn v] to [-70]\nset [x spawn v] to [-200]\nset [level v] to [1]\nreset\nforever\n    Platformer Engine\n    draw player\nend\n\ndefine Platformer Engine\nchange [yv v] by (-1)\nchange [y v] by (yV)\nground collision?\nif <(_collision?) = [1]> then\n    repeat until <(_collision?) = [0]>\n        if <(yV) > [0]> then\n            change [y v] by (-1)\n        else\n            change [y v] by (1)\n        end\n        ground collision?\n    end\n    set [yv v] to [0]\n    change [y v] by (-3)\n    ground collision?\n    if <<(_collision?) = [1]> and <key (up arrow v) pressed?>> then\n        set [yv v] to [15]\n    end\n    change [y v] by (3)\n    bounce collision?\n    if <(_collision?) = [1]> then\n        set [yv v] to [22]\n    end\nend\nchange [xv v] by (<key (right arrow v) pressed?> - <key (left arrow v) pressed?>)\nif <([abs v] of (xV) ) > [0.5]> then\n    change [x v] by (xV)\nend\nset [xv v] to ((round ((xV) * (9))) / (10))\nground collision?\nif <(_collision?) = [1]> then\n    repeat until <(_collision?) = [0]>\n        if <(xV) > [0]> then\n            change [x v] by (-1)\n        else\n            change [x v] by (1)\n        end\n        ground collision?\n    end\n    set [xv v] to [0]\nend\nlava collision?\nif <(_collision?) = [1]> then\n    reset\nend\nif <(y) < [-720]> then\n    reset\nend\nend collision?\nif <(_collision?) = [1]> then\n    change [level v] by (1)\n    reset\nend\n\ndefine Square P\npen up\ngo to ((x) + (-13.5)) ((y) + (13.5)) with scrolling\npen down\ngo to ((x) + (-13.5)) ((y) + (-13.5)) with scrolling\ngo to ((x) + (13.5)) ((y) + (-13.5)) with scrolling\ngo to ((x) + (13.5)) ((y) + (13.5)) with scrolling\ngo to ((x) + (-13.5)) ((y) + (13.5)) with scrolling\n\ndefine draw player\nset pen color to (#ec8d22)\nset pen size to (5)\nSquare P\npen up\n\ndefine reset\nset [xv v] to [0]\nset [yv v] to [0]\nset [y v] to (Y Spawn)\nset [x v] to (X Spawn)\n\ndefine ground collision?\nset [_collision? v] to [0]\nset [_collisioncounter v] to [0]\nrepeat ((length of [ground detection v]) / (4))\n    change [_collisioncounter v] by (4)\n    if <((x) + (22)) > (item ((_collisionCounter) - (3)) of [ground detection v])> then\n        if <(item ((_collisionCounter) - (2)) of [ground detection v]) > ((x) + (-22))> then\n            if <((y) + (22)) > (item ((_collisionCounter) - (1)) of [ground detection v])> then\n                if <(item (_collisionCounter) of [ground detection v]) > ((y) + (-22))> then\n                    set [_collision? v] to [1]\n                    stop [this script v]\n                end\n            end\n        end\n    end\nend\n\ndefine lava collision?\nset [_collision? v] to [0]\nset [_collisioncounter v] to [0]\nrepeat ((length of [danger detection v]) / (4))\n    change [_collisioncounter v] by (4)\n    if <((x) + (13)) > (item ((_collisionCounter) - (3)) of [danger detection v])> then\n        if <(item ((_collisionCounter) - (2)) of [danger detection v]) > ((x) + (-13))> then\n            if <((y) + (13)) > (item ((_collisionCounter) - (1)) of [danger detection v])> then\n                if <(item (_collisionCounter) of [danger detection v]) > ((y) + (-13))> then\n                    set [_collision? v] to [1]\n                    stop [this script v]\n                end\n            end\n        end\n    end\nend\n\ndefine bounce collision?\nset [_collision? v] to [0]\nset [_collisioncounter v] to [0]\nrepeat ((length of [danger detection v]) / (4))\n    change [_collisioncounter v] by (4)\n    if <((x) + (23)) > (item ((_collisionCounter) - (3)) of [bounce detection v])> then\n        if <(item ((_collisionCounter) - (2)) of [bounce detection v]) > ((x) + (-23))> then\n            if <((y) + (23)) > (item ((_collisionCounter) - (1)) of [bounce detection v])> then\n                if <(item (_collisionCounter) of [bounce detection v]) > ((y) + (-23))> then\n                    set [_collision? v] to [1]\n                    stop [this script v]\n                end\n            end\n        end\n    end\nend\n\ndefine go to (x) (y) with scrolling\ngo to x: ((x) - (-CAMERA X)) y: ((y) - (-CAMERA Y))\n\ndefine end collision?\nset [_collision? v] to [0]\nset [_collisioncounter v] to [0]\nrepeat ((length of [end detection v]) / (4))\n    change [_collisioncounter v] by (4)\n    if <((x) + (22)) > (item ((_collisionCounter) - (3)) of [end detection v])> then\n        if <(item ((_collisionCounter) - (2)) of [end detection v]) > ((x) + (-22))> then\n            if <((y) + (22)) > (item ((_collisionCounter) - (1)) of [end detection v])> then\n                if <(item (_collisionCounter) of [end detection v]) > ((y) + (-22))> then\n                    set [_collision? v] to [1]\n                    stop [this script v]\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <key (s v) pressed?> then\n        change [level v] by (1)\n        reset\n        wait until <not <key (s v) pressed?>>\n    end\n    if <key (r v) pressed?> then\n        reset\n        wait until <not <key (r v) pressed?>>\n    end\nend\n\n