Platformer Builder

Instructions: [ PLEASE read ALL these instructions to know how to use this project! It will be very confusing if you don't. ]\n\nClick anywhere to place a block.\n\nUse A and D to switch block type.\n\nBlock types:\nBlue=Physical Block\nRed=Hazard - Respawns You\nGreen=End of Level\nYellow=Jump Boost\n\n[To save a level:]\n\nStep 1: Press Space.\n\nStep 2: Move your mouse to where you want the player to start, then press space again.\n\nStep 3: Wait for all the blocks to be filled. It will take a while.\n\nStep 4: Select the numbers that pop up (Double click) and press ctrl+c\n\nYou now have a level code! You can paste it in the comments with ctrl+v for other people to play if you'd like.\n\n[How to play a level]\n\nSo let's say you've just copied a level code that you want to play. It could be one from the comments, or your own.\n\nStep 1: Press L, then select the text bar down below.\n\nStep 2: Press ctrl+v and then enter.\n\nNow you can play it! Use the arrow keys to control the player.\n\nIf you'd like to play a level that has not been saved yet, press P and the player will spawn in the middle of the level.\n\nTo edit a previously saved level, you can press K to load a level to edit.\n\nThat's it! Have fun building, sharing, and playing levels!

@Stage\n\nwhen I receive [message7 v]\nswitch backdrop to (letter (288) of (GeneratedCode))\n\nwhen flag clicked\nswitch backdrop to (1 v)\n\n@Sprite1\n\nwhen flag clicked\npoint in direction (90)\nshow list [generatedcode v]\nset [clonenumber v] to [1]\ngo to x: (-227) y: (155)\nhide\nrepeat (20)\n    set [clonetype v] to [1]\n    create clone of (_myself_ v)\n    change x by (24)\n    change [clonenumber v] by (1)\nend\ngo to x: (0) y: (0)\n\nwhen I start as a clone\nif <(clonetype) = [1]> then\n    repeat (14)\n        set [clonetype v] to [0]\n        create clone of (_myself_ v)\n        change y by (-24)\n        change [clonenumber v] by (20)\n    end\n    delete this clone\nend\nif <(clonetype) = [0]> then\n    switch costume to (b v)\n    start sound [ShortPlace v]\n    show\n    wait (0.01) seconds\n    switch costume to (a v)\n    forever\n        if <touching (mouse-pointer v)?> then\n            set [brightness v] effect to (-10)\n            if <mouse down?> then\n                switch costume to ([costume name v] of [sprite3 v])\n                start sound [Place v]\n                wait until <not <mouse down?>>\n            end\n        else\n            clear graphic effects\n        end\n        if <(load) = [1]> then\n            wait (0.1) seconds\n            switch costume to (letter (clonenumber) of (GeneratedCode))\n            if <(costume [name v]) = [a]> then\n                delete this clone\n            end\n            \n        end\n        if <(edit) = [1]> then\n            wait (0.1) seconds\n            switch costume to (letter (clonenumber) of (GeneratedCode))\n        end\n    end\nend\n\nwhen I start as a clone\nif <(clonetype) = [0]> then\n    forever\n        wait until <(yes) = (clonenumber)>\n        replace item (1) of [generatedcode v] with (join (item (1) of [generatedcode v]) (costume [name v]))\n        wait until <not <(yes) = (clonenumber)>>\n    end\nend\n\nwhen flag clicked\nset [win v] to [0]\nset [startx v] to [0]\nset [starty v] to [0]\nwait (3) seconds\nforever\n    hide\n    wait until <key (space v) pressed?>\n    go to (mouse-pointer v)\n    delete all of [generatedcode v]\n    add [] to [generatedcode v]\n    show\n    start sound [ShortPlace v]\n    wait until <not <key (space v) pressed?>>\n    repeat until <key (space v) pressed?>\n        switch costume to (b v)\n        go to (mouse-pointer v)\n    end\n    if <(letter (2) of ((x position) + (240))) = []> then\n        set [finalx v] to (join [00] ((x position) + (240)))\n    else\n        if <(letter (3) of ((x position) + (240))) = []> then\n            set [finalx v] to (join [0] ((x position) + (240)))\n        else\n            set [finalx v] to ((x position) + (240))\n        end\n    end\n    if <(letter (2) of ((y position) + (180))) = []> then\n        set [finaly v] to (join [00] ((y position) + (180)))\n    else\n        if <(letter (3) of ((y position) + (180))) = []> then\n            set [finaly v] to (join [0] ((y position) + (180)))\n        else\n            set [finaly v] to ((y position) + (180))\n        end\n    end\n    start sound [Place v]\n    show\n    switch costume to (b v)\n    go to x: (0) y: (0)\n    repeat (280)\n        set [brightness v] effect to (50)\n        set [ghost v] effect to (20)\n        turn right (8) degrees\n        change [yes v] by (1)\n        wait (0.01) seconds\n    end\n    hide\n    replace item (1) of [generatedcode v] with (join (item (1) of [generatedcode v]) (join (finalX) (finalY)))\n    replace item (1) of [generatedcode v] with (join (item (1) of [generatedcode v]) (pick random (1) to (4)))\n    replace item (1) of [generatedcode v] with (join (item (1) of [generatedcode v]) (pick random (1) to (2)))\n    hide list [generatedcode v]\n    start sound [Done v]\nend\n\nwhen flag clicked\nset [win v] to [0]\nwait (1.3) seconds\nset [load v] to [0]\nforever\n    if <key (l v) pressed?> then\n        ask [Insert Code] and wait\n        delete all of [generatedcode v]\n        add [] to [generatedcode v]\n        replace item (1) of [generatedcode v] with (answer)\n        set [starty v] to ((join (join (letter (284) of (GeneratedCode)) (letter (285) of (GeneratedCode))) (letter (286) of (GeneratedCode))) - (180))\n        set [startx v] to ((join (join (letter (281) of (GeneratedCode)) (letter (282) of (GeneratedCode))) (letter (283) of (GeneratedCode))) - (240))\n        set [load v] to [1]\n        wait (1) seconds\n        set [load v] to [0]\n        set [clonetype v] to [999]\n        broadcast (message1 v)\n        broadcast (message7 v)\n    end\nend\n\nwait until <not <key (space v) pressed?>>\n\nwhen flag clicked\nset [yes v] to [0]\n\nwait (1) seconds\n\nwhen I start as a clone\nforever\n    if <(yes) = (clonenumber)> then\n        wait (0.1) seconds\n        start sound [ShortPlace v]\n        switch costume to (b v)\n        wait until <not <(yes) = (clonenumber)>>\n    end\nend\n\nwhen flag clicked\nforever\n    if <key (p v) pressed?> then\n        broadcast (message1 v)\n        wait until <not <key (p v) pressed?>>\n        wait until <key (p v) pressed?>\n        broadcast (message2 v)\n        wait until <not <key (p v) pressed?>>\n    end\nend\n\nwhen I receive [message7 v]\nset [win v] to [0]\nif <(clonetype) = [999]> then\n    forever\n        set volume to (100) %\n        play sound (letter (287) of (GeneratedCode)) until done\n    end\nend\n\ngo to x: (0) y: (-180)\nif <(letter (2) of ((x position) + (240))) = []> then\n    set [finalx v] to (join ((x position) + (240)) [00])\nelse\n    if <(letter (3) of ((x position) + (240))) = []> then\n        set [finalx v] to (join ((x position) + (240)) [0])\n    else\n        set [finalx v] to ((x position) + (240))\n    end\nend\nif <(letter (2) of ((y position) + (180))) = []> then\n    set [finaly v] to (join ((y position) + (180)) [00])\nelse\n    if <(letter (3) of ((y position) + (180))) = []> then\n        set [finaly v] to (join ((y position) + (180)) [0])\n    else\n        set [finaly v] to ((y position) + (180))\n    end\nend\n\nnext costume\n\nwhen I receive [message7 v]\nif <(clonetype) = [999]> then\n    forever\n        if <(win) = [1]> then\n            set volume to (0) %\n            wait (4) seconds\n            set volume to (100) %\n        end\n    end\nend\n\nforever\n    play sound (letter (287) of (GeneratedCode)) until done\nend\n\nwait until <not <key (space v) pressed?>>\nwait until <key (space v) pressed?>\n\nwhen flag clicked\nwait (1.3) seconds\nset [edit v] to [0]\nforever\n    if <key (k v) pressed?> then\n        ask [Insert Code to edit] and wait\n        delete all of [generatedcode v]\n        add (answer) to [generatedcode v]\n        set [edit v] to [1]\n        wait (1) seconds\n        set [edit v] to [0]\n    end\nend\n\n@Sprite2\n\nwhen flag clicked\nhide\n\ndefine touch ground <boolean>\nchange [falling? v] by (1)\nrepeat until <not <touching color (#2658a8)?>>\n    if <boolean> then\n        change y by (-1)\n        set [ygravity v] to [0]\n    else\n        change y by (1)\n        set [falling? v] to [0]\n    end\n    set [ygravity v] to [0]\nend\n\ndefine walk (number or text)\nchange x by (number or text)\nset [slope v] to [0]\nrepeat until <<(slope) = [8]> or <not <touching color (#2658a8)?>>>\n    change y by (1)\n    change [slope v] by (1)\nend\nif <(slope) = [8]> then\n    change x by ((0) - (number or text))\n    change y by ((0) - (slope))\nend\n\nif <<[4] > (Ygravity)> or <key (up arrow v) pressed?>> then\n    change [ygravity v] by (-1)\nelse\n    change [ygravity v] by (-2)\nend\n\nwhen I receive [message1 v]\ngo to x: (StartX) y: (StartY)\nshow\nset [ygravity v] to [0]\nforever\n    change y by (Ygravity)\n    change [ygravity v] by (-1)\n    touch ground <[1] < (Ygravity)>\n    if <key (right arrow v) pressed?> then\n        walk [6]\n    end\n    if <key (left arrow v) pressed?> then\n        walk [-6]\n    end\n    if <<key (up arrow v) pressed?> and <[3] > (falling?)>> then\n        set [ygravity v] to [7.7]\n    end\n    if <<touching color (#ff0000)?> or <(y position) < [-178]>> then\n        set [falling? v] to [0]\n        set [ygravity v] to [0]\n        go to x: (StartX) y: (StartY)\n    end\n    if <touching color (#00ff08)?> then\n        set [win v] to [1]\n        play sound [Hooray! v] until done\n        set [win v] to [0]\n        go to x: (StartX) y: (StartY)\n        repeat (10)\n            hide\n            wait (0.04) seconds\n            show\n            wait (0.04) seconds\n        end\n    end\n    if <touching color (#ffca00)?> then\n        set [ygravity v] to [15]\n    end\nend\n\nwhen I receive [message2 v]\nstop [other scripts in sprite v]\n\n@Sprite3\n\nwhen flag clicked\nshow\nforever\n    set size to (20) %\n    go to (mouse-pointer v)\n    change x by (10)\n    change y by (10)\n    if <key (l v) pressed?> then\n        hide\n    end\nend\n\nwhen flag clicked\nswitch costume to (b v)\nforever\n    if <key (a v) pressed?> then\n        switch costume to ((costume [number v]) - (1))\n        wait until <not <key (a v) pressed?>>\n    end\n    if <key (d v) pressed?> then\n        switch costume to ((costume [number v]) + (1))\n        wait until <not <key (d v) pressed?>>\n    end\nend\n\nwhen flag clicked\nforever\n    wait until <key (space v) pressed?>\n    hide\n    wait until <not <key (space v) pressed?>>\n    wait until <key (space v) pressed?>\n    show\nend\n\n@Sprite4\n\nset size to (200) %\n\nwhen flag clicked\n\nwhen I start as a clone\nswitch costume to (letter (288) of (GeneratedCode))\nshow\nset size to (pick random (30) to (100)) %\nset [ghost v] effect to (100)\nrepeat (40)\n    change x by ((size) * (-0.015))\n    change [ghost v] effect by (-1)\n    go to [back v] layer\nend\nrepeat until <touching (_edge_ v)?>\n    change x by ((size) * (-0.015))\n    go to [back v] layer\nend\nrepeat (5)\n    go to [back v] layer\n    change [ghost v] effect by (20)\n    change x by ((size) * (-0.015))\nend\ndelete this clone\n\nwhen I receive [message7 v]\nhide\nforever\n    go to (random position v)\n    set y to ([abs v] of (y position) )\n    change x by (999999)\n    create clone of (_myself_ v)\n    wait (4) seconds\nend\n\n@Sprite5\n\nwhen flag clicked\nforever\n    go to x: (0) y: (0)\n    go to [front v] layer\n    set [ghost v] effect to (100)\nend\n\n