Pixel || A scrolling platformer editor #games

Instructions:                       ⛔NO ADVERTISING⛔\n             PLEASE NOTE THAT IF YOU USE THE \n                     WRONG CODE IT WILL LAG           \n                               >Instructions<\n                        Click to place blocks\n                  Number keys to select blocks\n                  Press save to get a save code\n                      Press load to load a level\n                     Press play to play your level\n                                 >Credits<\n@StratfordJames and @TimMcCool for inspiration and some code\n@griffpatch for scrolling\n@xamuil2 for the pixel art tutorial\n@-xaf- for the music\n@XShrunk for the contest\n                    

@Stage\n\nwhen flag clicked\nset [i v] to [0]\ndelete all of [re-decode v]\nrepeat (length of [\[0\]\[0\]\[g\]\[1\]\[0\]\[32\]\[c\]\[2\]\[32\]\[0\]\[g\]\[1\]\[64\]\[0\]\[g\]\[1\]\[96\]\[0\]\[g\]\[1\]\[128\]\[0\]\[g\]\[1\]\[160\]\[0\]\[g\]\[1\]\[192\]\[32\]\[g\]\[2\]\[192\]\[64\]\[g\]\[2\]\[192\]\[96\]\[g\]\[2\]\[192\]\[128\]\[g\]\[2\]\[192\]\[160\]\[g\]\[2\]\[192\]\[192\]\[g\]\[2\]\[192\]\[224\]\[g\]\[2\]\[192\]\[256\]\[g\]\[1\]\[736\]\[-160\]\[t\]\[2\]\[224\]\[32\]\[l\]\[1\]\[288\]\[32\]\[l\]\[1\]\[352\]\[32\]\[l\]\[1\]\[384\]\[32\]\[l\]\[1\]\[416\]\[32\]\[l\]\[1\]\[448\]\[32\]\[l\]\[1\]\[480\]\[32\]\[l\]\[1\]\[256\]\[32\]\[l\]\[1\]\[576\]\[32\]\[l\]\[1\]\[608\]\[32\]\[l\]\[1\]\[640\]\[32\]\[l\]\[1\]\[672\]\[32\]\[l\]\[1\]\[512\]\[256\]\[g\]\[1\]\[352\]\[256\]\[g\]\[1\]\[512\]\[32\]\[l\]\[1\]\[768\]\[0\]\[g\]\[2\]\[768\]\[32\]\[g\]\[2\]\[864\]\[32\]\[g\]\[2\]\[864\]\[64\]\[g\]\[2\]\[864\]\[96\]\[g\]\[2\]\[768\]\[64\]\[g\]\[1\]\[800\]\[64\]\[g\]\[1\]\[832\]\[64\]\[g\]\[1\]\[896\]\[64\]\[g\]\[1\]\[928\]\[64\]\[g\]\[1\]\[960\]\[64\]\[w\]\[1\]\[992\]\[64\]\[w\]\[1\]\[1024\]\[64\]\[w\]\[1\]\[864\]\[192\]\[g\]\[1\]\[864\]\[160\]\[g\]\[2\]\[864\]\[128\]\[g\]\[2\]\[1056\]\[64\]\[g\]\[1\]\[1088\]\[64\]\[g\]\[1\]\[1280\]\[64\]\[g\]\[1\]\[1312\]\[64\]\[g\]\[1\]\[1344\]\[64\]\[g\]\[1\]\[1376\]\[64\]\[g\]\[1\]\[1408\]\[64\]\[g\]\[1\]\[1440\]\[64\]\[g\]\[1\]\[1472\]\[64\]\[g\]\[1\]\[1504\]\[64\]\[g\]\[1\]\[1536\]\[64\]\[g\]\[1\]\[1568\]\[64\]\[g\]\[1\]\[1600\]\[64\]\[g\]\[1\]\[1632\]\[64\]\[s\]\[1\]\[1664\]\[64\]\[s\]\[1\]\[1728\]\[64\]\[s\]\[1\]\[1760\]\[64\]\[s\]\[1\]\[1792\]\[64\]\[s\]\[1\]\[1696\]\[64\]\[s\]\[1\]\[1824\]\[64\]\[s\]\[1\]\[1856\]\[64\]\[s\]\[1\]\[1888\]\[64\]\[s\]\[1\]\[1920\]\[64\]\[s\]\[1\]\[1952\]\[64\]\[s\]\[1\]\[1984\]\[64\]\[s\]\[1\]\[2016\]\[64\]\[s\]\[1\]\[2048\]\[64\]\[s\]\[1\]\[640\]\[-160\]\[l\]\[1\]\[672\]\[-160\]\[l\]\[1\]\[704\]\[-160\]\[l\]\[1\]\[1344\]\[-160\]\[g\]\[1\]\[1472\]\[-160\]\[g\]\[1\]\[1600\]\[-160\]\[g\]\[1\]\[1728\]\[-160\]\[g\]\[1\]\[320\]\[-128\]\[s\]\[1\]\[544\]\[-160\]\[t\]\[1\]\[576\]\[-160\]\[s\]\[1\]\[608\]\[-160\]\[g\]\[1\]\[1056\]\[-160\]\[t\]\[1\]\[1088\]\[-160\]\[s\]\[1\]\[1120\]\[-160\]\[s\]\[1\]\[1152\]\[-160\]\[s\]\[1\]\[1184\]\[-160\]\[t\]\[1\]\[1120\]\[64\]\[g\]\[1\]\[1152\]\[96\]\[g\]\[1\]\[1184\]\[128\]\[g\]\[1\]\[1216\]\[160\]\[g\]\[1\]\[1248\]\[192\]\[g\]\[1\]\[1280\]\[224\]\[g\]\[1\]\[1312\]\[256\]\[g\]\[1\]\[1344\]\[288\]\[g\]\[1\]\[1376\]\[320\]\[g\]\[1\]\[1408\]\[352\]\[g\]\[1\]\[1440\]\[384\]\[g\]\[1\]\[1472\]\[416\]\[g\]\[1\]\[1504\]\[448\]\[g\]\[1\]\[1536\]\[480\]\[g\]\[1\]\[1568\]\[512\]\[g\]\[1\]\[1600\]\[544\]\[g\]\[1\]\[1632\]\[576\]\[g\]\[1\]\[1664\]\[608\]\[g\]\[1\]\[1856\]\[-160\]\[g\]\[1\]\[1856\]\[-128\]\[e\]\[1\]])\n    change [i v] by (1)\n    add (letter (i) of [\[0\]\[0\]\[g\]\[1\]\[0\]\[32\]\[c\]\[2\]\[32\]\[0\]\[g\]\[1\]\[64\]\[0\]\[g\]\[1\]\[96\]\[0\]\[g\]\[1\]\[128\]\[0\]\[g\]\[1\]\[160\]\[0\]\[g\]\[1\]\[192\]\[32\]\[g\]\[2\]\[192\]\[64\]\[g\]\[2\]\[192\]\[96\]\[g\]\[2\]\[192\]\[128\]\[g\]\[2\]\[192\]\[160\]\[g\]\[2\]\[192\]\[192\]\[g\]\[2\]\[192\]\[224\]\[g\]\[2\]\[192\]\[256\]\[g\]\[1\]\[736\]\[-160\]\[t\]\[2\]\[224\]\[32\]\[l\]\[1\]\[288\]\[32\]\[l\]\[1\]\[352\]\[32\]\[l\]\[1\]\[384\]\[32\]\[l\]\[1\]\[416\]\[32\]\[l\]\[1\]\[448\]\[32\]\[l\]\[1\]\[480\]\[32\]\[l\]\[1\]\[256\]\[32\]\[l\]\[1\]\[576\]\[32\]\[l\]\[1\]\[608\]\[32\]\[l\]\[1\]\[640\]\[32\]\[l\]\[1\]\[672\]\[32\]\[l\]\[1\]\[512\]\[256\]\[g\]\[1\]\[352\]\[256\]\[g\]\[1\]\[512\]\[32\]\[l\]\[1\]\[768\]\[0\]\[g\]\[2\]\[768\]\[32\]\[g\]\[2\]\[864\]\[32\]\[g\]\[2\]\[864\]\[64\]\[g\]\[2\]\[864\]\[96\]\[g\]\[2\]\[768\]\[64\]\[g\]\[1\]\[800\]\[64\]\[g\]\[1\]\[832\]\[64\]\[g\]\[1\]\[896\]\[64\]\[g\]\[1\]\[928\]\[64\]\[g\]\[1\]\[960\]\[64\]\[w\]\[1\]\[992\]\[64\]\[w\]\[1\]\[1024\]\[64\]\[w\]\[1\]\[864\]\[192\]\[g\]\[1\]\[864\]\[160\]\[g\]\[2\]\[864\]\[128\]\[g\]\[2\]\[1056\]\[64\]\[g\]\[1\]\[1088\]\[64\]\[g\]\[1\]\[1280\]\[64\]\[g\]\[1\]\[1312\]\[64\]\[g\]\[1\]\[1344\]\[64\]\[g\]\[1\]\[1376\]\[64\]\[g\]\[1\]\[1408\]\[64\]\[g\]\[1\]\[1440\]\[64\]\[g\]\[1\]\[1472\]\[64\]\[g\]\[1\]\[1504\]\[64\]\[g\]\[1\]\[1536\]\[64\]\[g\]\[1\]\[1568\]\[64\]\[g\]\[1\]\[1600\]\[64\]\[g\]\[1\]\[1632\]\[64\]\[s\]\[1\]\[1664\]\[64\]\[s\]\[1\]\[1728\]\[64\]\[s\]\[1\]\[1760\]\[64\]\[s\]\[1\]\[1792\]\[64\]\[s\]\[1\]\[1696\]\[64\]\[s\]\[1\]\[1824\]\[64\]\[s\]\[1\]\[1856\]\[64\]\[s\]\[1\]\[1888\]\[64\]\[s\]\[1\]\[1920\]\[64\]\[s\]\[1\]\[1952\]\[64\]\[s\]\[1\]\[1984\]\[64\]\[s\]\[1\]\[2016\]\[64\]\[s\]\[1\]\[2048\]\[64\]\[s\]\[1\]\[640\]\[-160\]\[l\]\[1\]\[672\]\[-160\]\[l\]\[1\]\[704\]\[-160\]\[l\]\[1\]\[1344\]\[-160\]\[g\]\[1\]\[1472\]\[-160\]\[g\]\[1\]\[1600\]\[-160\]\[g\]\[1\]\[1728\]\[-160\]\[g\]\[1\]\[320\]\[-128\]\[s\]\[1\]\[544\]\[-160\]\[t\]\[1\]\[576\]\[-160\]\[s\]\[1\]\[608\]\[-160\]\[g\]\[1\]\[1056\]\[-160\]\[t\]\[1\]\[1088\]\[-160\]\[s\]\[1\]\[1120\]\[-160\]\[s\]\[1\]\[1152\]\[-160\]\[s\]\[1\]\[1184\]\[-160\]\[t\]\[1\]\[1120\]\[64\]\[g\]\[1\]\[1152\]\[96\]\[g\]\[1\]\[1184\]\[128\]\[g\]\[1\]\[1216\]\[160\]\[g\]\[1\]\[1248\]\[192\]\[g\]\[1\]\[1280\]\[224\]\[g\]\[1\]\[1312\]\[256\]\[g\]\[1\]\[1344\]\[288\]\[g\]\[1\]\[1376\]\[320\]\[g\]\[1\]\[1408\]\[352\]\[g\]\[1\]\[1440\]\[384\]\[g\]\[1\]\[1472\]\[416\]\[g\]\[1\]\[1504\]\[448\]\[g\]\[1\]\[1536\]\[480\]\[g\]\[1\]\[1568\]\[512\]\[g\]\[1\]\[1600\]\[544\]\[g\]\[1\]\[1632\]\[576\]\[g\]\[1\]\[1664\]\[608\]\[g\]\[1\]\[1856\]\[-160\]\[g\]\[1\]\[1856\]\[-128\]\[e\]\[1\]]) to [re-decode v]\nend\nset [i v] to [0]\nrepeat (length of [re-decode v])\n    change [i v] by (1)\n    if <(item (i) of [re-decode v]) = [\[]> then\n        replace item (i) of [re-decode v] with [{]\n    end\n    if <(item (i) of [re-decode v]) = [\]]> then\n        replace item (i) of [re-decode v] with [}]\n    end\nend\nset [i v] to [0]\nset [string v] to []\nrepeat (length of [re-decode v])\n    change [i v] by (1)\n    set [string v] to (join (string) (item (i) of [re-decode v]))\nend\ndelete all of [re-decode v]\nadd (string) to [re-decode v]\n\nwhen flag clicked\nerase all\nforever\n    play sound [Treenan v] until done\n    play sound [Music v] until done\nend\n\nwhen flag clicked\nset [☁ c v] to [0]\n\n@Blank\n\n@Blocks\n\nwhen I receive [editor v]\nforever\n    erase all\n    broadcast (tick v)\nend\n\ndefine block (x) (y)\nswitch costume to (blank v)\ngo to ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nset costume (item (~c1) of [block v]) (item (~c1) of [type v])\nclear graphic effects\nif <not <<([abs v] of ((x) - (SCROLL X)) ) > [260]> or <([abs v] of ((y) - (SCROLL Y)) ) > [200]>>> then\n    stamp\nend\n\nwhen I receive [tick v]\nif <(MODE) = [editor]> then\n    render blocks\n    mouse (SELECTED BLOCK)\n    change [scroll x v] by ((<<key (right arrow v) pressed?> or <key (d v) pressed?>> - <<key (left arrow v) pressed?> or <key (a v) pressed?>>) * (5))\n    change [scroll y v] by ((<<key (up arrow v) pressed?> or <key (w v) pressed?>> - <<key (down arrow v) pressed?> or <key (s v) pressed?>>) * (5))\nelse\n    render blocks\nend\nif <(SCROLL Y) < [-31]> then\n    set [scroll y v] to [-30]\nend\n\ndefine go to (x) (y)\nset [~scale v] to [32]\ngo to x: (x) y: (y)\n\ndefine mouse (type)\nif <(SELECTED BLOCK) = [g]> then\n    switch costume to (g1 v)\nelse\n    if <(SELECTED BLOCK) = [l]> then\n        if <((round ((timer) / (0.2))) / (2)) = ([floor v] of ((round ((timer) / (0.2))) / (2)) )> then\n            switch costume to (l1 v)\n        else\n            switch costume to (l2 v)\n        end\n    else\n        if <(SELECTED BLOCK) = [w]> then\n            if <((round ((timer) / (0.2))) / (2)) = ([floor v] of ((round ((timer) / (0.2))) / (2)) )> then\n                switch costume to (w1 v)\n            else\n                switch costume to (w2 v)\n            end\n        else\n            if <(SELECTED BLOCK) = [t]> then\n                switch costume to (t1 v)\n            else\n                if <(SELECTED BLOCK) = [s]> then\n                    switch costume to (s1 v)\n                else\n                    if <(SELECTED BLOCK) = [c]> then\n                        switch costume to (c1 v)\n                    else\n                        if <(SELECTED BLOCK) = [e]> then\n                            switch costume to (e1 v)\n                        else\n                            switch costume to (v1 v)\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nif <(type) = [erase]> then\n    switch costume to (erase v)\n    go to (((round (((mouse x) + (SCROLL X)) / (~scale))) * (~scale)) - (SCROLL X)) (((round (((mouse y) + (SCROLL Y)) / (~scale))) * (~scale)) - (SCROLL Y))\n    if <mouse down?> then\n        remove block ((round (((mouse x) + (SCROLL X)) / (~scale))) * (~scale)) ((round (((mouse y) + (SCROLL Y)) / (~scale))) * (~scale))\n    end\n    set [ghost v] effect to (70)\n    stamp\nelse\n    hide\n    go to (((round (((mouse x) + (SCROLL X)) / (~scale))) * (~scale)) - (SCROLL X)) (((round (((mouse y) + (SCROLL Y)) / (~scale))) * (~scale)) - (SCROLL Y))\n    test block ((round (((mouse x) + (SCROLL X)) / (~scale))) * (~scale)) ((round (((mouse y) + (SCROLL Y)) / (~scale))) * (~scale))\n    if <not <<(~is a block) = [true]> or <<(SELECTED BLOCK) = [e]> and <(endflag placed) = [true]>>>> then\n        if <mouse down?> then\n            add block ((round (((mouse x) + (SCROLL X)) / (~scale))) * (~scale)) ((round (((mouse y) + (SCROLL Y)) / (~scale))) * (~scale))\n        end\n        set [ghost v] effect to (50)\n        stamp\n    end\nend\n\nwhen I receive [new level v]\npoint in direction (90)\nset [mode v] to [editor]\nset [~offset v] to [0]\ndelete all of [x v]\ndelete all of [y v]\ndelete all of [block v]\ndelete all of [type v]\ndelete all of [checkpoints v]\nadd [2] to [checkpoints v]\nadd [0] to [x v]\nadd [0] to [y v]\nadd [g] to [block v]\nadd [1] to [type v]\nadd [0] to [x v]\nadd (~scale) to [y v]\nadd [c] to [block v]\nadd [2] to [type v]\nshow list [code v]\nset [selected block v] to [g]\nset [selected # v] to [1]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset [ask v] to [false]\nhide\n\ndefine render blocks\nset [~c1 v] to [0]\nrepeat (length of [block v])\n    change [~c1 v] by (1)\n    block (item (~c1) of [x v]) (item (~c1) of [y v])\n    if <(item (~c1) of [block v]) = [e]> then\n        set [endflag placed v] to [true]\n    else\n        set [endflag placed v] to [false]\n    end\nend\n\ndefine add block (x) (y)\nif <<(PLACE BLOCK) = [true]> and <(ASK) = [false]>> then\n    add (x) to [x v]\n    add (y) to [y v]\n    add [1] to [type v]\n    add (SELECTED BLOCK) to [block v]\n    replace costume (length of [block v]) (SELECTED BLOCK)\nend\n\nwhen flag clicked\nset [move? v] to [true]\nbroadcast (new level v) and wait\nbroadcast (editor v)\n\ndefine test block (x) (y)\nset [~is a block v] to [false]\nset [~c3 v] to [0]\nrepeat (length of [block v])\n    change [~c3 v] by (1)\n    if <<(item (~c3) of [x v]) = (x)> and <(item (~c3) of [y v]) = (y)>> then\n        set [~is a block v] to [true]\n        stop [this script v]\n    end\nend\n\ndefine replace costume (type) (block)\nif <(block) = [g]> then\n    set [~c3 v] to [0]\n    repeat (length of [block v])\n        change [~c3 v] by (1)\n        if <<(item (~c3) of [x v]) = (item (type) of [x v])> and <(item (~c3) of [y v]) = ((item (type) of [y v]) - (~scale))>> then\n            if <not <<(item (~c3) of [block v]) = [l]> or <(item (~c3) of [block v]) = [w]>>> then\n                replace item (~c3) of [type v] with [2]\n            else\n                replace item (~c3) of [type v] with [3]\n            end\n        end\n    end\n    set [~c3 v] to [0]\n    repeat (length of [block v])\n        change [~c3 v] by (1)\n        if <<<(item (~c3) of [x v]) = (item (type) of [x v])> and <(item (~c3) of [y v]) = ((item (type) of [y v]) + (~scale))>> and <not < [tscve] contains (item (~c3) of [block v])?>>> then\n            replace item (type) of [type v] with [2]\n        end\n    end\nelse\n    if <(block) = [l]> then\n        set [~c3 v] to [0]\n        repeat (length of [block v])\n            change [~c3 v] by (1)\n            if <<<(item (~c3) of [x v]) = (item (type) of [x v])> and <(item (~c3) of [y v]) = ((item (type) of [y v]) - (~scale))>> and > then\n                if <<(item (~c3) of [block v]) = [l]> or <(item (~c3) of [block v]) = [w]>> then\n                    replace item (~c3) of [type v] with [3]\n                else\n                    replace item (~c3) of [type v] with [2]\n                end\n            end\n        end\n        set [~c3 v] to [0]\n        repeat (length of [block v])\n            change [~c3 v] by (1)\n            if <<(item (~c3) of [x v]) = (item (type) of [x v])> and <(item (~c3) of [y v]) = ((item (type) of [y v]) + (~scale))>> then\n                replace item (type) of [type v] with [3]\n            end\n        end\n    else\n        if <(block) = [w]> then\n            set [~c3 v] to [0]\n            repeat (length of [block v])\n                change [~c3 v] by (1)\n                if <<<(item (~c3) of [x v]) = (item (type) of [x v])> and <(item (~c3) of [y v]) = ((item (type) of [y v]) - (~scale))>> and > then\n                    if <<(item (~c3) of [block v]) = [w]> or <(item (~c3) of [block v]) = [l]>> then\n                        replace item (~c3) of [type v] with [3]\n                    else\n                        replace item (~c3) of [type v] with [2]\n                    end\n                end\n            end\n            set [~c3 v] to [0]\n            repeat (length of [block v])\n                change [~c3 v] by (1)\n                if <<(item (~c3) of [x v]) = (item (type) of [x v])> and <(item (~c3) of [y v]) = ((item (type) of [y v]) + (~scale))>> then\n                    replace item (type) of [type v] with [3]\n                end\n            end\n        end\n    end\nend\n\nwhen [1 v] key pressed\nset [selected block v] to [g]\nset [selected # v] to [1]\n\nwhen [2 v] key pressed\nset [selected block v] to [l]\nset [selected # v] to [2]\n\nwhen [3 v] key pressed\nset [selected block v] to [w]\nset [selected # v] to [3]\n\nwhen [4 v] key pressed\nset [selected block v] to [t]\nset [selected # v] to [4]\n\nwhen [5 v] key pressed\nset [selected block v] to [s]\nset [selected # v] to [5]\n\ndefine set costume (block) (type)\nif <(block) = [g]> then\n    switch costume to (join (block) (type))\nelse\n    if <<(block) = [l]> or <(block) = [w]>> then\n        if <(type) = [3]> then\n            switch costume to (join (block) (type))\n        else\n            if <((round ((timer) / (0.2))) / (2)) = ([floor v] of ((round ((timer) / (0.2))) / (2)) )> then\n                switch costume to (join (block) (type))\n            else\n                switch costume to (join (block) ((type) + (1)))\n            end\n        end\n    else\n        if <(block) = [t]> then\n            switch costume to (t1 v)\n        else\n            if <(block) = [s]> then\n                switch costume to (s1 v)\n            else\n                if <(block) = [c]> then\n                    if <<(~c1) = (spawnpoint)> and <(MODE) = [game]>> then\n                        switch costume to (c2 v)\n                    else\n                        switch costume to (c1 v)\n                    end\n                else\n                    if <(block) = [e]> then\n                        switch costume to (e1 v)\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen [6 v] key pressed\nset [selected block v] to [c]\nset [selected # v] to [6]\n\nwhen [7 v] key pressed\nset [selected block v] to [e]\nset [selected # v] to [7]\n\nwhen [8 v] key pressed\nset [selected block v] to [erase]\nset [selected # v] to [8]\n\ndefine remove block (x) (y)\nset [~c4 v] to [0]\nrepeat until <<(~c4) > (length of [block v])> or <<(item (~c4) of [x v]) = (x)> and <(item (~c4) of [y v]) = (y)>>>\n    change [~c4 v] by (1)\nend\nif <not <<(~c4) = [1]> or <(~c4) = [2]>>> then\n    if <<(item (~c4) of [x v]) = (x)> and <(item (~c4) of [y v]) = (y)>> then\n        delete (~c4) of [x v]\n        delete (~c4) of [y v]\n        delete (~c4) of [block v]\n        delete (~c4) of [checkpoints v]\n        delete (~c4) of [type v]\n    end\n    set [~c4 v] to [0]\n    repeat (length of [block v])\n        change [~c4 v] by (1)\n        if <<<(item (~c4) of [x v]) = (x)> and <(item (~c4) of [y v]) = ((y) - (~scale))>> and <not < [tsce] contains (item (~c4) of [block v])?>>> then\n            replace item (~c4) of [type v] with [1]\n        end\n    end\nend\n\nwhen I receive [reset v]\nbroadcast (new level v) and wait\n\ndefine save level\ndelete all of [save v]\ndelete all of [code v]\nset [~i1 v] to [0]\nrepeat (length of [block v])\n    change [~i1 v] by (1)\n    add [{] to [save v]\n    add (item (~i1) of [x v]) to [save v]\n    add [}] to [save v]\n    add [{] to [save v]\n    add (item (~i1) of [y v]) to [save v]\n    add [}] to [save v]\n    add [{] to [save v]\n    add (item (~i1) of [block v]) to [save v]\n    add [}] to [save v]\n    add [{] to [save v]\n    add (item (~i1) of [type v]) to [save v]\n    add [}] to [save v]\nend\nset [~i1 v] to [0]\nset [~val v] to []\nrepeat (length of [save v])\n    change [~i1 v] by (1)\n    set [~val v] to (join (~val) (item (~i1) of [save v]))\nend\nadd (~val) to [code v]\nadd [triple click and do ctrl + c to copy your code] to [code v]\nhide list [code v]\nset [ask v] to [true]\nask [copy your code here to make sure you have the whole thing: ] and wait\nif <(answer) = (item (1) of [code v])> then\nset [ask v] to [false]\nshow list [code v]\n\nwhen I receive [save level v]\nsave level\n\ndefine load (code)\ndelete all of [x v]\ndelete all of [y v]\ndelete all of [block v]\ndelete all of [type v]\nset [~i1 v] to [2]\nrepeat until <(~i1) > (length of (code))>\n    set [~val v] to []\n    repeat until <(letter (~i1) of (code)) = [}]>\n        set [~val v] to (join (~val) (letter (~i1) of (code)))\n        change [~i1 v] by (1)\n    end\n    add (~val) to [x v]\n    set [~val v] to []\n    change [~i1 v] by (2)\n    repeat until <(letter (~i1) of (code)) = [}]>\n        set [~val v] to (join (~val) (letter (~i1) of (code)))\n        change [~i1 v] by (1)\n    end\n    add (~val) to [y v]\n    set [~val v] to []\n    change [~i1 v] by (2)\n    repeat until <(letter (~i1) of (code)) = [}]>\n        set [~val v] to (join (~val) (letter (~i1) of (code)))\n        change [~i1 v] by (1)\n    end\n    add (~val) to [block v]\n    set [~val v] to []\n    change [~i1 v] by (2)\n    repeat until <(letter (~i1) of (code)) = [}]>\n        set [~val v] to (join (~val) (letter (~i1) of (code)))\n        change [~i1 v] by (1)\n    end\n    add (~val) to [type v]\n    change [~i1 v] by (2)\nend\n\nwhen I receive [load level v]\nset [ask v] to [true]\nask [Code:] and wait\nif <not <(answer) = []>> then\n    load (answer)\nend\nset [ask v] to [false]\n\nwhen I receive [win v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [tn v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [editor v]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\n\n@player\n\nwhen I receive [play v]\nset [spawnpoint v] to [2]\nforever\n    go to x: (0) y: (4)\n    Game On\n    repeat until <<(EXIT) > []> or <(MODE) = [editor]>>\n        Tick\n    end\nend\n\ndefine Game On\ngo to x: (0) y: (4)\nset rotation style [left-right v]\nset [scroll x v] to (item (spawnpoint) of [x v])\nset [scroll y v] to (item (spawnpoint) of [y v])\nset [x v] to (item (spawnpoint) of [x v])\nset [y v] to ((item (spawnpoint) of [y v]) + (0))\nset [sy v] to [0]\nset [sx v] to [0]\nset [in air v] to [0]\nset [exit v] to []\npoint in direction (90)\nclear graphic effects\nset size to (300) %\nshow\n\ndefine Tick\nshow\ngo to [back v] layer\nif <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n    if <[collisions v] contains [w]?> then\n        change [sx v] by (-2)\n    else\n        change [sx v] by (-1.5)\n    end\n    point in direction (-90)\nend\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    if <[collisions v] contains [w]?> then\n        change [sx v] by (2)\n    else\n        change [sx v] by (1.5)\n    end\n    point in direction (90)\nend\nset [sx v] to ((sx) * (0.8))\nif <([abs v] of (sx) ) > [0.9]> then\n    change player x by (round (sx))\nend\nif <[collisions v] contains [w]?> then\n    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        set [sy v] to [6]\n    end\nelse\n    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        if <(in air) < [4]> then\n            set [sy v] to [14]\n        end\n    end\nend\nif <[collisions v] contains [t]?> then\n    set [sy v] to [25]\nend\nif <[collisions v] contains [w]?> then\n    change [sy v] by (-0.5)\nelse\n    change [sy v] by (-2)\nend\nChange player y by (sy)\nif <<[collisions v] contains [s]?> or <[collisions v] contains [l]?>> then\n    set [exit v] to [die]\nend\nset [scroll x v] to (x)\nchange [scroll y v] by (round (((y) - (SCROLL Y)) / (10)))\nposition\n\ndefine Change player y by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nposition\nrepeat until <not <[collisions v] contains [g]?>>\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    position\n    set [sy v] to [0]\nend\n\ndefine position\ngo to x: ((x) - (SCROLL X)) y: ((y) - (SCROLL Y))\ncollisions\nif <(SCROLL Y) < [-50]> then\n    set [exit v] to [die]\nend\nif <[collisions v] contains [c]?> then\n    set [spawnpoint v] to (item # of [c] in [collisions v])\n    set [move? v] to [false]\nend\nif <[collisions v] contains [e]?> then\n    broadcast (win v)\nend\n\ndefine change player x by (sx)\nchange [x v] by (sx)\nposition\nif <[collisions v] contains [g]?> then\n    repeat (8)\n        change [y v] by (1)\n        position\n        if <not <[collisions v] contains [g]?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-8)\n    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        if <(sx) > [0]> then\n            set [sx v] to [-16]\n        else\n            set [sx v] to [16]\n        end\n        set [in air v] to [0]\n    else\n        set [sx v] to [0]\n    end\n    repeat until <not <[collisions v] contains [g]?>>\n        if <(sx) > [0]> then\n            change [x v] by (-1)\n        else\n            change [x v] by (1)\n        end\n        position\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [editor v]\nstop [other scripts in sprite v]\nhide\n\ndefine collisions\ndelete all of [collisions v]\nset [~c1 v] to [0]\nrepeat (length of [block v])\n    add [0] to [collisions v]\n    change [~c1 v] by (1)\n    if <(item (~c1) of [block v]) = [l]> then\n        if <<<not <((item (~c1) of [x v]) - (-24)) < (x)>> and <((item (~c1) of [y v]) - (24)) < (y)>> and <<not <((item (~c1) of [y v]) - (-24)) < (y)>> and <((item (~c1) of [x v]) - (24)) < (x)>>> then\n            replace item (~c1) of [collisions v] with (item (~c1) of [block v])\n        end\n    else\n        if <(item (~c1) of [block v]) = [s]> then\n            if <<<not <((item (~c1) of [x v]) - (-24)) < (x)>> and <((item (~c1) of [y v]) - (20)) < (y)>> and <<not <((item (~c1) of [y v]) - (-27)) < (y)>> and <((item (~c1) of [x v]) - (24)) < (x)>>> then\n                replace item (~c1) of [collisions v] with (item (~c1) of [block v])\n            end\n        else\n            if <<(item (~c1) of [block v]) = [c]> or <(item (~c1) of [block v]) = [e]>> then\n                if <<<not <((item (~c1) of [x v]) - (-20)) < (x)>> and <((item (~c1) of [y v]) - (27)) < (y)>> and <<not <((item (~c1) of [y v]) - (-27)) < (y)>> and <((item (~c1) of [x v]) - (20)) < (x)>>> then\n                    replace item (~c1) of [collisions v] with (item (~c1) of [block v])\n                end\n            else\n                if <<<not <((item (~c1) of [x v]) - (-28)) < (x)>> and <((item (~c1) of [y v]) - (27)) < (y)>> and <<not <((item (~c1) of [y v]) - (-27)) < (y)>> and <((item (~c1) of [x v]) - (28)) < (x)>>> then\n                    replace item (~c1) of [collisions v] with (item (~c1) of [block v])\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [win v]\nstop [other scripts in sprite v]\n\nwhen I receive [tn v]\nhide\n\n@Border\n\nwhen I receive [tick v]\nset [place block v] to <not <touching (mouse-pointer v)?>>\ngo to [front v] layer\ngo [backward v] (14) layers\nif <(MODE) = [editor]> then\n    show\nelse\n    hide\nend\n\nwhen I receive [tn v]\nhide\n\nwhen I receive [win v]\nhide\n\n@Select block\n\ndefine setup clones\nset [~clone id v] to [0]\ngo to x: (-195) y: (-158)\nshow\nswitch costume to (g1 v)\nrepeat (8)\n    change [~clone id v] by (1)\n    create clone of (_myself_ v)\n    next costume\n    change x by (40)\nend\nhide\n\nwhen I start as a clone\nforever\n    if <(MOVE?) = [true]> then\n        if <(MODE) = [editor]> then\n            show\n            switch costume to (hb v)\n            if <touching (mouse-pointer v)?> then\n                clear graphic effects\n                if <mouse down?> then\n                    set [selected # v] to (~clone id)\n                    if <(~clone id) = [1]> then\n                        set [selected block v] to [g]\n                    else\n                        if <(~clone id) = [2]> then\n                            set [selected block v] to [l]\n                        else\n                            if <(~clone id) = [3]> then\n                                set [selected block v] to [w]\n                            else\n                                if <(~clone id) = [4]> then\n                                    set [selected block v] to [t]\n                                else\n                                    if <(~clone id) = [5]> then\n                                        set [selected block v] to [s]\n                                    else\n                                        if <(~clone id) = [6]> then\n                                            set [selected block v] to [c]\n                                        else\n                                            if <(~clone id) = [7]> then\n                                                set [selected block v] to [e]\n                                            else\n                                                if <(~clone id) = [8]> then\n                                                    set [selected block v] to [erase]\n                                                end\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            else\n                if <(~clone id) = (selected #)> then\n                    clear graphic effects\n                else\n                    set [ghost v] effect to (50)\n                end\n            end\n            if <(~clone id) = [1]> then\n                switch costume to (g1 v)\n            else\n                if <(~clone id) = [2]> then\n                    if <((round ((timer) / (0.2))) / (2)) = ([floor v] of ((round ((timer) / (0.2))) / (2)) )> then\n                        switch costume to (l1 v)\n                    else\n                        switch costume to (l2 v)\n                    end\n                else\n                    if <(~clone id) = [3]> then\n                        if <((round ((timer) / (0.2))) / (2)) = ([floor v] of ((round ((timer) / (0.2))) / (2)) )> then\n                            switch costume to (w1 v)\n                        else\n                            switch costume to (w2 v)\n                        end\n                    else\n                        if <(~clone id) = [4]> then\n                            switch costume to (t1 v)\n                        else\n                            if <(~clone id) = [5]> then\n                                switch costume to (s1 v)\n                            else\n                                if <(~clone id) = [6]> then\n                                    switch costume to (c1 v)\n                                else\n                                    if <(~clone id) = [7]> then\n                                        switch costume to (e1 v)\n                                        if <(endflag placed) = [true]> then\n                                            hide\n                                        else\n                                            show\n                                        end\n                                    else\n                                        if <(~clone id) = [8]> then\n                                            switch costume to (erase v)\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        else\n            hide\n        end\n    else\n        hide\n    end\nend\n\nwhen I receive [tick v]\ngo to [front v] layer\n\nwhen I receive [new level v]\nsetup clones\n\n@Buttons\n\nwhen I receive [tick v]\ngo to [front v] layer\n\nwhen I receive [new level v]\nsetup clones\n\ndefine setup clones\nshow\ngo to x: (-60) y: (160)\nswitch costume to (play v)\nrepeat (4)\n    create clone of (_myself_ v)\n    change x by (70)\n    next costume\nend\nhide\n\nwhen I start as a clone\nforever\n    if <(MOVE?) = [true]> then\n        if <(MODE) = [editor]> then\n            if <(costume [number v]) = [4]> then\n                hide\n            else\n                show\n                if <touching (mouse-pointer v)?> then\n                    set [brightness v] effect to (-10)\n                    if <mouse down?> then\n                        if <(costume [number v]) = [1]> then\n                            set [mode v] to [game]\n                            broadcast (play v)\n                        else\n                            if <(costume [number v]) = [2]> then\n                                broadcast (save level v)\n                                wait until <not <mouse down?>>\n                            else\n                                if <(costume [number v]) = [3]> then\n                                    broadcast (load level v)\n                                    wait until <not <mouse down?>>\n                                end\n                            end\n                        end\n                    end\n                else\n                    clear graphic effects\n                end\n            end\n        else\n            if <(costume [number v]) = [4]> then\n                go to x: (-207) y: (160)\n                show\n                if <touching (mouse-pointer v)?> then\n                    set [brightness v] effect to (-10)\n                    if <mouse down?> then\n                        set [mode v] to [editor]\n                        set [move? v] to [true]\n                        broadcast (editor v)\n                    end\n                else\n                    clear graphic effects\n                end\n            else\n                hide\n            end\n        end\n    else\n        if <(costume [number v]) = [4]> then\n            go to x: (-207) y: (160)\n            show\n            if <touching (mouse-pointer v)?> then\n                set [brightness v] effect to (-10)\n                if <mouse down?> then\n                    set [mode v] to [editor]\n                    set [move? v] to [true]\n                    broadcast (editor v)\n                end\n            else\n                clear graphic effects\n            end\n        else\n            hide\n        end\n    end\nend\n\nwhen I receive [reset v]\ndelete this clone\n\n@TN\n\nwhen flag clicked\nhide\nforever\n    set [~timer v] to ((timer) + (0.0000000000000001))\nend\n\nwhen [timer v] > (~timer)\nshow\nbroadcast (TN v)\nerase all\ngo to [front v] layer\nstop [all v]\n\n@win\n\nwhen I receive [win v]\nshow\nset [ghost v] effect to (30)\ngo to [front v] layer\n\nwhen flag clicked\nhide\n\nwhen I receive [editor v]\nhide\n\nwhen I receive [tn v]\nhide\n\n