Blok (VERSION 1.4)

Instructions:  YOU NEED THIS SYMBOL ----> ⓿ \nAT THE BEGINNING OF YOUR CODE!!! If you don't have it then your didn't copy the entire code correctly!!!\n\nRemember to triple click to copy the ENTIRE code. If your level is BIG and your code is longer then 500 characters you need to paste it into to separate comments to post everything. Sorry for the inconvenience, the codes ended up longer and harder than I wanted...\n\nHOW TO PLAY:\n-Use the arrow keys to move\n-Press the space-bar to shoot \n-Maneuver to the top of the blue block to advance to the next round.\n-PRESS "R" TO RESTART THE LEVEL\n\nLEVEL EDITOR: \n-Click anywhere to create a block.\n-Press "L" to load a level\n-Drag the orb (white circle) anywhere on the screen. Click it to open up the tool box and select the type of block you want to use.\n-Use the arrow keys to rotate the blocks\n-Hold "d" and click a block to delete it. By simply clicking on a block you will replace it with the currently selected block.\n-Press space to create a code for your level. Highlight the ENTIRE code and press ctrl+C to copy it.\n-Click the "Use Code" button in the main game and paste your code in to play your level!\n-Press "c" to clear the screen

@Stage\n\nwhen flag clicked\nset [asking v] to [no]\nforever\n    play sound [minimal_techno v] until done\n    repeat (2)\n        play sound [hardcore v] until done\n    end\n    play sound [mello v] until done\nend\n\nwhen I receive [code v]\nset [key v] to [1]\nask [Enter a code \(level name or custom level\):] and wait\nif <(letter (1) of (answer)) = [⓿]> then\n    set [level v] to [20]\n    replace item (21) of [levels v] with (answer)\n    broadcast (end v)\nelse\n    repeat until <<(answer) = (item (key) of [codes v])> or <(key) = [20]>>\n        change [key v] by (1)\n    end\n    if <(answer) = (item (key) of [codes v])> then\n        set [level v] to ((key) - (1))\n        broadcast (end v)\n    end\nend\n\nwhen I receive [build v]\nerase all\nif <not <(letter (1) of (item (level) of [levels v])) = [⓿]>> then\n    set [key v] to [1]\nelse\n    set [key v] to [2]\nend\nrepeat until <(key) = (length of (item (level) of [levels v]))>\n    if <[e] = (letter (key) of (item (level) of [levels v]))> then\n        set [block v] to [e]\n        wait (0.0001) seconds\n        change [key v] by (9)\n    end\n    if <[w] = (letter (key) of (item (level) of [levels v]))> then\n        set [block v] to [w]\n        wait (0.0001) seconds\n        change [key v] by (5)\n    end\n    if <[f] = (letter (key) of (item (level) of [levels v]))> then\n        set [block v] to [f]\n        wait (0.0001) seconds\n        change [key v] by (5)\n    end\n    if <[b] = (letter (key) of (item (level) of [levels v]))> then\n        set [block v] to [b]\n        wait (0.0001) seconds\n        change [key v] by (6)\n    end\n    if <[l] = (letter (key) of (item (level) of [levels v]))> then\n        set [block v] to [l]\n        wait (0.0001) seconds\n        change [key v] by (5)\n    end\n    if <[p] = (letter (key) of (item (level) of [levels v]))> then\n        set [block v] to [p]\n        wait (0.0001) seconds\n        change [key v] by (6)\n    end\n    if <[h] = (letter (key) of (item (level) of [levels v]))> then\n        set [block v] to [h]\n        wait (0.0001) seconds\n        change [key v] by (5)\n    end\n    if <(key) > (length of (item (level) of [levels v]))> then\n        change [key v] by (-1)\n    end\nend\nbroadcast (play v)\n\nwhen I receive [end v]\nwait (0.6) seconds\nchange [level v] by (1)\nif <(level) = [22]> then\n    set [level v] to [1]\n    set [block v] to [0]\n    broadcast (build v)\nend\nif <(level) = [21]> then\n    if <not <(letter (1) of (item (level) of [levels v])) = [⓿]>> then\n        broadcast (finish v)\n    else\n        broadcast (build v)\n    end\nelse\n    broadcast (build v)\nend\n\nwhen stage clicked\nif <(asking) = [no]> then\n    broadcast (click v)\nend\n\nwhen I receive [click v]\nset [editor_x v] to ((round (((-255) - (mouse x)) / (30))) * (-1))\nset [editor_y v] to (round (((195) - (mouse y)) / (30)))\nset [ratio v] to []\nif <(letter) = [e]> then\n    repeat until <<(length of (ratio)) = [3]> or <not <(letter) = [e]>>>\n        set [asking v] to [yes]\n        ask [How often will the enemy shoot? Answer in 3 digits. \(Every _____ seconds\)] and wait\n        set [ratio v] to (answer)\n    end\n    broadcast (stamp v)\nelse\n    broadcast (stamp v)\nend\nset [asking v] to [no]\n\nif <<(editor?) = [true]> and <(key) = [0]>> then\n    set [editor_x v] to ((round (((-255) - (mouse x)) / (30))) * (-1))\n    set [editor_y v] to (round (((195) - (mouse y)) / (30)))\n    set [ratio v] to []\n    if <(letter) = [e]> then\n        repeat until <(length of (ratio)) = [3]>\n            set [asking v] to [yes]\n            ask [How often will the enemy shoot? Answer in 3 digits. \(Every _____ seconds\)] and wait\n            set [ratio v] to (answer)\n        end\n    end\n    broadcast (stamp v)\nend\nset [asking v] to [no]\n\nif <(asking) = [no]> then\nend\n\n@hero\n\nwhen [r v] key pressed\nif <(restart?) = [true]> then\n    set size to (100) %\n    switch costume to (blok v)\n    go to x: (x) y: (y)\n    point in direction (direction)\n    broadcast (play v)\nend\n\nwhen I receive [play v]\nclear graphic effects\nset size to (95) %\nswitch costume to (blok v)\nset [direction_enemy v] to [null]\nset [exploding v] to [false]\nset [action? v] to [false]\nset [shot v] to [false]\nset [force v] to [-10]\nset [height v] to [0]\nset [tick v] to [0]\nshow\nwait until <(restart?) = [true]>\nwait (1) seconds\nrepeat until <(restart?) = [false]>\n    gravity\n    shoot\n    controls\n    if <(y position) < [-165]> then\n        blowup\n    end\n    set [force v] to [-10]\n    if <((x position) - (15)) < [-240]> then\n        change x by (5)\n    end\n    if <((x position) + (15)) > [240]> then\n        change x by (-5)\n    end\n    if <<(direction_enemy) = [null]> and <not <touching color (#391954)?>>> then\n        switch costume to (blok v)\n    end\n    change [tick v] by (1)\nend\n\nwhen I receive [build v]\nif <(level) = [21]> then\n    hide\nelse\n    show\nend\nrepeat until <(key) = (length of (item (level) of [levels v]))>\n    if <(block) = [b]> then\n        set [direction v] to ((letter ((key) + (5)) of (item (level) of [levels v])) * (90))\n        set [x v] to ((-255) + ((30) * (join (letter ((key) + (1)) of (item (level) of [levels v])) (letter ((key) + (2)) of (item (level) of [levels v])))))\n        set [y v] to ((195) - ((30) * (join (letter ((key) + (3)) of (item (level) of [levels v])) (letter ((key) + (4)) of (item (level) of [levels v])))))\n        set [block v] to [0]\n        wait (0.0001) seconds\n        go to x: (x) y: (y)\n        point in direction (direction)\n        show\n    end\nend\n\ndefine blowup\nstop [other scripts in sprite v]\nstart sound [explosion v]\npoint in direction (90)\nset size to (50) %\nswitch costume to (1 v)\nrepeat (8)\n    next costume\nend\nset size to (100) %\ngo to x: (x) y: (y)\npoint in direction (direction)\nbroadcast (play v)\n\ndefine gravity\nif <key (space v) pressed?> then\n    if <(direction) = [180]> then\n        if <<(UP) = [false]> and <(DOWN) = [true]>> then\n            repeat (5)\n                change y by (5)\n            end\n            set [force v] to [5]\n            set [height v] to [1]\n        else\n            if <(UP) = [true]> then\n                set [down v] to [true]\n                set [force v] to [0]\n            else\n                set [force v] to [5]\n            end\n        end\n    end\nend\nif <<(DOWN) = [false]> and <<((x position) - (14)) > [-240]> and <((x position) + (14)) < [240]>>> then\n    if <(force) > [0]> then\n        change [height v] by (1)\n    else\n        if <not <(round ((height) / (2))) = ((height) / (2))>> then\n            change y by (5)\n            set [height v] to [0]\n        end\n    end\n    change y by (force)\nend\n\ndefine shoot\nif <(shot) = [true]> then\n    if <not <<key (left arrow v) pressed?> or <key (right arrow v) pressed?>>> then\n        if <(DOWN) = [true]> then\n            if <(direction) = [90]> then\n                if <(LEFT) = [false]> then\n                    set [action? v] to [true]\n                    repeat (5)\n                        move (-6) steps\n                    end\n                    set [action? v] to [false]\n                end\n            end\n            if <(direction) = [-90]> then\n                if <(RIGHT) = [false]> then\n                    set [action? v] to [true]\n                    repeat (5)\n                        move (-6) steps\n                    end\n                    set [action? v] to [false]\n                end\n            end\n        end\n    end\n    set [shot v] to [false]\nend\n\nwhen I receive [hit v]\nswitch costume to (glow v)\nif <<(costume [number v]) = [1]> or <(costume [number v]) = [2]>> then\n    if <<(direction) < ((direction_enemy) + (89))> and <(direction) > ((direction_enemy) - (89))>> then\n        switch costume to (glow v)\n        wait (0.05) seconds\n    else\n        if <(direction_enemy) = [180]> then\n            if <(direction) < (((direction_enemy) * (-1)) + (89))> then\n                switch costume to (glow v)\n                wait (0.05) seconds\n            else\n                set [exploding v] to [true]\n                blowup\n            end\n        else\n            set [exploding v] to [true]\n            blowup\n        end\n    end\nend\nset [direction_enemy v] to [null]\n\ndefine controls\nif <<((x position) - (14)) > [-240]> and <((x position) + (14)) < [240]>> then\n    if <<touching color (#3d1a58)?> and <(DOWN) = [true]>> then\n        wait (0.0001) seconds\n    end\n    if <<not <key (space v) pressed?>> and <(action?) = [false]>> then\n        if <key (left arrow v) pressed?> then\n            if <<(LEFT) = [false]> and <(DOWN) = [true]>> then\n                set [action? v] to [true]\n                rotate (-3)\n                set [action? v] to [false]\n            end\n        end\n        if <key (right arrow v) pressed?> then\n            if <<(RIGHT) = [false]> and <(DOWN) = [true]>> then\n                set [action? v] to [true]\n                rotate (3)\n                set [action? v] to [false]\n            end\n        end\n    end\nend\n\nwhen I receive [end v]\nset [restart? v] to [false]\nwait (0.6) seconds\nstop [other scripts in sprite v]\nhide\n\ndefine None\nrepeat (5)\n    turn right ((direction) * (3)) degrees\n    go to x: ((x position) + (direction)) y: ((y position) + (1))\nend\nrepeat (5)\n    turn right ((direction) * (3)) degrees\n    go to x: ((x position) + (direction)) y: ((y position) - (1))\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [touching v]\nif <(direction) = (direction_spike)> then\n    switch costume to (glow v)\nelse\n    if <(action?) = [false]> then\n        set [exploding v] to [true]\n        stop [other scripts in sprite v]\n        blowup\n    end\nend\n\nrepeat until <not <touching color (#371952)?>>\nend\n\n@bullet\n\nwhen I start as a clone\nshow\nset [is_clone? v] to [true]\npoint in direction ([direction v] of [hero v])\nrepeat until <<<<touching color (#7030a0)?> or <touching color (#ff4f60)?>> or <touching color (#50defe)?>> or <<<touching color (#febd00)?> or <<<(x position) > [240]> or <(x position) < [-240]>> or <<(y position) > [180]> or <(y position) < [-180]>>>> or <<<(direction) = [180]> and <touching color (#663b00)?>> or <<not <touching (level v)?>> and <<touching color (#a2a2a2)?> or <<touching color (#7f7f7f)?> or <touching color (#676767)?>>>>>>>\n    move (10) steps\nend\nif <touching color (#febd00)?> then\n    broadcast (destroy v)\n    wait (0.0001) seconds\nend\ndelete this clone\n\nwhen I receive [play v]\nset [is_clone? v] to [false]\nhide\nwait until <(restart?) = [true]>\nwait (1) seconds\nforever\n    go to x: ([x position v] of [hero v]) y: ([y position v] of [hero v])\n    if <key (space v) pressed?> then\n        if <<(action?) = [false]> and <(is_clone?) = [false]>> then\n            if <(DOWN) = [true]> then\n                if <not <<key (left arrow v) pressed?> or <key (right arrow v) pressed?>>> then\n                    create clone of (_myself_ v)\n                    set [shot v] to [true]\n                    start sound [laser v]\n                    wait (0.2) seconds\n                end\n            else\n                if <([direction v] of [hero v]) = [180 ]> then\n                    create clone of (_myself_ v)\n                    broadcast (shot v)\n                    start sound [laser v]\n                    wait (0.2) seconds\n                end\n            end\n        end\n    end\nend\n\n@enemy\n\nwhen flag clicked\ngo to [front v] layer\nhide\n\nwhen I receive [build v]\nrepeat until <(key) = (length of (item (level) of [levels v]))>\n    if <(block) = [e]> then\n        set x to ((-255) + ((30) * (join (letter ((key) + (1)) of (item (level) of [levels v])) (letter ((key) + (2)) of (item (level) of [levels v])))))\n        set y to ((195) - ((30) * (join (letter ((key) + (3)) of (item (level) of [levels v])) (letter ((key) + (4)) of (item (level) of [levels v])))))\n        point in direction ((letter ((key) + (5)) of (item (level) of [levels v])) * (90))\n        stamp\n    end\nend\n\n@redbullet\n\nwhen I start as a clone\nwait until <(restart?) = [true]>\nshow\nset [is_clone? v] to [true]\nforever\n    if <(classification) = [shoot]> then\n        repeat until <<<touching (hero v)?> or <<touching color (#7030a0)?> or <<touching color (#50defe)?> or <<touching color (#676767)?> or <touching color (#a2a2a2)?>>>>> or <<touching color (#7f7f7f)?> or <<touching color (#febd03)?> or <touching (_edge_ v)?>>>>\n            move (8) steps\n        end\n        if <<touching (hero v)?> and <(exploding) = [false]>> then\n            set [direction_enemy v] to (direction)\n            broadcast (hit v)\n            delete this clone\n        else\n            delete this clone\n        end\n    else\n        forever\n            set [classification v] to [shoot]\n            show\n            create clone of (_myself_ v)\n            hide\n            wait (speed) seconds\n        end\n    end\nend\n\nwhen I receive [end v]\ndelete this clone\n\nwhen [r v] key pressed\nif <(classification) = [shooting]> then\n    delete this clone\nend\n\nwhen I receive [build v]\nrepeat until <(key) = (length of (item (level) of [levels v]))>\n    if <(block) = [e]> then\n        if <(is_clone?) = [false]> then\n            set [speed v] to (join (letter ((key) + (6)) of (item (level) of [levels v])) (join (letter ((key) + (7)) of (item (level) of [levels v])) (letter ((key) + (8)) of (item (level) of [levels v]))))\n            set [x v] to ((-255) + ((30) * (join (letter ((key) + (1)) of (item (level) of [levels v])) (letter ((key) + (2)) of (item (level) of [levels v])))))\n            set [y v] to ((195) - ((30) * (join (letter ((key) + (3)) of (item (level) of [levels v])) (letter ((key) + (4)) of (item (level) of [levels v])))))\n            set [direction v] to (letter ((key) + (5)) of (item (level) of [levels v]))\n            go to x: (x) y: (y)\n            point in direction ((direction) * (90))\n            set [direction v] to (direction)\n            move (10) steps\n            create clone of (_myself_ v)\n        end\n        set [block v] to [0]\n    end\nend\n\nwhen flag clicked\nhide\ngo to x: (-220) y: (-160)\nset [is_clone? v] to [false]\nset [classification v] to [regenerate]\n\n@hit\n\nwhen [r v] key pressed\nif <(restart?) = [true]> then\n    clear graphic effects\n    if <(is_clone?) = [false]> then\n        set [key v] to [0]\n        repeat until <(key) = (length of (deleted))>\n            show\n            set [x v] to (join (letter ((key) + (1)) of (deleted)) (letter ((key) + (2)) of (deleted)))\n            set [y v] to (join (letter ((key) + (3)) of (deleted)) (letter ((key) + (4)) of (deleted)))\n            set x to ((-255) + ((30) * (x)))\n            set y to ((195) - ((30) * (y)))\n            change [key v] by (4)\n            create clone of (_myself_ v)\n            hide\n        end\n        set [deleted v] to []\n    end\nend\n\nwhen I receive [destroy v]\nif <<touching (bullet v)?> or <(disappear) = [true]>> then\n    wait (0.0001) seconds\n    set [disappear v] to [true]\n    repeat (20)\n        broadcast (sense v)\n        change [ghost v] effect by (5)\n    end\n    set [deleted v] to (join (deleted) (join (x) (y)))\n    delete this clone\nend\n\nwhen I start as a clone\nset [is_clone? v] to [true]\nset [disappear v] to [false]\n\nwhen I receive [end v]\ndelete this clone\n\nwhen I receive [build v]\nset [deleted v] to []\nset [disappear v] to [false]\nrepeat until <(key) = (length of (item (level) of [levels v]))>\n    if <(block) = [h]> then\n        show\n        set [x v] to (join (letter ((key) + (1)) of (item (level) of [levels v])) (letter ((key) + (2)) of (item (level) of [levels v])))\n        set [y v] to (join (letter ((key) + (3)) of (item (level) of [levels v])) (letter ((key) + (4)) of (item (level) of [levels v])))\n        set x to ((-255) + ((30) * (x)))\n        set y to ((195) - ((30) * (y)))\n        create clone of (_myself_ v)\n        set [block v] to [0]\n        hide\n    end\nend\n\nwhen flag clicked\nset [is_clone? v] to [false]\nset [deleted v] to []\n\nset [level v] to [21]\n\n@finish\n\nwhen I receive [finish v]\nhide\n\nforever\n    wait (0.0005) seconds\n    next costume\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [play v]\n\nforever\n    repeat (10)\n        change [whirl v] effect by (100)\n    end\n    repeat (10)\n        change [whirl v] effect by (-100)\n    end\nend\n\nwhen I receive [build v]\nif <(level) = [21]> then\n    hide\nelse\n    show\nend\nrepeat until <(key) = (length of (item (level) of [levels v]))>\n    if <(block) = [f]> then\n        set x to ((-255) + ((30) * (join (letter ((key) + (1)) of (item (level) of [levels v])) (letter ((key) + (2)) of (item (level) of [levels v])))))\n        set y to ((195) - ((30) * (join (letter ((key) + (3)) of (item (level) of [levels v])) (letter ((key) + (4)) of (item (level) of [levels v])))))\n        show\n        set [block v] to [0]\n        wait (1) seconds\n    end\nend\n\n@ledge\n\nwhen I receive [build v]\nrepeat until <(key) = (length of (item (level) of [levels v]))>\n    if <(block) = [l]> then\n        set x to ((-255) + ((30) * (join (letter ((key) + (1)) of (item (level) of [levels v])) (letter ((key) + (2)) of (item (level) of [levels v])))))\n        set y to (((195) - ((30) * (join (letter ((key) + (3)) of (item (level) of [levels v])) (letter ((key) + (4)) of (item (level) of [levels v]))))) + (10))\n        stamp\n        go to [front v] layer\n        set [block v] to [0]\n    end\nend\n\nwhen flag clicked\nhide\n\n@wall\n\nwhen I receive [build v]\nrepeat until <(key) = (length of (item (level) of [levels v]))>\n    if <(block) = [w]> then\n        show\n        switch costume to (pick random (1) to (3))\n        set x to ((-255) + ((30) * (join (letter ((key) + (1)) of (item (level) of [levels v])) (letter ((key) + (2)) of (item (level) of [levels v])))))\n        set y to ((195) - ((30) * (join (letter ((key) + (3)) of (item (level) of [levels v])) (letter ((key) + (4)) of (item (level) of [levels v])))))\n        stamp\n        hide\n        set [block v] to [0]\n    end\nend\n\n@spike\n\nwhen I receive [build v]\nrepeat until <(key) = (length of (item (level) of [levels v]))>\n    if <(block) = [p]> then\n        show\n        set x to ((-255) + ((30) * (join (letter ((key) + (1)) of (item (level) of [levels v])) (letter ((key) + (2)) of (item (level) of [levels v])))))\n        set y to ((195) - ((30) * (join (letter ((key) + (3)) of (item (level) of [levels v])) (letter ((key) + (4)) of (item (level) of [levels v])))))\n        point in direction ((letter ((key) + (5)) of (item (level) of [levels v])) * (90))\n        create clone of (_myself_ v)\n        hide\n        set [block v] to [0]\n    end\nend\n\nwhen I receive [end v]\ndelete this clone\n\nwhen I start as a clone\nforever\n    if <(restart?) = [true]> then\n        if <<touching (hero v)?> and <<([costume # v] of [hero v]) = [1]> or <([costume # v] of [hero v]) = [2]>>> then\n            set [direction_spike v] to (direction)\n            broadcast (touching v)\n        end\n    end\nend\n\n@sensor_up\n\nwhen I receive [play v]\nforever\n    go to x: (([x position v] of [hero v]) + (10)) y: (([y position v] of [hero v]) + (16))\n    if <<touching color (#3f3f3f)?> or <<touching color (#7f7f7f)?> or <<touching color (#6f2f9f)?> or <([y position v] of [hero v]) = [165 ]>>>> then\n        set [up v] to [true]\n    else\n        set [up v] to [false]\n    end\nend\n\n@sensor_down\n\nwhen I receive [play v]\nforever\n    go to x: (([x position v] of [hero v]) - (10)) y: (([y position v] of [hero v]) - (16))\n    if <touching color (#3f3f3f)?> then\n        set [down v] to [true]\n        change y by (-5)\n        if <<touching color (#50defe)?> and <(action?) = [false]>> then\n            broadcast (end v)\n            stop [this script v]\n        end\n        change y by (5)\n    else\n        set [down v] to [false]\n    end\nend\n\n@sensor_left\n\nwhen I receive [play v]\nforever\n    go to x: (([x position v] of [hero v]) - (16)) y: ([y position v] of [hero v])\n    if <<touching color (#febd03)?> or <<<touching color (#686868)?> or <<touching color (#a2a2a2)?> or <<touching color (#7f7f7f)?> or <<touching color (#51dfff)?> or <touching color (#ff4f60)?>>>>> or <touching color (#7030a0)?>>> then\n        say [Hello!] for (1e-05) seconds\n        set [left v] to [true]\n    else\n        set [left v] to [false]\n    end\nend\n\nset [left v] to [false]\n\n@sensor_right\n\nwhen I receive [play v]\nforever\n    go to x: (([x position v] of [hero v]) + (16)) y: ([y position v] of [hero v])\n    if <<touching color (#febd03)?> or <<touching color (#3f3f3f)?> or <touching color (#6f2f9f)?>>> then\n        set [right v] to [true]\n    else\n        set [right v] to [false]\n    end\nend\n\n@press_space\n\nwhen flag clicked\nshow\ngo to [front v] layer\nset [level v] to [0]\nset [restart? v] to [false]\nset [editor? v] to [false]\nrepeat until <<(level) = [1]> or <(editor?) = [true]>>\n    repeat (20)\n        change [ghost v] effect by (5)\n    end\n    repeat (20)\n        change [ghost v] effect by (-5)\n    end\nend\n\nwhen I receive [level_editor v]\nhide\n\nwhen [space v] key pressed\nif <<(level) = [0]> and <(editor?) = [false]>> then\n    hide\n    set [level v] to [1]\n    repeat (2)\n        broadcast (build v)\n    end\nend\n\n@title/end\n\nwhen flag clicked\nswitch costume to (title v)\ngo to x: (45) y: (35)\nshow\ngo to [front v] layer\n\nwhen I receive [build v]\nhide\n\nwhen I receive [finish v]\nerase all\ngo to x: (5) y: (10)\nswitch costume to (winner v)\nshow\n\nwhen I receive [level_editor v]\nhide\n\n@level\n\nwhen I receive [build v]\nrepeat until <(costume [number v]) = [1]>\n    next costume\nend\nif <(level) = [21]> then\n    hide\nelse\n    show\n    repeat ((level) - (1))\n        next costume\n    end\nend\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\n\nwhen I receive [finish v]\nhide\n\n@code_button\n\nwhen this sprite clicked\nbroadcast (code v)\nchange [brightness v] effect by (50)\nwait (0.1) seconds\nchange [brightness v] effect by (-50)\n\nwhen I receive [finish v]\nhide\n\nwhen flag clicked\nhide\n\nwhen I receive [build v]\nshow\n\n@pen\n\ndefine y\npen down\nmove (360) steps\npen up\nchange x by (30)\ngo to x: (x position) y: (180)\n\ndefine x\npen down\nmove (480) steps\npen up\nchange y by (-30)\ngo to x: (-240) y: (y position)\n\nwhen I receive [level_editor v]\nset pen color to (#282013)\nerase all\ngo to x: (-240) y: (180)\npoint in direction (90)\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\ngo to x: (-240) y: (180)\npoint in direction (180)\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\n\nwhen I receive [restart v]\nset pen color to (#282013)\nerase all\ngo to x: (-240) y: (180)\npoint in direction (90)\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\ngo to x: (-240) y: (180)\npoint in direction (180)\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\n\nwhen flag clicked\nerase all\n\n@block\n\nwhen I start as a clone\nset [is_clone? v] to [true]\nif <(key) = [0]> then\n    set [location v] to (length of [blocks v])\n    set [classification v] to (letter)\nend\n\nwhen I receive [level_editor v]\nset [key v] to [0]\ninitiate\n\ndefine initiate\nhide\ndelete (all) of [custom_level v]\ndelete (all) of [blocks v]\nreplace item (1) of [used? v] with [false]\nreplace item (2) of [used? v] with [false]\nreplace item (1) of [visible? v] with [false]\nbroadcast (restart v)\nset [new_level v] to [⓿]\n\nwhen [c v] key pressed\nif <<(is_clone?) = [false]> and <(editor?) = [true]>> then\n    ask [Are you sure you want to clear? \(yes/no\)] and wait\n    if <(answer) = [yes]> then\n        initiate\n        broadcast (restart v)\n    end\nend\n\nwhen I receive [restart v]\ndelete this clone\n\ndefine create\nif <(editor?) = [true]> then\n    go to x: ((-255) + ((editor_x) * (30))) y: ((195) - ((editor_y) * (30)))\n    switch costume to (blok v)\n    repeat until <(item (costume [number v]) of [letters v]) = (letter)>\n        next costume\n    end\n    if <<(letter) = [b]> or <<(letter) = [p]> or <(letter) = [e]>>> then\n        point in direction (orientation)\n    else\n        point in direction (-90)\n    end\n    if <(letter) = [l]> then\n        change y by (10)\n    end\n    show\n    create clone of (block v)\n    hide\n    if <(length of (editor_x)) = [1]> then\n        set [editor_x v] to (join [0] (editor_x))\n    end\n    if <(length of (editor_y)) = [1]> then\n        set [editor_y v] to (join [0] (editor_y))\n    end\n    if <(orientation) = [90]> then\n        set [rotation v] to [1]\n    end\n    if <(orientation) = [180]> then\n        set [rotation v] to [2]\n    end\n    if <(orientation) = [-90]> then\n        set [rotation v] to [3]\n    end\n    if <(orientation) = [0]> then\n        set [rotation v] to [4]\n    end\n    if <(letter) = [e]> then\n        add (join (letter) (join (editor_x) (join (editor_y) (join (rotation) (ratio))))) to [blocks v]\n    else\n        if <<(letter) = [b]> or <(letter) = [p]>> then\n            add (join (letter) (join (editor_x) (join (editor_y) (rotation)))) to [blocks v]\n        else\n            add (join (letter) (join (editor_x) (editor_y))) to [blocks v]\n        end\n    end\nend\n\nwhen [space v] key pressed\nif <<<<(is_clone?) = [false]> and <(editor?) = [true]>> and <([costume # v] of [helpscreen v]) = [2]>> and <(key) = [0]>> then\n    delete (all) of [custom_level v]\n    set [new_level v] to [⓿]\n    broadcast (help v)\n    if <(item (1) of [visible? v]) = [false]> then\n        replace item (1) of [visible? v] with [true]\n        set [index v] to [1]\n        repeat until <(index) = ((length of [blocks v]) + (1))>\n            set [new_level v] to (join (new_level) (item (index) of [blocks v]))\n            change [index v] by (1)\n        end\n        add (new_level) to [custom_level v]\n        hide list [custom_level v]\n    else\n        replace item (1) of [visible? v] with [false]\n        show list [custom_level v]\n    end\nend\n\nwhen I receive [stamp v]\nif <<(is_clone?) = [false]> and <not <key (d v) pressed?>>> then\n    go to (mouse-pointer v)\n    if <<(mouse x) > [-240]> and <<(mouse x) < [240]> and <<(mouse y) < [180]> and <(mouse y) > [-180]>>>> then\n        if <(letter) = [b]> then\n            if <(item (1) of [used? v]) = [false]> then\n                replace item (1) of [used? v] with [true]\n                create\n            end\n        else\n            if <(letter) = [f]> then\n                if <(item (2) of [used? v]) = [false]> then\n                    replace item (2) of [used? v] with [true]\n                    create\n                end\n            else\n                create\n            end\n        end\n    end\nend\n\nwhen [l v] key pressed\nif <<<(is_clone?) = [false]> and <(editor?) = [true]>> and <([costume # v] of [helpscreen v]) = [2]>> then\n    ask [Insert previous level code to load:] and wait\n    if <(letter (1) of (answer)) = [⓿]> then\n        initiate\n        set [load_code v] to (answer)\n        set [block v] to [0]\n        set [key v] to [2]\n        repeat until <(key) = (length of (answer))>\n            if <[e] = (letter (key) of (answer))> then\n                set [letter v] to [e]\n                load\n                change [key v] by (9)\n            end\n            if <[w] = (letter (key) of (answer))> then\n                set [letter v] to [w]\n                load\n                change [key v] by (5)\n            end\n            if <[f] = (letter (key) of (answer))> then\n                set [letter v] to [f]\n                replace item (2) of [used? v] with [true]\n                load\n                change [key v] by (5)\n            end\n            if <[b] = (letter (key) of (answer))> then\n                set [letter v] to [b]\n                replace item (1) of [used? v] with [true]\n                load\n                change [key v] by (6)\n            end\n            if <[l] = (letter (key) of (answer))> then\n                set [letter v] to [l]\n                load\n                change [key v] by (5)\n            end\n            if <[p] = (letter (key) of (answer))> then\n                set [letter v] to [p]\n                load\n                change [key v] by (6)\n            end\n            if <[h] = (letter (key) of (answer))> then\n                set [letter v] to [h]\n                load\n                change [key v] by (5)\n            end\n            if <(key) > (length of (answer))> then\n                change [key v] by (-1)\n            end\n        end\n        set [key v] to [0]\n        set [letter v] to [b]\n    end\nend\n\ndefine load\nset x to ((-255) + ((30) * (join (letter ((key) + (1)) of (answer)) (letter ((key) + (2)) of (answer)))))\nset y to ((195) - ((30) * (join (letter ((key) + (3)) of (answer)) (letter ((key) + (4)) of (answer)))))\nswitch costume to (blok v)\nrepeat until <(item (costume [number v]) of [letters v]) = (letter)>\n    next costume\nend\nif <<(letter) = [b]> or <<(letter) = [p]> or <(letter) = [e]>>> then\n    point in direction ((letter ((key) + (5)) of (answer)) * (90))\nelse\n    point in direction (-90)\nend\nif <(letter) = [l]> then\n    change y by (10)\nend\nset [classification v] to (letter)\nset [location v] to ((length of [blocks v]) + (1))\nshow\ncreate clone of (block v)\nhide\nset [index v] to [0]\nset [block v] to []\nif <(letter) = [e]> then\n    repeat (9)\n        set [block v] to (join (block) (letter ((key) + (index)) of (answer)))\n        change [index v] by (1)\n    end\nelse\n    if <<(letter) = [b]> or <(letter) = [p]>> then\n        repeat (6)\n            set [block v] to (join (block) (letter ((key) + (index)) of (answer)))\n            change [index v] by (1)\n        end\n    else\n        repeat (5)\n            set [block v] to (join (block) (letter ((key) + (index)) of (answer)))\n            change [index v] by (1)\n        end\n    end\nend\nadd (block) to [blocks v]\n\nwhen flag clicked\nshow list [custom_level v]\nset [is_clone? v] to [false]\n\nwhen this sprite clicked\nif <(key) = [0]> then\n    if <key (d v) pressed?> then\n        if <(classification) = [b]> then\n            replace item (1) of [used? v] with [false]\n        end\n        if <(classification) = [f]> then\n            replace item (2) of [used? v] with [false]\n        end\n        replace item (location) of [blocks v] with []\n        delete this clone\n    else\n        if <not <(letter) = (classification)>> then\n            if <(classification) = [b]> then\n                replace item (location) of [blocks v] with []\n                replace item (1) of [used? v] with [false]\n                broadcast (click v)\n                delete this clone\n            end\n            if <(classification) = [f]> then\n                replace item (location) of [blocks v] with []\n                replace item (2) of [used? v] with [false]\n                broadcast (click v)\n                delete this clone\n            else\n                replace item (location) of [blocks v] with []\n                broadcast (click v)\n                delete this clone\n            end\n        end\n    end\nend\n\n@orb\n\nwhen flag clicked\nhide\n\nwhen this sprite clicked\nif <(item (2) of [visible? v]) = [false]> then\n    replace item (2) of [visible? v] with [true]\n    broadcast (open/close v)\n    switch costume to (orb v)\n    go to [front v] layer\n    set [ghost v] effect to (0)\nelse\n    replace item (2) of [visible? v] with [false]\n    broadcast (open/close v)\n    switch costume to (direction v)\n    go to [front v] layer\n    set [ghost v] effect to (25)\nend\n\nwhen [down arrow v] key pressed\nset [orientation v] to [180]\npoint in direction (180)\n\nwhen [right arrow v] key pressed\nset [orientation v] to [90]\npoint in direction (90)\n\nwhen [left arrow v] key pressed\nset [orientation v] to [-90]\npoint in direction (-90)\n\nwhen [up arrow v] key pressed\nset [orientation v] to [0]\npoint in direction (0)\n\nwhen I receive [level_editor v]\nreplace item (2) of [visible? v] with [false]\nshow\ngo to x: (-200) y: (140)\nset [letter v] to [b]\nswitch costume to (direction v)\ngo to [front v] layer\ngo [backward v] (2) layers\nset [ghost v] effect to (25)\n\ngo [backward v] (1000) layers\n\n@menu\n\nwhen I start as a clone\nset [is_clone? v] to [true]\nforever\n    if <<(classification) = [b]> or <(classification) = [e]>> then\n        point in direction (orientation)\n    end\n    if <(classification) = (letter)> then\n        set [ghost v] effect to (0)\n    else\n        set [ghost v] effect to (75)\n    end\n    go to x: (([x position v] of [orb v]) + (((10) * (menu_direction)) + (location))) y: ([y position v] of [orb v])\nend\n\nwhen I receive [open/close v]\nif <(is_clone?) = [false]> then\n    if <(item (2) of [visible? v]) = [true]> then\n        if <(([x position v] of [orb v]) + (280)) > [240]> then\n            set [menu_direction v] to [-1]\n        else\n            set [menu_direction v] to [1]\n        end\n        set [move v] to ((35) * (menu_direction))\n        set [classification v] to [0]\n        go to [front v] layer\n        switch costume to (finish v)\n        set [ghost v] effect to (75)\n        go to x: ([x position v] of [orb v]) y: ([y position v] of [orb v])\n        change x by ((10) * (menu_direction))\n        change x by (move)\n        show\n        next costume\n        set [classification v] to [b]\n        set [location v] to (move)\n        create clone of (_myself_ v)\n        hide\n        change x by (move)\n        show\n        next costume\n        set [classification v] to [h]\n        set [location v] to ((move) * (2))\n        create clone of (_myself_ v)\n        hide\n        change x by (move)\n        show\n        next costume\n        set [classification v] to [e]\n        set [location v] to ((move) * (3))\n        create clone of (_myself_ v)\n        hide\n        change x by (move)\n        show\n        next costume\n        set [classification v] to [w]\n        set [location v] to ((move) * (4))\n        create clone of (_myself_ v)\n        hide\n        change x by (move)\n        show\n        next costume\n        set [classification v] to [p]\n        set [location v] to ((move) * (5))\n        create clone of (_myself_ v)\n        hide\n        change x by (move)\n        show\n        next costume\n        set [classification v] to [l]\n        set [location v] to ((move) * (6))\n        create clone of (_myself_ v)\n        hide\n        change x by (move)\n        show\n        next costume\n        set [classification v] to [f]\n        set [location v] to ((move) * (7))\n        create clone of (_myself_ v)\n        hide\n        set [classification v] to [0]\n    else\n        hide\n        set [classification v] to [0]\n    end\nelse\n    delete this clone\nend\n\nwhen this sprite clicked\nset [x v] to [0]\nrepeat (length of [letters v])\n    change [x v] by (1)\n    if <(classification) = (item (x) of [letters v])> then\n        set [letter v] to (item (x) of [letters v])\n    end\nend\n\nwhen flag clicked\nset [is_clone? v] to [false]\n\n@orb_open\n\nwhen I receive [open/close v]\nif <(item (2) of [visible? v]) = [true]> then\n    show\n    go to x: (([x position v] of [orb v]) + ((140) * (menu_direction))) y: ([y position v] of [orb v])\n    forever\n        go to x: (([x position v] of [orb v]) + ((140) * (menu_direction))) y: ([y position v] of [orb v])\n    end\nelse\n    hide\nend\n\nwhen flag clicked\nhide\n\n@helpscreen\n\nwhen this sprite clicked\nif <(costume [number v]) = [1]> then\n    repeat (15)\n        change [ghost v] effect by (5)\n    end\n    hide\n    set [ghost v] effect to (15)\n    switch costume to (code_help v)\nend\n\nwhen I receive [help v]\ngo to [front v] layer\ngo [backward v] (1) layers\nif <(costume [number v]) = [2]> then\n    if <(item (1) of [visible? v]) = [true]> then\n        show\n    else\n        hide\n    end\nend\n\nwhen I receive [level_editor v]\nshow\nswitch costume to (intro_help v)\ngo to [front v] layer\ngo [backward v] (1) layers\nset [ghost v] effect to (25)\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\n\n@editor\n\nwhen this sprite clicked\nset [editor? v] to [true]\nbroadcast (initiate_editor v)\nchange [brightness v] effect by (50)\nwait (0.1) seconds\nchange [brightness v] effect by (-50)\nwait (0.5) seconds\nhide\n\nwhen flag clicked\ngo to [front v] layer\nshow\n\nwhen I receive [build v]\nhide\n\n@transition\n\nwhen I receive [end v]\ngo to [front v] layer\nshow\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\nbroadcast (hidden v)\n\nwhen I receive [build v]\nswitch costume to (loading v)\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (transition v)\nset size to (100) %\nshow\ngo to [front v] layer\ngo [backward v] (4) layers\n\nwhen I receive [play v]\ngo to [front v] layer\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nhide\nset [restart? v] to [true]\nreplace item (21) of [levels v] with []\n\nwhen I receive [finish v]\ngo to [front v] layer\nswitch costume to (transition v)\nrepeat (40)\n    change [ghost v] effect by (2.5)\nend\nhide\n\nwhen I receive [initiate_editor v]\nswitch costume to (loading v)\ngo to [front v] layer\nset [ghost v] effect to (100)\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\nbroadcast (level_editor v) and wait\ngo to [front v] layer\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nhide\n\n