Pen platformer + editor v1.0.1
@Stage\n\nwhen flag clicked\nbroadcast (GameOn v)\n\n@ \n\ndefine Player movement (speed) (friction) (gravity) (jump height)\nchange [xv v] by ((<<key (right arrow v) pressed?> or <key (d v) pressed?>> - <<key (left arrow v) pressed?> or <key (a v) pressed?>>) * (speed))\nset [xv v] to ((Xv) * (friction))\nchange [@player x v] by (Xv)\ncollision\nif <<[touching? v] contains [1]?> or <<[touching? v] contains [4]?> or >> then\n    change [@player y v] by (1)\n    collision\n    if <<[touching? v] contains [1]?> or <<[touching? v] contains [4]?> or >> then\n        change [@player y v] by (1)\n        collision\n        if <<[touching? v] contains [1]?> or <<[touching? v] contains [4]?> or >> then\n            change [@player y v] by (1)\n            collision\n            if <<[touching? v] contains [1]?> or <<[touching? v] contains [4]?> or >> then\n                change [@player y v] by (1)\n                collision\n                if <<[touching? v] contains [1]?> or <<[touching? v] contains [4]?> or >> then\n                    change [@player y v] by (1)\n                    collision\n                    if <<[touching? v] contains [1]?> or <<[touching? v] contains [4]?> or >> then\n                        change [@player x v] by (() - (Xv))\n                        set [xv v] to [0]\n                        change [@player y v] by (-5)\n                    end\n                end\n            end\n        end\n    end\nend\nchange [yv v] by (gravity)\nchange [@player y v] by (Yv)\ncollision\nif  then\n    change [@player x v] by (() - (Xv))\n    change [@player y v] by (() - (gravity))\n    set [xv v] to [0]\n    set [yv v] to [0]\n    stop [this script v]\nend\nif <<[touching? v] contains [1]?> or <<[touching? v] contains [4]?> or >> then\n    change [@player y v] by (() - (Yv))\n    set [yv v] to [0]\nend\nchange [@player y v] by (-1)\ncollision\nif <<[touching? v] contains [1]?> or <<[touching? v] contains [4]?> or >> then\n    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        set [yv v] to (jump height)\n    end\nend\nget the lowest platform\nif <<[touching? v] contains [2]?> or <(@Player Y) < ((return2) - (285))>> then\n    reset\nend\nif <[touching? v] contains [3]?> then\n    set [yv v] to ((jump height) + (4))\nend\nif <[touching? v] contains [4]?> then\n    set [respawn x v] to (@Player X)\n    set [respawn y v] to (@Player Y)\nend\nchange [@player y v] by (1)\nif <key (r v) pressed?> then\n    set [respawn x v] to [-15]\n    set [respawn y v] to [0]\n    reset\nend\n\ndefine collision\nset [indexi v] to [0]\ndelete all of [touching? v]\nrepeat (length of [h v])\n    change [indexi v] by (1)\n    if <((@Player X) + (15)) > (item (indexi) of [x v])> then\n        if <((item (indexi) of [x v]) + (item (indexi) of [w v])) > ((@Player X) - (15))> then\n            if <((@Player Y) + (15)) > ((item (indexi) of [y v]) - (item (indexi) of [h v]))> then\n                if <(item (indexi) of [y v]) > ((@Player Y) - (15))> then\n                    if <not <[touching? v] contains (item (indexi) of [t v])?>> then\n                        add (item (indexi) of [t v]) to [touching? v]\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine create rectangle (x) (y) (w) (h) (t)\nadd (x) to [x v]\nadd (y) to [y v]\nadd (w) to [w v]\nadd (h) to [h v]\nadd (t) to [t v]\n\ndefine go to (x) (y)\ngo to x: (((x) - (@Cam X)) / (@Cam Z\(useless\))) y: (((y) - (@Cam Y)) / (@Cam Z\(useless\)))\n\nwhen I receive [gameon v]\nset [selected type v] to [1]\nshow list [save code v]\nwait (0) seconds\nset pen color to (#9a9a9a)\nerase all\npen up\nforever\n    erase all\n    change [@cam x v] by (((@Player X) - (@Cam X)) / (6))\n    change [@cam y v] by (((@Player Y) - (@Cam Y)) / (6))\n    change [@cam z\(useless\) v] by (((Zoom\(use less\)) - (@Cam Z\(useless\))) / (6))\n    if <(grid on?) = [1]> then\n        Grid\n    end\n    render\n    set [building v] to [0]\n    if <mouse down?> then\n        if <(grid on?) = [1]> then\n            set [start x v] to ((((round (((mouse x) + (@Cam X)) / (20))) * (20)) - (round (@Cam X))) - (-5))\n            set [start y v] to ((((round ((((mouse y) - (5)) + (@Cam Y)) / (20))) * (20)) - (round (@Cam Y))) - (-5))\n        else\n            set [start x v] to (mouse x)\n            set [start y v] to (mouse y)\n        end\n        if <<[-140] < (start Y)> and <(start Y) < [140]>> then\n            repeat until <not <mouse down?>>\n                set [building v] to [1]\n                set pen size to ((5) / (@Cam Z\(useless\)))\n                pen up\n                erase all\n                set [collided? v] to [0]\n                if <(grid on?) = [1]> then\n                    set [mouse x v] to ((((round (((mouse x) + (@Cam X)) / (20))) * (20)) - (round (@Cam X))) - (-5))\n                    set [mouse y v] to ((((round ((((mouse y) - (5)) + (@Cam Y)) / (20))) * (20)) - (round (@Cam Y))) - (-5))\n                else\n                    set [mouse x v] to (mouse x)\n                    set [mouse y v] to (mouse y)\n                end\n                if <(start Y) > (mouse y)> then\n                    if <(start X) > (mouse x)> then\n                        if <((@Player Y) + (15)) > ((((start Y) + (@Cam Y)) / (1)) - (((start Y) - (mouse y)) / (1)))> then\n                            if <(((start Y) + (@Cam Y)) / (1)) > ((@Player Y) - (15))> then\n                                if <((@Player X) + (15)) > (((mouse x) + (@Cam X)) / (1))> then\n                                    if <((((mouse x) + (@Cam X)) / (1)) + (((start X) - (mouse x)) / (1))) > ((@Player X) - (15))> then\n                                        set [collided? v] to [1]\n                                    end\n                                end\n                            end\n                        end\n                    else\n                        if <((@Player Y) + (15)) > ((((start Y) + (@Cam Y)) / (1)) - (((start Y) - (mouse y)) / (1)))> then\n                            if <(((start Y) + (@Cam Y)) / (1)) > ((@Player Y) - (15))> then\n                                if <((@Player X) + (15)) > (((start X) + (@Cam X)) / (1))> then\n                                    if <((((start X) + (@Cam X)) / (1)) + (((mouse x) - (start X)) / (1))) > ((@Player X) - (15))> then\n                                        set [collided? v] to [1]\n                                    end\n                                end\n                            end\n                        end\n                    end\n                else\n                    if <(start X) > (mouse x)> then\n                        if <((@Player X) + (15)) > (((mouse x) + (@Cam X)) / (1))> then\n                            if <((((mouse x) + (@Cam X)) / (1)) + (((start X) - (mouse x)) / (1))) > ((@Player X) - (15))> then\n                                if <((@Player Y) + (15)) > ((((mouse y) + (@Cam Y)) / (1)) - (((mouse y) - (start Y)) / (1)))> then\n                                    if <(((mouse y) + (@Cam Y)) / (1)) > ((@Player Y) - (15))> then\n                                        set [collided? v] to [1]\n                                    end\n                                end\n                            end\n                        end\n                    else\n                        if <((@Player X) + (15)) > (((start X) + (@Cam X)) / (1))> then\n                            if <((((start X) + (@Cam X)) / (1)) + (((mouse x) - (start X)) / (1))) > ((@Player X) - (15))> then\n                                if <((@Player Y) + (15)) > ((((mouse y) + (@Cam Y)) / (1)) - (((mouse y) - (start Y)) / (1)))> then\n                                    if <(((mouse y) + (@Cam Y)) / (1)) > ((@Player Y) - (15))> then\n                                        set [collided? v] to [1]\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n                if <(grid on?) = [1]> then\n                    Grid\n                end\n                if <(touching back button?) = [1]> then\n                    set [collided? v] to [1]\n                end\n                set pen color to (#98dcff)\n                if <(collided?) = [1]> then\n                    set pen color to (#f39191)\n                end\n                go to x: (start X) y: (start Y)\n                pen down\n                go to x: (mouse x) y: (start Y)\n                go to x: (mouse x) y: (mouse y)\n                go to x: (start X) y: (mouse y)\n                go to x: (start X) y: (start Y)\n                render\n            end\n            if <(collided?) = [0]> then\n                if <(start Y) > (mouse y)> then\n                    add (((start Y) + (@Cam Y)) / (@Cam Z\(useless\))) to [y v]\n                    add (((start Y) - (mouse y)) / (@Cam Z\(useless\))) to [h v]\n                else\n                    add (((mouse y) + (@Cam Y)) / (@Cam Z\(useless\))) to [y v]\n                    add (((mouse y) - (start Y)) / (@Cam Z\(useless\))) to [h v]\n                end\n                if <(start X) > (mouse x)> then\n                    add (((mouse x) + (@Cam X)) / (@Cam Z\(useless\))) to [x v]\n                    add (((start X) - (mouse x)) / (@Cam Z\(useless\))) to [w v]\n                else\n                    add (((start X) + (@Cam X)) / (@Cam Z\(useless\))) to [x v]\n                    add (((mouse x) - (start X)) / (@Cam Z\(useless\))) to [w v]\n                end\n                add (selected type) to [t v]\n            end\n        end\n    end\nend\n\nwhen I receive [gameon v]\ndelete all of [x v]\ndelete all of [y v]\ndelete all of [w v]\ndelete all of [h v]\ndelete all of [t v]\nset [respawn x v] to [-15]\nset [respawn y v] to [0]\nreset\nLoad [48414100484341004446003846004000]\nforever\n    if <[touching? v] contains [5]?> then\n        wait until <key (r v) pressed?>\n        set [respawn x v] to [-15]\n        set [respawn y v] to [0]\n        reset\n    else\n        if <(spectating) = [0]> then\n            if <(building) = [0]> then\n                Player movement [2.5] [0.75] [-0.75] [12]\n            end\n        else\n            change [xv v] by ((<<key (right arrow v) pressed?> or <key (d v) pressed?>> - <<key (left arrow v) pressed?> or <key (a v) pressed?>>) * (3))\n            change [yv v] by ((<<key (up arrow v) pressed?> or <key (w v) pressed?>> - <<key (down arrow v) pressed?> or <key (s v) pressed?>>) * (3))\n            set [xv v] to ((Xv) * (0.75))\n            set [yv v] to ((Yv) * (0.75))\n            change [@player x v] by (Xv)\n            change [@player y v] by (Yv)\n            if  then\n                set [respawn x v] to [-15]\n                set [respawn y v] to [0]\n                reset\n            end\n        end\n    end\nend\n\ndefine reset\nset [spectating v] to [0]\nset [@cam x v] to [-15]\nset [@cam y v] to [0]\nset [zoom\(use less\) v] to [1]\nset [@player x v] to (respawn x)\nset [@player y v] to (respawn y)\nset [xv v] to [0]\nset [yv v] to [0]\ncollision\nrepeat until <not <[touching? v] contains [1]?>>\n    change [@player y v] by (1)\n    collision\nend\n\ndefine render\npen up\nbroadcast (Tick v)\nset pen size to ((5) / (@Cam Z\(useless\)))\npen up\nset [indexii v] to [0]\nrepeat (length of [h v])\n    change [indexii v] by (1)\n    go to (item (indexii) of [x v]) (item (indexii) of [y v])\n    if <(item (indexii) of [t v]) = [1]> then\n        set pen color to (#9a9a9a)\n    end\n    if <(item (indexii) of [t v]) = [2]> then\n        set pen color to (#ff6464)\n    end\n    if <(item (indexii) of [t v]) = [3]> then\n        set pen color to (#fff264)\n    end\n    if <(item (indexii) of [t v]) = [4]> then\n        set pen color to (#649cff)\n    end\n    if <(item (indexii) of [t v]) = [5]> then\n        set pen color to (#64ff78)\n    end\n    pen down\n    go to ((item (indexii) of [x v]) + (item (indexii) of [w v])) (item (indexii) of [y v])\n    go to ((item (indexii) of [x v]) + (item (indexii) of [w v])) ((item (indexii) of [y v]) - (item (indexii) of [h v]))\n    go to (item (indexii) of [x v]) ((item (indexii) of [y v]) - (item (indexii) of [h v]))\n    go to (item (indexii) of [x v]) (item (indexii) of [y v])\n    pen up\nend\nset pen color to (#64cbff)\ngo to ((@Player X) - (10)) ((@Player Y) + (10))\npen down\ngo to ((@Player X) + (10)) ((@Player Y) + (10))\ngo to ((@Player X) + (10)) ((@Player Y) - (10))\ngo to ((@Player X) - (10)) ((@Player Y) - (10))\ngo to ((@Player X) - (10)) ((@Player Y) + (10))\npen up\nset pen color to (#9a9a9a)\nset pen size to (40)\ngo to x: (-260) y: (160)\nset pen (transparency v) to (25)\npen down\ngo to x: (260) y: (160)\npen up\ngo to x: (-260) y: (-160)\nset pen (transparency v) to (25)\npen down\ngo to x: (260) y: (-160)\npen up\nset pen color to (#9a9a9a)\ngo to x: ((150) + ((-2) * (35))) y: (-161)\nget dist (x position) (y position) (mouse x) (mouse y)\nif <<mouse down?> and <[10] > (dist)>> then\n    set [selected type v] to [1]\nend\nset pen size to ((20) + (<<[10] > (dist)> or <(selected type) = [1]>> * (5)))\npen down\npen up\nset pen color to (#ff6464)\ngo to x: ((150) + ((-1) * (35))) y: (-161)\nget dist (x position) (y position) (mouse x) (mouse y)\nif <<mouse down?> and <[10] > (dist)>> then\n    set [selected type v] to [2]\nend\nset pen size to ((20) + (<<[10] > (dist)> or <(selected type) = [2]>> * (5)))\npen down\npen up\nset pen color to (#fff264)\ngo to x: ((150) + ((0) * (35))) y: (-161)\nget dist (x position) (y position) (mouse x) (mouse y)\nif <<mouse down?> and <[10] > (dist)>> then\n    set [selected type v] to [3]\nend\nset pen size to ((20) + (<<[10] > (dist)> or <(selected type) = [3]>> * (5)))\npen down\npen up\nset pen color to (#649cff)\ngo to x: ((150) + ((1) * (35))) y: (-161)\nget dist (x position) (y position) (mouse x) (mouse y)\nif <<mouse down?> and <[10] > (dist)>> then\n    set [selected type v] to [4]\nend\nset pen size to ((20) + (<<[10] > (dist)> or <(selected type) = [4]>> * (5)))\npen down\npen up\nset pen color to (#64ff78)\ngo to x: ((150) + ((2) * (35))) y: (-161)\nget dist (x position) (y position) (mouse x) (mouse y)\nif <<mouse down?> and <[10] > (dist)>> then\n    set [selected type v] to [5]\nend\nset pen size to ((20) + (<<[10] > (dist)> or <(selected type) = [5]>> * (5)))\npen down\npen up\nset pen color to (#e0e0e0)\ngo to x: ((-160) + (11)) y: ((-161.5) + (11))\nset pen size to (3)\npen down\ngo to x: ((-160) + (11)) y: ((-161.5) + (-11))\ngo to x: ((-160) + (-11)) y: ((-161.5) + (-11))\ngo to x: ((-160) + (-11)) y: ((-161.5) + (11))\ngo to x: ((-160) + (11)) y: ((-161.5) + (11))\nif <(grid on?) = [1]> then\n    set pen color to (#64ff79)\n    pen up\n    go to x: (-167) y: (-164)\n    pen down\n    point in direction (90)\n    turn right (45) degrees\n    move (5) steps\n    turn left (90) degrees\n    move (15) steps\nend\nset pen size to ((5) / (@Cam Z\(useless\)))\npen up\n\nwhen [up arrow v] key pressed\n\nchange [zoom\(use less\) v] by (([abs v] of (@Cam Z\(useless\)) ) / (4))\nif <[2.5] < (Zoom\(use less\))> then\n    set [zoom\(use less\) v] to [2.5]\nend\n\nwhen [down arrow v] key pressed\n\nchange [zoom\(use less\) v] by (() - (([abs v] of (@Cam Z\(useless\)) ) / (4)))\nif <(Zoom\(use less\)) < [0.75]> then\n    set [zoom\(use less\) v] to [0.75]\nend\n\nwhen I receive [gameon v]\nforever\n    if <(touching back button?) = [1]> then\n        if <mouse down?> then\n            wait until <not <mouse down?>>\n            if <(touching back button?) = [1]> then\n                delete (length of [h v]) of [x v]\n                delete (length of [h v]) of [y v]\n                delete (length of [h v]) of [w v]\n                delete (length of [h v]) of [t v]\n                delete (length of [h v]) of [h v]\n            end\n        end\n    end\nend\n\nwhen I receive [gameon v]\nforever\n    if <(touching save button?) = [1]> then\n        if <mouse down?> then\n            wait until <not <mouse down?>>\n            if <(touching save button?) = [1]> then\n                save\n            end\n        end\n    end\nend\n\ndefine save\nset [save code v] to []\nset [indexiiii v] to [0]\nset [encode v] to []\nrepeat (length of [h v])\n    change [indexiiii v] by (1)\n    encode (round (item (indexiiii) of [x v]))\n    encode (round (item (indexiiii) of [y v]))\n    encode (round (item (indexiiii) of [w v]))\n    encode (round (item (indexiiii) of [h v]))\n    encode (item (indexiiii) of [t v])\nend\nset [save code v] to (encode)\ndelete all of [save code v]\nadd [Triple click to select all, ctrl + c to copy] to [save code v]\nadd [] to [save code v]\nadd [x to close] to [save code v]\nreplace item (2) of [save code v] with (save code)\nhide list [save code v]\n\ndefine encode (text)\nset [indexiii v] to [0]\nrepeat (length of (text))\n    change [indexiii v] by (1)\n    set [encode v] to (join (encode) (item # of (letter (indexiii) of (text)) in [char v]))\nend\nset [encode v] to (join (encode) [00])\n\ndelete all of [char v]\nset [char v] to [abcdefghijklmnopqrstuvwxyz1234567890.-=_+!@#$%^&*\(\)<>,/?]\nrepeat (9)\n    add [] to [char v]\nend\nset [indexi v] to [0]\nrepeat (length of (char))\n    change [indexi v] by (1)\n    add (letter (indexi) of (char)) to [char v]\nend\n\nwhen [x v] key pressed\nshow list [save code v]\n\ndefine Load (code)\nreset\ndelete all of [x v]\ndelete all of [y v]\ndelete all of [w v]\ndelete all of [h v]\ndelete all of [t v]\nset [save code v] to (code)\nset [indexiii v] to [1]\nset [indexiiii v] to [0]\nset [respawn x v] to [-15]\nset [respawn y v] to [0]\nset [@player x v] to [-15]\nset [@player y v] to [0]\nrepeat until <(indexiii) > (length of (save code))>\n    change [indexiiii v] by (1)\n    decode\n    add (return) to [x v]\n    decode\n    add (return) to [y v]\n    decode\n    add (return) to [w v]\n    decode\n    add (return) to [h v]\n    decode\n    add (return) to [t v]\nend\n\ndefine decode\nset [return v] to []\n\n    set [idx v] to (join (letter (indexiii) of (save code)) (letter ((indexiii) + (1)) of (save code)))\n    change [indexiii v] by (2)\n    if <(idx) < [1]> then\n        stop [this script v]\n    end\n    set [return v] to (join (return) (item (idx) of [char v]))\nend\n\nwhen I receive [gameon v]\nforever\n    if <(touching load button?) = [1]> then\n        if <mouse down?> then\n            wait until <not <mouse down?>>\n            if <(touching load button?) = [1]> then\n                hide\n                ask [Save Code:] and wait\n                Load (answer)\n            end\n        end\n    end\nend\n\ndefine get the lowest platform\nset [return2 v] to ((1) / (0))\nset [indexiiiiii v] to [0]\nrepeat (length of [y v])\n    change [indexiiiiii v] by (1)\n    if <((item (indexiiiiii) of [y v]) - (item (indexiiiiii) of [h v])) < (return2)> then\n        set [return2 v] to ((item (indexiiiiii) of [y v]) - (item (indexiiiiii) of [h v]))\n    end\nend\nif <(return2) = ((1) / (0))> then\n    set [return2 v] to [-115]\nend\n\ndefine get dist (x1) (y1) (x2) (y2)\nset [dist v] to ([sqrt v] of ((((x1) - (x2)) * ((x1) - (x2))) + (((y1) - (y2)) * ((y1) - (y2)))) )\n\nwhen I receive [gameon v]\nforever\n    if <(touching grid button?) = [1]> then\n        if <mouse down?> then\n            wait until <not <mouse down?>>\n            if <(touching grid button?) = [1]> then\n                set [grid on? v] to ((1) - (grid on?))\n            end\n        end\n    end\nend\n\ndefine Grid\nset pen color to (#e6e6e6)\nset [index v] to [-255]\nset [ii v] to ((@Cam X) mod (20))\nset [iii v] to ((@Cam Y) mod (20))\nrepeat (36)\n    pen up\n    go to x: ((index) - (ii)) y: (() - ((1) / (0)))\n    pen down\n    go to x: ((index) - (ii)) y: ((1) / (0))\n    pen up\n    go to x: (() - ((1) / (0))) y: ((index) - (iii))\n    pen down\n    go to x: ((1) / (0)) y: ((index) - (iii))\n    change [index v] by (20)\n    set pen (transparency v) to (50)\nend\npen up\n\ndefine draw line (sx) (sy) (ex) (ey)\npen up\ngo to (sx) (sy)\npen down\ngo to (ex) (ey)\n\nwhen [space v] key pressed\nset [spectating v] to ((1) - (spectating))\nset [xv v] to [0]\nset [yv v] to [0]\nwait until <not <key (space v) pressed?>>\n\nwhen [c v] key pressed\ndelete all of [x v]\ndelete all of [y v]\ndelete all of [w v]\ndelete all of [h v]\ndelete all of [t v]\nset [respawn x v] to [-15]\nset [respawn y v] to [0]\nreset\nset [spectating v] to [1]\nwait until <not <key (c v) pressed?>>\n\nLoad [48414100484341004446003846004000404100484341004046003846003900374641003738410038460038384600370048394100483737410040460038460038004837394100483839410044460038460037003841004838394100444600384600370048394100483839410040460038460039003738410048374341003846004446003800374241004838394100373846003846004000394641004837434100384600444600380039404100483743410044460038460037004040410048373741003846004446003800404441004837374100404600384600390041404100444100384600383846003700394041003841004046004046003700374441004441004246004246003700483941003742410040460040460037004041003844410042460038460039003746410040384100444600384600400048384141003846410042460042460037004840374100374441003740460040460038004840454100384641004246004246003700484141410038444100404600374046003800484239410038444100424600384600400048424341003844410038460038460037004843394100384441004046004046003700484437410038444100424600424600370048444341003844410040460040460037004845374100384441003846003846003700484345410039444100384600384600410038464100404441003846004446003800384241004044410044460038460038003846410039444100374046003846003700394241004046410038460040460038004046410039444100444600384600370041464100394441004246003846003900414441003944410044460038460037004138410041464100384600384600410044464100444100404600404600370044424100424100384600384600370045464100424100384600384600370045404100424100384600384600370037404100484341004046003846003900]\n\n@fJPPTE+\n\nwhen flag clicked\nReset Rotation\n\ndefine INT Draw Rot Char (x) (y) (w) (h) (t) (sp) (rx) (ry) (sx) (r)\nset [d v] to [3]\nrepeat (item ((r) + (2)) of [v v])\n    Go To Point (sx) (y) (((x) - (sx)) + ((item ((r) + ((d) + (1))) of [v v]) * (w))) ((item ((r) + ((d) + (2))) of [v v]) * (h)) (rx) (ry)\n    if <(item ((r) + (d)) of [v v]) = [0]> then\n        set pen size to (t)\n        pen down\n        pen up\n    else\n        set pen size to (1)\n        pen down\n        set pen size to (t)\n        repeat (item ((r) + (d)) of [v v])\n            change [d v] by (2)\n            Go To Point (sx) (y) (((x) - (sx)) + ((item ((r) + ((d) + (1))) of [v v]) * (w))) ((item ((r) + ((d) + (2))) of [v v]) * (h)) (rx) (ry)\n        end\n        pen up\n    end\n    change [d v] by (3)\nend\nchange [p v] by ((w) * ((item ((r) + (1)) of [v v]) + (sp)))\n\ndefine Draw String (s) at (x) (y) Align (a) FitW (w) FitH (h) PenSize (t) Space (p)\nset [o v] to [0]\nset [a v] to [1]\nrepeat (length of (s))\n    Get Char Ptr (letter (a) of (s))\n    change [o v] by (item ((b) + (1)) of [v v])\n    change [a v] by (1)\nend\nset [n v] to (((p) * (o)) / ((length of (s)) - (1)))\nchange [o v] by ((p) * (o))\nif <(w) = [0]> then\n    set [m v] to (((h) - (t)) / (8))\n    set [l v] to (((h) - (t)) / (8))\nelse\n    if <(h) = [0]> then\n        set [m v] to (((w) - (t)) / (o))\n        set [l v] to (((w) - (t)) / (o))\n    else\n        set [m v] to (((w) - (t)) / (o))\n        set [l v] to (((h) - (t)) / (8))\n    end\nend\nset [k v] to (x)\nif <(a) = [L]> then\n    set [p v] to ((x) + ((t) / (2)))\nelse\n    if <(a) = [C]> then\n        set [p v] to ((x) - (((o) * (m)) / (2)))\n    else\n        set [p v] to ((x) - (((o) * (m)) + ((t) / (2))))\n    end\nend\nset [q v] to (y)\nINT Draw String (s) W (m) H (l) PS (t) SW (n) rotX (i) rotY (j) startX (k)\n\nwhen flag clicked\nforever\n    wait (1) seconds\n    set [f v] to (g)\n    set [g v] to [0]\nend\n\ndefine Draw Line (x1) (y1) (x2) (y2)\nset pen color to (join [0x] [0])\nset pen size to (1)\ngo to x: (x1) y: (y1)\npen down\ngo to x: (x2) y: (y2)\npen up\n\ndefine Draw Box (x1) (y1) (x2) (y2)\nset pen color to (join [0x] [0])\nset pen size to (1)\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)\npen up\n\ndefine INT Draw String (s) W (w) H (h) PS (t) SW (sp) rotX (rx) rotY (ry) startX (sx)\nif <(h) = [0]> then\n    set [a v] to [1]\n    repeat (length of (s))\n        Get Char Ptr (letter (a) of (s))\n        INT Draw Norm Char (p) (q) (w) (h) (t) (sp) (b)\n        change [a v] by (1)\n    end\nelse\n    set [a v] to [1]\n    repeat (length of (s))\n        Get Char Ptr (letter (a) of (s))\n        INT Draw Rot Char (p) (q) (w) (h) (t) (sp) (rx) (ry) (sx) (b)\n        change [a v] by (1)\n    end\nend\n\ndefine Get Char Ptr (ch)\nif < [abcdefghijklmnopqrstuvwxyz] contains (ch)?> then\n    switch costume to (ch)\n    set [c v] to (costume [number v])\nelse\n    set [c v] to (item # of (ch) in [u v])\nend\nset [b v] to (item (c) of [z v])\n\ndefine Set Rotation (Angle) (an)\nset [i v] to ([cos v] of (an) )\nset [j v] to ([sin v] of (an) )\nset [h v] to [1]\n\ndefine Set Rotation (Vector) (x) (y)\nset [i v] to (x)\nset [j v] to (y)\nset [h v] to [1]\n\ndefine Go To Point (x) (y) (w) (h) (vx) (vy)\ngo to x: ((x) + (((w) * (vx)) - ((h) * (vy)))) y: ((y) + (((w) * (vy)) + ((h) * (vx))))\n\ndefine Reset Rotation\nSet Rotation (Angle) [0]\nset [h v] to [0]\n\ndefine INT Draw Norm Char (x) (y) (w) (h) (t) (sp) (r)\nset [d v] to [3]\nrepeat (item ((r) + (2)) of [v v])\n    go to x: (((item ((r) + ((d) + (1))) of [v v]) * (w)) + (x)) y: (((item ((r) + ((d) + (2))) of [v v]) * (h)) + (y))\n    if <(item ((r) + (d)) of [v v]) = [0]> then\n        set pen size to (t)\n        pen down\n        pen up\n    else\n        set pen size to (1)\n        pen down\n        set pen size to (t)\n        repeat (item ((r) + (d)) of [v v])\n            change [d v] by (2)\n            go to x: (((item ((r) + ((d) + (1))) of [v v]) * (w)) + (x)) y: (((item ((r) + ((d) + (2))) of [v v]) * (h)) + (y))\n        end\n        pen up\n    end\n    change [d v] by (3)\nend\nchange [p v] by ((w) * ((item ((r) + (1)) of [v v]) + (sp)))\n\nwhen I receive [tick v]\nset [touching grid button? v] to [0]\nset [touching load button? v] to [0]\nset [touching save button? v] to [0]\nset [touching back button? v] to [0]\nif <<(mouse x) > [-235]> and <<[-180] > (mouse x)> and <<(mouse y) > [145]> and <[175] > (mouse y)>>>> then\n    set pen color to (#efefef)\n    set [touching back button? v] to [1]\nelse\n    set pen color to (#e0e0e0)\nend\nDraw String [Undo] at (-232.5) (160) Align [L] FitW (50) FitH (0) PenSize (2) Space (0.3)\nif <<(mouse x) > [-30]> and <<[30] > (mouse x)> and <<(mouse y) > [145]> and <[175] > (mouse y)>>>> then\n    set pen color to (#efefef)\n    set [touching save button? v] to [1]\nelse\n    set pen color to (#e0e0e0)\nend\nDraw String [Save] at (0) (160) Align [C] FitW (50) FitH (0) PenSize (2) Space (0.3)\nif <<(mouse x) > [180]> and <<[235] > (mouse x)> and <<(mouse y) > [145]> and <[175] > (mouse y)>>>> then\n    set pen color to (#efefef)\n    set [touching load button? v] to [1]\nelse\n    set pen color to (#e0e0e0)\nend\nDraw String [Load] at (232.5) (160) Align [R] FitW (50) FitH (0) PenSize (2) Space (0.3)\nif <<(mouse x) > [-235]> and <<[-140] > (mouse x)> and <<[-145] > (mouse y)> and <(mouse y) > [-175]>>>> then\n    set pen color to (#efefef)\n    set [touching grid button? v] to [1]\nelse\n    set pen color to (#e0e0e0)\nend\nDraw String [Grid] at (-232.5) (-160) Align [L] FitW (50) FitH (0) PenSize (2) Space (0.3)\nDraw String [C - clear all] at (-140) (-154) Align [L] FitW (65) FitH (0) PenSize (1.6) Space (0.5)\nDraw String [Space - spectator mode] at (-140) (-167) Align [L] FitW (150) FitH (0) PenSize (1.6) Space (0.5)\nif <[touching? v] contains [5]?> then\n    set pen color to (#64cbff)\n    Draw String [You win] at (0) (100) Align [C] FitW (300) FitH (0) PenSize (10) Space (0.5)\n    set pen color to (#b164ff)\n    Draw String [r to restart or exit] at (80) (-120) Align [C] FitW (300) FitH (0) PenSize (2) Space (0.5)\nend\nchange [g v] by (1)\n\n@  \n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\n\n
- Pen Platformer + Editor -\n\n- Controls -\n- arrow keys or wasd to move\n- space for spectator mode\n- c to clear all\n- green - win\n- blue - checkpoint\n\n- post your save codes here: https://scratch.mit.edu/discuss/topic/434085/\n\n- Credits -\n- Pen Text Engine by @Java_Programmer\n\n- Save code(s) -\n\nby @greedjesse:\n48414100484341004446003846004000404100484341004046003846003900374641003738410038460038384600370048394100483737410040460038460038004837394100483839410044460038460037003841004838394100444600384600370048394100483839410040460038460039003738410048374341003846004446003800374241004838394100373846003846004000394641004837434100384600444600380039404100483743410044460038460037004040410048373741003846004446003800404441004837374100404600384600390041404100444100384600383846003700394041003841004046004046003700374441004441004246004246003700483941003742410040460040460037004041003844410042460038460039003746410040384100444600384600400048384141003846410042460042460037004840374100374441003740460040460038004840454100384641004246004246003700484141410038444100404600374046003800484239410038444100424600384600400048424341003844410038460038460037004843394100384441004046004046003700484437410038444100424600424600370048444341003844410040460040460037004845374100384441003846003846003700484345410039444100384600384600410038464100404441003846004446003800384241004044410044460038460038003846410039444100374046003846003700394241004046410038460040460038004046410039444100444600384600370041464100394441004246003846003900414441003944410044460038460037004138410041464100384600384600410044464100444100404600404600370044424100424100384600384600370045464100424100384600384600370045404100424100384600384600370037404100484341004046003846003900\n\nby @MoltenLeaf\n4841410048434100444600384600400040410048414100373846003846003700384041004100374046004446003700384041004100374046004600370038404100404100384600404600370038404100384100460046003700383841004041003846003738460037003744410040410040460037464600370040410048394100384600384600370038464100384641003744460037384600370039464100444100444600404600370048434100384641003842460037464600370048373941003746410038384600424600370044410037464100404600424600370037384100444100384600384600370044410048394100384600384600370042384100410037404600444600370039444100484141003840460038460037004046410041004600424600370042384100404100384600404600370042384100424100384600384600370042464100424100384600444600370040384100410046004246003700424641004441003846003846003700424641003842410038460037404600370042424100384241003846003742460037004238410038424100404600384600370043464100374441003846003740460037004346410038424100384600424600370043404100384241003846003744460037004340410041003846004600370043404100424100384600384600370044424100410046003846003700454241004100460038460037003746424100410046003846003700373742410041004600384600370037383841004100374046003846004100444041003740410040460038460038004540410037404100404600384600380037464041003740410040460038460038003737404100374041004046003846003800373838410044410046004446003700373846410040410038460042460037003738384100444100394646004600370037384241004041003946460046003700374138410037404100460042460037003741424100374441004600374046003700373838410037444100394046004600370037404241003744410046004246003700374038410037384100460040460037003739444100374441004600424600370037394041003738410046004046003700373946410037444100460042460037003738424100373841004600404600370037383841003744410046004246003700\n\nSorry, due to character restrictions, I cannot add other people’s save codes here.\n\n#platformer #pen #editor #games #contest