100% Pen Platformer                       #All #Games

Instructions: Use arrow keys to move.\nA total of 8 levels.\nR to respawn N to skip.\nHere is a 100% Pen Platformer, and you can use the engine, as long as you credit me, and people in the notes and credits.\nThere is no sensing used for collisions.\nContains hours of work.\n\n#1 on french trending :D (I shared it while my language was french)\n\n#Pen #All #Games #LOLele_54\n\nSorry for resharing it was an accident.

@Stage\n\n@level\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\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    Backdrop Setup\n    if <(LEVEL) = [1]> then\n        Draw [1] from x: [-60] to x: [-10] and from y: [-150] to y: [-110] width: [10]\n        Draw [1] from x: [-240] to x: [240] and from y: [-180] to y: [-160] width: [10]\n        Draw [2] from x: [0] to x: [100] and from y: [-150] to y: [-130] width: [10]\n    else\n        if <(LEVEL) = [2]> then\n            Draw [1] from x: [-240] to x: [240] and from y: [-180] to y: [-160] width: [10]\n            Draw [2] from x: [-150] to x: [-100] and from y: [-150] to y: [-130] width: [10]\n            Draw [2] from x: [-30] to x: [20] and from y: [-150] to y: [-130] width: [10]\n            Draw [2] from x: [100] to x: [150] and from y: [-150] to y: [-130] width: [10]\n        else\n            if <(LEVEL) = [3]> then\n                Draw [1] from x: [-240] to x: [240] and from y: [-180] to y: [-160] width: [10]\n                Draw [2] from x: [-80] to x: [240] and from y: [-150] to y: [-120] width: [10]\n                Draw [3] from x: [-130] to x: [-90] and from y: [-150] to y: [-130] width: [10]\n            else\n                if <(LEVEL) = [4]> then\n                    Draw [1] from x: [-240] to x: [240] and from y: [-180] to y: [-160] width: [10]\n                    Draw [1] from x: [-100] to x: [-80] and from y: [-100] to y: [-80] width: [10]\n                    Draw [1] from x: [0] to x: [20] and from y: [-30] to y: [-10] width: [10]\n                    Draw [1] from x: [100] to x: [120] and from y: [40] to y: [60] width: [10]\n                    Draw [2] from x: [-140] to x: [240] and from y: [-150] to y: [-130] width: [10]\n                    Draw [2] from x: [-70] to x: [-50] and from y: [-100] to y: [-80] width: [10]\n                    Draw [2] from x: [30] to x: [50] and from y: [-30] to y: [-10] width: [10]\n                    Draw [2] from x: [130] to x: [150] and from y: [40] to y: [60] width: [10]\n                else\n                    if <(LEVEL) = [5]> then\n                        Draw [1] from x: [-240] to x: [240] and from y: [-180] to y: [-160] width: [10]\n                        Draw [2] from x: [-60] to x: [-20] and from y: [-150] to y: [70] width: [10]\n                        Draw [3] from x: [-130] to x: [-70] and from y: [-150] to y: [-130] width: [10]\n                        Draw [2] from x: [60] to x: [100] and from y: [-150] to y: [70] width: [10]\n                        Draw [3] from x: [-10] to x: [50] and from y: [-150] to y: [-130] width: [10]\n                        Draw [2] from x: [180] to x: [220] and from y: [-150] to y: [70] width: [10]\n                        Draw [3] from x: [110] to x: [170] and from y: [-150] to y: [-130] width: [10]\n                    else\n                        if <(LEVEL) = [6]> then\n                            Draw [1] from x: [-240] to x: [-160] and from y: [-180] to y: [-160] width: [10]\n                            Draw [1] from x: [-100] to x: [-60] and from y: [-90] to y: [-70] width: [10]\n                            Draw [1] from x: [40] to x: [80] and from y: [-90] to y: [-20] width: [10]\n                            Draw [1] from x: [180] to x: [220] and from y: [-90] to y: [-70] width: [10]\n                            Draw [2] from x: [-150] to x: [240] and from y: [-180] to y: [-160] width: [10]\n                            Draw [2] from x: [-100] to x: [-60] and from y: [-150] to y: [-100] width: [10]\n                            Draw [2] from x: [40] to x: [80] and from y: [-150] to y: [-100] width: [10]\n                            Draw [2] from x: [180] to x: [220] and from y: [-150] to y: [-100] width: [10]\n                        else\n                            if <(LEVEL) = [7]> then\n                                Draw [1] from x: [-240] to x: [240] and from y: [-180] to y: [-160] width: [10]\n                                Draw [2] from x: [-10] to x: [30] and from y: [-150] to y: [-130] width: [10]\n                                Draw [2] from x: [-240] to x: [240] and from y: [100] to y: [140] width: [10]\n                                Draw [2] from x: [230] to x: [240] and from y: [-150] to y: [-130] width: [10]\n                                Draw [3] from x: [-130] to x: [-90] and from y: [-150] to y: [-130] width: [10]\n                                Draw [3] from x: [110] to x: [150] and from y: [-150] to y: [-130] width: [10]\n                            else\n                                if <(LEVEL) = [8]> then\n                                    Draw [1] from x: [-240] to x: [240] and from y: [-180] to y: [-160] width: [10]\n                                    Draw [1] from x: [-80] to x: [-40] and from y: [-110] to y: [-90] width: [10]\n                                    Draw [1] from x: [60] to x: [100] and from y: [-50] to y: [-30] width: [10]\n                                    Draw [1] from x: [110] to x: [240] and from y: [80] to y: [100] width: [10]\n                                    Draw [1] from x: [-60] to x: [-20] and from y: [40] to y: [60] width: [10]\n                                    Draw [2] from x: [-80] to x: [240] and from y: [-150] to y: [-120] width: [10]\n                                    Draw [2] from x: [200] to x: [240] and from y: [-150] to y: [70] width: [10]\n                                else\n                                    Draw [1] from x: [-240] to x: [240] and from y: [-180] to y: [-160] width: [10]\n                                    E\n                                    N\n                                    D\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\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) = [1]> then\n    set pen color to (#15d007)\nend\nif <(type) = [2]> then\n    set pen color to (#f90808)\nend\nif <(type) = [3]> then\n    set pen color to (#ffdd00)\nend\ngo to x: (start x) y: (start y)\npen down\ngo to x: (end x) y: (start y)\ngo to x: (end x) y: (end y)\ngo to x: (start x) y: (end y)\ngo to x: (start x) y: (start y)\npen down\nif <(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]\nend\nif <(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]\nend\nif <(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]\nend\n\ndefine E\nDraw [1] from x: [-170] to x: [-150] and from y: [-60] to y: [80] width: [10]\nDraw [1] from x: [-170] to x: [-90] and from y: [-60] to y: [-40] width: [10]\nDraw [1] from x: [-170] to x: [-90] and from y: [0] to y: [20] width: [10]\nDraw [1] from x: [-170] to x: [-90] and from y: [60] to y: [80] width: [10]\n\ndefine N\nDraw [1] from x: [-30] to x: [-15] and from y: [-60] to y: [80] width: [10]\nDraw [1] from x: [-15] to x: [0] and from y: [40] to y: [60] width: [10]\nDraw [1] from x: [0] to x: [15] and from y: [20] to y: [40] width: [10]\nDraw [1] from x: [15] to x: [30] and from y: [0] to y: [20] width: [10]\nDraw [1] from x: [30] to x: [45] and from y: [-20] to y: [0] width: [10]\nDraw [1] from x: [45] to x: [60] and from y: [-40] to y: [-20] width: [10]\nDraw [1] from x: [60] to x: [75] and from y: [-60] to y: [80] width: [10]\n\ndefine D\nDraw [1] from x: [120] to x: [140] and from y: [-60] to y: [80] width: [10]\nDraw [1] from x: [120] to x: [180] and from y: [-60] to y: [-40] width: [10]\nDraw [1] from x: [120] to x: [180] and from y: [60] to y: [80] width: [10]\nDraw [1] from x: [180] to x: [200] and from y: [-40] to y: [60] width: [10]\n\nDraw [1] from x: [-30] to x: [-15] and from y: [-60] to y: [80] width: [10]\nDraw [1] from x: [-15] to x: [0] and from y: [40] to y: [60] width: [10]\nDraw [1] from x: [0] to x: [15] and from y: [20] to y: [40] width: [10]\nDraw [1] from x: [15] to x: [30] and from y: [0] to y: [20] width: [10]\nDraw [1] from x: [30] to x: [45] and from y: [-20] to y: [0] width: [10]\nDraw [1] from x: [45] to x: [60] and from y: [-40] to y: [-20] width: [10]\nDraw [1] from x: [60] to x: [75] and from y: [-60] to y: [80] width: [10]\n\n@player\n\nwhen flag clicked\nhide\nset [y spawn v] to [-100]\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?> or <<mouse down?> and <[0] < (mouse y)>>>> 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 [25]\n    end\nend\nchange [xv v] by (<<key (right arrow v) pressed?> or <<mouse down?> and <[0] < (mouse x)>>> - <<key (left arrow v) pressed?> or <<mouse down?> and <(mouse x) < [0]>>>)\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 <[-225] > (x)> then\n    set [x v] to [-225]\nend\nif <<(x) > [240]> and <(LEVEL) < [9]>> then\n    change [level v] by (1)\n    reset\nend\nif <<(x) > [225]> and <(LEVEL) = [9]>> then\n    set [x v] to [225]\nend\n\ndefine Square P\npen up\ngo to x: ((x) + (-13.5)) y: ((y) + (13.5))\npen down\ngo to x: ((x) + (-13.5)) y: ((y) + (-13.5))\ngo to x: ((x) + (13.5)) y: ((y) + (-13.5))\ngo to x: ((x) + (13.5)) y: ((y) + (13.5))\ngo to x: ((x) + (-13.5)) y: ((y) + (13.5))\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) + (23)) > (item ((_collisionCounter) - (3)) of [danger detection v])> then\n        if <(item ((_collisionCounter) - (2)) of [danger detection v]) > ((x) + (-23))> then\n            if <((y) + (23)) > (item ((_collisionCounter) - (1)) of [danger detection v])> then\n                if <(item (_collisionCounter) of [danger 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 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) + (19)) > (item ((_collisionCounter) - (3)) of [bounce detection v])> then\n        if <(item ((_collisionCounter) - (2)) of [bounce detection v]) > ((x) + (-19))> then\n            if <((y) + (19)) > (item ((_collisionCounter) - (1)) of [bounce detection v])> then\n                if <(item (_collisionCounter) of [bounce detection v]) > ((y) + (-19))> then\n                    set [_collision? v] to [1]\n                    stop [this script v]\n                end\n            end\n        end\n    end\nend\n\nwhen [r v] key pressed\nreset\n\nwhen flag clicked\nforever\n    if <<key (n v) pressed?> and <(LEVEL) < [10]>> then\n        change [level v] by (1)\n        reset\n        wait until <not <key (n v) pressed?>>\n    end\nend\n\n