outdated pen platformer engine
@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v) and wait\nforever\n    play sound [bensound v] until done\nend\n\n@Pen\n\ndefine change player x by (sx)\nchange [x v] by (sx)\ncollisiontest [10]\nif <(touching platform?) = [1]> then\n    repeat until <not <(touching platform?) = [1]>>\n        collisiontest [10]\n        if <(sx) > [0]> then\n            change [x v] by (-1)\n        else\n            change [x v] by (1)\n        end\n        set [xv v] to [0]\n    end\nend\n\ndefine change player y by (sy)\nchange [y v] by (sy)\ncollisiontest [10]\nif <(touching platform?) = [1]> then\n    repeat until <not <(touching platform?) = [1]>>\n        collisiontest [10]\n        if <(touching platform?) = [1]> then\n            if <(sy) > [0]> then\n                change [y v] by (-1)\n            else\n                change [y v] by (1)\n                set [in air v] to [0]\n            end\n            set [sy v] to [0]\n        end\n    end\nend\n\nwhen flag clicked\nset [sj.thick.vel v] to [0]\nset [sy v] to [0]\nset [died? v] to [0]\nset [xv v] to [0]\nset [xv v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nset [scroll x v] to [100]\nset [scroll y v] to [100]\nset [touching obstacle? v] to [0]\nset [touching sj? v] to [0]\nset [level v] to [1]\nforever\n    change [sj.thick.vel v] by ((sj.thick.vel) / (-10))\n    Reset\n    Draw player at ((x) - (scroll x)) ((y) - (scroll y))\n    Draw obstacles\n    Draw sj\n    Draw Platforms\n    collisiontest [10]\n    Movement\n    if <<(touching obstacle?) = [1]> or <(y) < [-100]>> then\n        set [y v] to [0]\n        set [x v] to [0]\n        set [died? v] to [1]\n        reset timer\n    end\nend\n\ndefine Draw line from (x1) (y1) to (x2) (y2) color (color) trans (trans) saett (saett) hell (hell) dicke (dicke) to (x3) (y3) to (x4) (y4) filled? (f)\nset pen (color v) to (color)\nset pen (saturation v) to (saett)\nset pen (transparency v) to (trans)\nset pen (brightness v) to (hell)\nset pen size to (dicke)\npen up\ngo to x: (x1) y: (y1)\nif <<[-240] > (x1)> and <<[-240] > (x2)> and <<(x3) > [240]> and <(x4) > [240]>>>> then\n    if <not <<([abs v] of (y1) ) > [180]> and <<([abs v] of (y2) ) > [180]> and <<([abs v] of (y3) ) > [180]> and <([abs v] of (y4) ) > [180]>>>>> then\n        pen down\n        go to x: (x2) y: (y2)\n        go to x: (x3) y: (y3)\n        go to x: (x4) y: (y4)\n        go to x: (x1) y: (y1)\n        if <(f) = [1]> then\n            set [o v] to (dicke)\n            set [pen size v] to ((x3) - (x1))\n            if <((y2) - (y1)) < (pen size)> then\n                set [pen size v] to ((y2) - (y1))\n            end\n            pen up\n            repeat (5)\n                set pen size to (pen size)\n                set [pen size v] to ((pen size) / (2))\n                go to x: ((x1) + (pen size)) y: ((y1) + (pen size))\n                pen down\n                go to x: ((x2) + (pen size)) y: ((y2) - (pen size))\n                go to x: ((x3) - (pen size)) y: ((y3) - (pen size))\n                go to x: ((x4) - (pen size)) y: ((y4) + (pen size))\n                go to x: ((x1) + (pen size)) y: ((y1) + (pen size))\n                pen up\n            end\n        end\n    end\nend\nif <<[-180] > (y1)> and <<(y3) > [180]> and <<(y2) > [180]> and <[-180] > (y4)>>>> then\n    if <not <<([abs v] of (x1) ) > [240]> and <<([abs v] of (x2) ) > [240]> and <<([abs v] of (x3) ) > [240]> and <([abs v] of (x4) ) > [240]>>>>> then\n        pen down\n        go to x: (x2) y: (y2)\n        go to x: (x3) y: (y3)\n        go to x: (x4) y: (y4)\n        go to x: (x1) y: (y1)\n        if <(f) = [1]> then\n            set [o v] to (dicke)\n            set [pen size v] to ((x3) - (x1))\n            if <((y2) - (y1)) < (pen size)> then\n                set [pen size v] to ((y2) - (y1))\n            end\n            pen up\n            repeat (5)\n                set pen size to (pen size)\n                set [pen size v] to ((pen size) / (2))\n                go to x: ((x1) + (pen size)) y: ((y1) + (pen size))\n                pen down\n                go to x: ((x2) + (pen size)) y: ((y2) - (pen size))\n                go to x: ((x3) - (pen size)) y: ((y3) - (pen size))\n                go to x: ((x4) - (pen size)) y: ((y4) + (pen size))\n                go to x: ((x1) + (pen size)) y: ((y1) + (pen size))\n                pen up\n            end\n        end\n    end\nend\nif <not <<([abs v] of (x1) ) > [240]> and <<([abs v] of (x2) ) > [240]> and <<([abs v] of (x3) ) > [240]> and <([abs v] of (x4) ) > [240]>>>>> then\n    if <not <<([abs v] of (y1) ) > [180]> and <<([abs v] of (y2) ) > [180]> and <<([abs v] of (y3) ) > [180]> and <([abs v] of (y4) ) > [180]>>>>> then\n        pen down\n        go to x: (x2) y: (y2)\n        go to x: (x3) y: (y3)\n        go to x: (x4) y: (y4)\n        go to x: (x1) y: (y1)\n        pen up\n        go to x: (x1) y: (y1)\n        if <(f) = [1]> then\n            set [o v] to (dicke)\n            set [pen size v] to ((x3) - (x1))\n            if <((y2) - (y1)) < (pen size)> then\n                set [pen size v] to ((y2) - (y1))\n            end\n            pen up\n            repeat (5)\n                set pen size to (pen size)\n                set [pen size v] to ((pen size) / (2))\n                go to x: ((x1) + (pen size)) y: ((y1) + (pen size))\n                pen down\n                go to x: ((x2) + (pen size)) y: ((y2) - (pen size))\n                go to x: ((x3) - (pen size)) y: ((y3) - (pen size))\n                go to x: ((x4) - (pen size)) y: ((y4) + (pen size))\n                go to x: ((x1) + (pen size)) y: ((y1) + (pen size))\n                pen up\n            end\n        end\n    end\nend\npen up\n\ndefine Draw player at (x) (y)\nset pen (transparency v) to (0)\nif <(died?) = [0]> then\n    set pen color to (#d0ffc7)\nelse\n    if <[0.25] > ((timer) mod (0.5))> then\n        set pen color to (#ecbaba)\n        if <(timer) > [1.5]> then\n            set [died? v] to [0]\n        end\n    else\n        set pen color to (#d2ffc9)\n        if <(timer) > [1.5]> then\n            set [died? v] to [0]\n        end\n    end\nend\nset pen size to (10)\ngo to x: ((x) - (5)) y: ((y) - (5))\npen down\ngo to x: ((x) - (-5)) y: ((y) - (5))\ngo to x: ((x) - (-5)) y: ((y) - (-5))\ngo to x: ((x) - (5)) y: ((y) - (-5))\ngo to x: ((x) - (5)) y: ((y) - (5))\nif <(y) < [110]> then\n    pen up\n    go to x: (x) y: (y)\n    set pen color to (#000000)\n    set pen size to (10)\n    pen down\n    pen up\n    set pen color to (#ffffff)\n    set pen size to (5)\n    pen down\n    pen up\nelse\n    if <(x) > [2675]> then\n        pen up\n        go to x: (x) y: (y)\n        set pen color to (#000000)\n        set pen size to (10)\n        pen down\n        pen up\n        set pen color to (#ffffff)\n        set pen size to (5)\n        pen down\n        pen up\n    else\n        pen up\n        go to x: ((x) / (0.95)) y: ((y) / (0.95))\n        set pen color to (#000000)\n        set pen size to (10)\n        pen down\n        pen up\n        set pen color to (#ffffff)\n        set pen size to (5)\n        pen down\n        pen up\n    end\nend\n\ndefine collisiontest (erlaubt)\nset [i v] to [0]\nrepeat ((length of [platform-type v]) - (0))\n    change [i v] by (1)\n    if <(y) > ((item (i) of [platform-y v]) - (erlaubt))> then\n        if <(x) > ((item (i) of [platform-x v]) - (erlaubt))> then\n            if <not <(x) > (((item (i) of [platform-x v]) + (item (i) of [platform-length v])) + (erlaubt))>> then\n                if <not <(y) > (((item (i) of [platform-y v]) + (item (i) of [platform-height v])) + (erlaubt))>> then\n                    if <(item (i) of [platform-type v]) = [0]> then\n                        set [touching platform? v] to [1]\n                        set [touching obstacle? v] to [0]\n                        set [touching sj? v] to [0]\n                        stop [this script v]\n                    else\n                        if <(item (i) of [platform-type v]) = [1]> then\n                            set [touching platform? v] to [0]\n                            set [touching sj? v] to [0]\n                            set [touching obstacle? v] to [1]\n                            stop [this script v]\n                        else\n                            set [touching obstacle? v] to [0]\n                            set [touching platform? v] to [0]\n                            set [touching sj? v] to [1]\n                            stop [this script v]\n                        end\n                    end\n                else\n                    set [touching platform? v] to [0]\n                    set [touching obstacle? v] to [0]\n                    set [touching sj? v] to [0]\n                end\n            else\n                set [touching platform? v] to [0]\n                set [touching obstacle? v] to [0]\n                set [touching sj? v] to [0]\n            end\n        else\n            set [touching platform? v] to [0]\n            set [touching obstacle? v] to [0]\n            set [touching sj? v] to [0]\n        end\n    else\n        set [touching platform? v] to [0]\n        set [touching obstacle? v] to [0]\n        set [touching sj? v] to [0]\n    end\nend\nset [i v] to [0]\n\ndefine Movement\nif <<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > [10]>>> then\n    set [xv v] to [6]\nelse\n    if <<key (left arrow v) pressed?> or <<mouse down?> and <(mouse x) < [-10]>>> then\n        set [xv v] to [-6]\n    end\nend\nchange player x by (xv)\nset [xv v] to ((xv) * (0.8))\nchange [y v] by (-1)\ncollisiontest [10]\nif <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > [10]>>> then\n    if <(touching platform?) = [1]> then\n        set [sy v] to [23]\n    end\nend\nif <(touching sj?) = [1]> then\n    set [sy v] to [35]\n    set [sj.thick.vel v] to [-30]\nend\nchange [y v] by (1)\nchange [sy v] by (-2)\nchange player y by (sy)\ncollisiontest [10]\n\ndefine Draw Platforms\nif <(Level) = [2]> then\n    New square @ [-100] [-70] length [200] height [40] filled? [1] br [100]\nend\nif <(Level) = [1]> then\n    New square @ [-50] [-70] length [100] height [40] filled? [1] br [90]\n    New square @ [50] [-70] length [100] height [90] filled? [1] br [95]\n    New square @ [150] [-70] length [70] height [140] filled? [1] br [100]\n    New square @ [300] [-70] length [30] height [220] filled? [1] br [95]\n    New square @ [416] [-70] length [325] height [190] filled? [1] br [100]\n    New square @ [410] [-70] length [20] height [270] filled? [1] br [100]\n    New square @ [1100] [0] length [100] height [100] filled? [1] br [100]\n    New square @ [700] [-70] length [400] height [270] filled? [1] br [100]\n    New square @ [550] [100] length [200] height [100] filled? [1] br [100]\n    New square @ [680] [180] length [20] height [100] filled? [1] br [100]\n    New square @ [800] [0] length [20] height [280] filled? [1] br [100]\n    New square @ [920] [0] length [20] height [280] filled? [1] br [100]\n    New square @ [1040] [0] length [20] height [280] filled? [1] br [100]\n    New square @ [1100] [-100] length [300] height [200] filled? [1] br [95]\n    New square @ [1200] [0] length [50] height [430] filled? [1] br [95]\n    New square @ ((([sin v] of ((timer) * (23)) ) * (250)) + (1700)) [-160] length [100] height [215] filled? [0] br [0]\n    New square @ ((([sin v] of ((timer) * (23)) ) * (250)) + (1670)) [-160] length [30] height [220] filled? [1] br [100]\n    New square @ ((([sin v] of ((timer) * (23)) ) * (250)) + (1800)) [-160] length [30] height [220] filled? [1] br [100]\n    New square @ [2200] [-120] length [200] height [215] filled? [0] br [0]\n    New square @ [2170] [-120] length [30] height [220] filled? [1] br [100]\n    New square @ [2375] [-120] length [30] height [220] filled? [1] br [100]\n    New square @ [2500] [-100] length [30] height [250] filled? [1] br [100]\nend\n\ndefine New square @ (x) (y) length (l) height (h) filled? (filled) br (br)\nset [thickness v] to [1]\ninsert [0] at (1) of [platform-type v] \ninsert ((x) - (thickness)) at (1) of [platform-x v] \ninsert ((y) - (thickness)) at (1) of [platform-y v] \ninsert ((l) + ((thickness) * (1.5))) at (1) of [platform-length v] \ninsert ((h) + ((thickness) * (1.5))) at (1) of [platform-height v] \nDraw line from ((x) - (scroll x)) ((y) - (scroll y)) to ((x) - (scroll x)) (((y) + (h)) - (scroll y)) color [64] trans [0] saett [5] hell (br) dicke (thickness) to (((x) + (l)) - (scroll x)) (((y) + (h)) - (scroll y)) to (((x) + (l)) - (scroll x)) ((y) - (scroll y)) filled? (filled)\nDraw line from ((x) - (scroll x)) ((((y) + (h)) - (scroll y)) - (7)) to (((x) + (l)) - (scroll x)) ((((y) + (h)) - (scroll y)) - (7)) color [64] trans [0] saett [5] hell [60] dicke ((thickness) + (10)) to (((x) + (l)) - (scroll x)) ((((y) + (h)) - (scroll y)) - (7)) to (((x) + ()) - (scroll x)) ((((y) + (h)) - (scroll y)) - (7)) filled? (filled)\nDraw line from ((x) - (scroll x)) ((((y) + (h)) - (scroll y)) - (5)) to (((x) + (l)) - (scroll x)) ((((y) + (h)) - (scroll y)) - (5)) color [64] trans [0] saett [5] hell [80] dicke ((thickness) + (10)) to (((x) + (l)) - (scroll x)) ((((y) + (h)) - (scroll y)) - (5)) to (((x) + ()) - (scroll x)) ((((y) + (h)) - (scroll y)) - (5)) filled? (filled)\n\ndefine Draw obstacles\nif <(Level) = [1]> then\n    New obstacle @ [416] [100] filled? [1] length [150] height ((([sin v] of ((timer) * (300)) ) * (10)) + (80))\n    New obstacle @ [700] [200] filled? [1] length [100] height ((([cos v] of ((timer) * (300)) ) * (10)) + (60))\n    New obstacle @ [820] [200] filled? [1] length [100] height ((([sin v] of ((timer) * (300)) ) * (10)) + (60))\n    New obstacle @ [940] [200] filled? [1] length [100] height ((([cos v] of ((timer) * (300)) ) * (10)) + (60))\nend\n\ndefine New obstacle @ (x) (y) filled? (f) length (l) height (h)\nset [thickness v] to [1]\nadd [1] to [platform-type v]\nadd ((x) - (thickness)) to [platform-x v]\nadd ((y) - (thickness)) to [platform-y v]\nadd ((l) + ((thickness) * (1.5))) to [platform-length v]\nadd ((h) + ((thickness) * (1.5))) to [platform-height v]\nDraw line from ((x) - (scroll x)) ((y) - (scroll y)) to ((x) - (scroll x)) ((((y) + (h)) - (scroll y)) + ()) color [200] trans [0] saett ((([cos v] of ((timer) * (300)) ) * (5)) + (56)) hell [92] dicke (thickness) to (((x) + (l)) - (scroll x)) ((((y) + (h)) - (scroll y)) + ()) to (((x) + (l)) - (scroll x)) ((y) - (scroll y)) filled? (f)\n\ndefine Reset\ndelete all of [platform-type v]\nset [x v] to (round (x))\nchange [scroll x v] by ((round ((x) - (scroll x))) / (10))\nchange [scroll y v] by ((round ((y) - (scroll y))) / (10))\nif <(scroll y) < [110]> then\n    set [scroll y v] to [110]\nend\ndelete all of [platform-length v]\ndelete all of [platform-height v]\ndelete all of [platform-x v]\ndelete all of [platform-y v]\nhide\nerase all\n\ndefine New sj (sj means super jump) @ (x) (y) length (l) height (h) fill (f)\nset [thickness v] to [1]\nadd [2] to [platform-type v]\nadd ((x) - (thickness)) to [platform-x v]\nadd ((y) - (thickness)) to [platform-y v]\nadd ((l) + ((thickness) * (1.5))) to [platform-length v]\nadd ((h) + ((thickness) * (1.5))) to [platform-height v]\nDraw line from ((x) - (scroll x)) ((y) - (scroll y)) to ((x) - (scroll x)) ((((y) + (h)) + (sj.thick.vel)) - (scroll y)) color [15] trans [10] saett [56] hell [92] dicke (thickness) to (((x) + (l)) - (scroll x)) ((((y) + (h)) + (sj.thick.vel)) - (scroll y)) to (((x) + (l)) - (scroll x)) ((y) - (scroll y)) filled? (f)\nDraw line from ((x) - (scroll x)) ((y) - (scroll y)) to ((x) - (scroll x)) ((((y) + (((h) / (3)) * (2))) + (sj.thick.vel)) - (scroll y)) color [15] trans [10] saett [48] hell [92] dicke (thickness) to (((x) + (l)) - (scroll x)) ((((y) + (((h) / (3)) * (2))) + (sj.thick.vel)) - (scroll y)) to (((x) + (l)) - (scroll x)) ((y) - (scroll y)) filled? (f)\nDraw line from ((x) - (scroll x)) ((y) - (scroll y)) to ((x) - (scroll x)) ((((y) + ((h) / (3))) + (sj.thick.vel)) - (scroll y)) color [15] trans [10] saett [40] hell [92] dicke (thickness) to (((x) + (l)) - (scroll x)) ((((y) + ((h) / (3))) + (sj.thick.vel)) - (scroll y)) to (((x) + (l)) - (scroll x)) ((y) - (scroll y)) filled? (f)\n\ndefine Draw sj\nif <(Level) = [1]> then\n    New sj (sj means super jump) @ [1100] [90] length [100] height [90] fill [1]\nend\n\ndefine Levelfin\nset [x v] to [0]\nset [y v] to [0]\nset [scroll x v] to [20]\nchange [level v] by (1)\n\n
100% pen\n\nNo <if touching color ()> blocks used!