Volcanic Appel     (New levels)        #all #games #music #art #platformer #appel #poliakoff
@Stage\n\n@Blank\n\nset [level # v] to [1]\n\nset [level # v] to [2]\n\nset [level # v] to [3]\n\nset [level # v] to [4]\n\nset [level # v] to [5]\n\nset [level # v] to [6]\n\nset [hue v] to [150]\nset [hue #2 v] to [115]\n\nset [level # v] to [7]\n\nset [level # v] to [8]\n\nset [level # v] to [9]\n\nwhen [z v] key pressed\nif <key (p v) pressed?> then\n    delete all of [debug v]\n    broadcast (Report Order v) and wait\nend\n\nwhen flag clicked\ngo to [back v] layer\nswitch costume to (blank v)\nhide\n\nswitch costume to (thumbnail v)\ngo to [front v] layer\ngo to x: (0) y: (0)\nshow\n\nwhen I receive [report order v]\nadd (join [Blank ] (costume [name v])) to [debug v]\n\n@Player\n\nwhen I receive [game loop - player v]\nshow\nset [player lsy v] to (PLAYER Y)\nresolve collisions <> from [loop]\ncheck keys\ncheck dangers\nfail [after check danger]\nmove player up / down\nmove player left / right\nif <(PLAYER DEATH) = [squish?]> then\n    resolve collisions <> from [loop squish?]\nend\nif <(PLAYER WALL) > []> then\n    if <(PLAYER WALL) = [0]> then\n        set [is falling v] to [10]\n    else\n        set [is falling v] to [0]\n    end\n    confirm still touching wall\nend\nif <not < (PLAYER STATE) contains [spin]?>> then\n    if <not <(flipped) = [0]>> then\n        if <(PLAYER WALL) = []> then\n            Make Upright\n        end\n    end\nend\nScroll (CAMERA X) (CAMERA Y)\nposition now\n\ndefine move player left / right\nfail [move player left / right]\nif <(PLAYER STATE) = [crouch]> then\n    set [max speed v] to [1.2]\nelse\n    set [max speed v] to [2.5]\nend\nif <(PLAYER NO SLOW) > [0]> then\n    change [player no slow v] by (-1)\n    if <(is falling) < [1]> then\n        set [player sx v] to ((0.95) * (PLAYER SX))\n    end\nelse\n    if <<(PLAYER STATE) = [wall spin]> and <(is falling) < [25]>> then\nend\nif <(PLAYER SX) > [0]> then\n    move player x by (PLAYER SX) dir [1]\nelse\n    move player x by (PLAYER SX) dir [-1]\nend\n\ndefine move player up / down\nif <(EDIT) > [0]> then\n    if <not <(PLAYER STATE) = []>> then\n        set [player state v] to []\n        set [is jumping v] to []\n        Set Flipped [0]\n    end\n    if <(KEY - UP) > [0]> then\n        change [player sy v] by (((12) - (PLAYER SY)) * (0.2))\n    else\n        if <(KEY - DOWN) > [0]> then\n            change [player sy v] by (((-12) - (PLAYER SY)) * (0.2))\n        else\n            change [player sy v] by (((0) - (PLAYER SY)) * (0.2))\n        end\n    end\nelse\n    change [player sy v] by (-1.7)\n    if <(PLAYER SY) < [-30]> then\n        set [player sy v] to [-30]\n    end\n    if <([abs v] of (PLAYER WALL) ) = [1]> then\n        if <<(PLAYER SY) < [0]> or <(friction) > []>> then\n            if <(friction) > []> then\n                change [player sy v] by ((1.7) * (friction))\n            end\n            change [player sy v] by (((friction dy) - (PLAYER SY)) * (0.3))\n        end\n    end\n    if <<(KEY - UP) > [0]> or <(extra bounce) > [2]>> then\n        process jump key pressed\n    else\n        if <(extra bounce) < [1]> then\n            if <<(is jumping) > [0]> and <(is jumping) < [100]>> then\n                set [is jumping v] to [100]\n            end\n            if <(PLAYER SY) > [0]> then\n                if <<(is falling) > [1]> and <(PLAYER STATE) = []>> then\n                    change [player sy v] by (-1)\n                end\n            else\n                if <(PLAYER STATE) = [BOING]> then\n                    set [player state v] to []\n                end\n            end\n        end\n    end\n    change [extra bounce v] by (-1)\n    if <(KEY - DOWN) > [0]> then\n        if <not < (PLAYER STATE) contains [spin]?>> then\n            set [player state v] to [crouch]\n            Set Flipped (flipped)\n            resolve collisions <> from [move player up/down - crouch]\n        end\n    else\n        if <(PLAYER STATE) = [crouch]> then\n            Can Get Up\n            if <(overlap) = []> then\n                set [player state v] to []\n                Set Flipped (flipped)\n                resolve collisions <> from [move player up/down - get up]\n            end\n        end\n    end\n    change [is falling v] by (1)\nend\nif <(PLAYER SY) > [0]> then\n    move player y by (PLAYER SY) [0]\nelse\n    move player y by (PLAYER SY) [2]\nend\n\ndefine position now\nswitch costume to (big v)\ngo to x: (round ((PLAYER X) - (CAMERA X))) y: (round ((PLAYER Y) - (CAMERA Y)))\nif <(PLAYER STATE) = [wall spin]> then\n    set rotation style [all around v]\n    turn right ((22.5) * (flipped)) degrees\n    if <(PLAYER DIR) > [0]> then\n        switch costume to (stand v)\n    else\n        switch costume to (stand left v)\n    end\n    stop [this script v]\nend\nif <(PLAYER STATE) = [spin]> then\n    set rotation style [all around v]\n    set [temp v] to (((((((flipped) + (1)) * (90)) - (direction)) + (180)) mod (360)) - (180))\n    if <([abs v] of (temp) ) < [22.5]> then\n        point in direction ((flipped) * (90))\n        set [player state v] to []\n    else\n        if <<(temp) < [0]> and <not <<(temp) = [-180]> and <(direction) = [0]>>>> then\n            turn right (-30) degrees\n        else\n            turn right (30) degrees\n        end\n        if <(PLAYER DIR) > [0]> then\n            if <(flipped) = [2]> then\n                switch costume to (flipped v)\n            else\n                switch costume to (stand v)\n            end\n        else\n            if <(flipped) = [2]> then\n                switch costume to (flipped left v)\n            else\n                switch costume to (stand left v)\n            end\n        end\n        stop [this script v]\n    end\nend\nset rotation style [all around v]\npoint in direction (((flipped) + (1)) * (90))\nif <(PLAYER STATE) = [crouch]> then\n    if <(PLAYER WALL) = []> then\n        if <(PLAYER DIR) > [0]> then\n            switch costume to (crouch v)\n        else\n            switch costume to (crouch left v)\n        end\n    else\n        if <(PLAYER DIR) > [0]> then\n            switch costume to (wall crouch v)\n        else\n            switch costume to (wall crouch left v)\n        end\n    end\nelse\n    if  then\n        if <(PLAYER DIR) > [0]> then\n            switch costume to (piston v)\n        else\n            switch costume to (piston left v)\n        end\n    else\n        if <(PLAYER DIR) > [0]> then\n            switch costume to (stand v)\n        else\n            switch costume to (stand left v)\n        end\n    end\nend\nif <(PLAYER INV) > [0]> then\n    change [player inv v] by (-1)\n    if <((PLAYER INV) mod (7)) > [2]> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [start v]\nif <(REPLAY IDX) = []> then\n    init black box\nelse\n    init replay\nend\ndelete all of [order v]\nbroadcast (_order v)\nhide\nset size to (100) %\nset [tick v] to [0]\nset [lives v] to [9]\nset [apples v] to [0]\nset [time v] to [0]\nset [game state v] to [BEGIN]\nSet TIME\nset [spawn idx v] to (item # of [76] in [map v])\nset [idx v] to (item # of [63] in [map v])\nif <(idx) > [0]> then\n    set [max camera x v] to ((((idx) mod (LSX)) + (-1.5)) * (60))\nelse\n    set [max camera x v] to [9999999]\nend\nreset player\nset [player inv v] to [2]\nset [camera x v] to (PLAYER X)\nset [camera y v] to (PLAYER Y)\nScroll (CAMERA X) (CAMERA Y)\nset [shake v] to [0]\nforever\n    broadcast (game - loop obj v) and wait\n    broadcast (game loop - scroll v) and wait\n    set [ghost v] effect to (100)\n    show\n    game loop\n    if <(GAME STATE) = [menu]> then\n        stop [this script v]\n    end\n    if <(GAME STATE) = [next level]> then\n        wait (0.03) seconds\n        change [level # v] by (1)\n        if <(REPLAY IDX) < [1]> then\n        broadcast (EDIT - Remove Clones v) and wait\n        wait (0.03) seconds\n        if <<(LEVEL #) = [11]> or <(LEVEL #) = [13]>> then\n            if <(EDIT) > []> then\n                change [level # v] by (-1)\n            else\n                broadcast (BACK TO MAIN MENU v)\n                wait (10) seconds\n                stop [this script v]\n            end\n        end\n        broadcast (EDIT - Load v) and wait\n        wait (0.03) seconds\n        broadcast (EDIT - Reload v) and wait\n        broadcast (start v)\n        stop [this script v]\n    end\n    if <(PLAYER DEATH) = [reset]> then\n        full level reset\n        stop [this script v]\n    end\n    if <(SFX) > [0]> then\n        start sound [boom 2 v]\n        start sound [squishy v]\n    end\n    broadcast (event - explode v) and wait\n    if <(PLAYER DEATH) = [reset]> then\n        full level reset\n        stop [this script v]\n    end\n    reset player\n    set [player inv v] to (item # of (join [+] (SPAWN IDX)) in [map data v])\n    if <(PLAYER INV) > [0]> then\n        set [player inv v] to (item ((PLAYER INV) + (1)) of [map data v])\n    else\n        set [player inv v] to [30]\n    end\n    if <(LIVES) > [0]> then\n        change [lives v] by (-1)\n    end\n    if <(length of [boss v]) < [5]> then\n        broadcast (reset after death v) and wait\n    end\n    broadcast (game loop - player v)\n    broadcast (game loop - scroll v) and wait\nend\n\ndefine solid = is solid at (x) (y) dir (dir)\nget block at (x) (y)\nif <(mask char) > [4]> then\n    if <(dir) > [0]> then\n        if <(dir) = [1]> then\n            set [temp v] to ((x) mod (30))\n        else\n            set [temp v] to ((30) - ((y) mod (30)))\n        end\n    else\n        if <(dir) = [-1]> then\n            set [temp v] to ((30) - ((x) mod (30)))\n        else\n            set [temp v] to ((y) mod (30))\n        end\n    end\n    if <(temp) > (overlap)> then\n        set [overlap v] to (temp)\n        set [solid v] to (mask char)\n    end\nend\nset [oi v] to [0]\nrepeat until <(oi) > (length of [obj v])>\n    if <([abs v] of ((x) - (item ((oi) + (2)) of [obj v])) ) < (item ((oi) + (4)) of [obj v])> then\n        if <([abs v] of ((y) - (item ((oi) + (3)) of [obj v])) ) < (item ((oi) + (5)) of [obj v])> then\n            if <(dir) > [0]> then\n                if <(dir) = [1]> then\n                    set [temp v] to ((x) - ((item ((oi) + (2)) of [obj v]) - (item ((oi) + (4)) of [obj v])))\n                else\n                    set [temp v] to (((item ((oi) + (3)) of [obj v]) + (item ((oi) + (5)) of [obj v])) - (y))\n                    if <(EDIT) < [1]> then\n                        set [friction dx v] to (item ((oi) + (6)) of [obj v])\n                        set [friction dy v] to (item ((oi) + (7)) of [obj v])\n                    end\n                end\n            else\n                if <(dir) = [-1]> then\n                    set [temp v] to (((item ((oi) + (2)) of [obj v]) + (item ((oi) + (4)) of [obj v])) - (x))\n                else\n                    set [temp v] to ((y) - ((item ((oi) + (3)) of [obj v]) - (item ((oi) + (5)) of [obj v])))\n                    if <(EDIT) < [1]> then\n                        set [friction dx v] to (item ((oi) + (6)) of [obj v])\n                        set [friction dy v] to (item ((oi) + (7)) of [obj v])\n                    end\n                end\n            end\n            if <(temp) > (overlap)> then\n                set [overlap v] to (temp)\n                set [solid v] to [99]\n            end\n        end\n    end\n    change [oi v] by (OBJ*)\nend\n\ndefine press dir (dir)\nchange [player sx v] by ((dir) * (max speed))\nif <(PLAYER STATE) = [spin]> then\n    stop [this script v]\nend\nset [player dir v] to (dir)\nif <(is falling) < [1]> then\n    if <((TICK) mod (pick random (1) to (2))) = [0]> then\n        if <([abs v] of (PLAYER SX) ) > [12]> then\n            if <<(PLAYER SX) > [0]> = <(dir) > [0]>> then\n                add [cloud] to [particle v]\n                add ((PLAYER X) + (pick random (-6.0) to (6.0))) to [particle v]\n                add (((PLAYER Y) + (2)) - (item (3) of [psz v])) to [particle v]\n            end\n        end\n    end\nend\n\ndefine check keys\nset [key - dir v] to []\nif <(GAME STATE) = [win]> then\n    set [key - up v] to [0]\n    set [key - down v] to [0]\n    set [key - left v] to [0]\n    set [key - right v] to [0]\n    stop [this script v]\nend\nif <(REPLAY IDX) < [1]> then\n    set [temp v] to [0]\n    if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<key (z v) pressed?> or <key (space v) pressed?>>>> then\n        change [temp v] by (8)\n        set [key - dir v] to [0]\n        if <(KEY - UP) < [1]> then\n            set [key - up v] to [1]\n        end\n    else\n        set [key - up v] to [0]\n    end\n    if <<key (down arrow v) pressed?> or <<key (s v) pressed?> or <key (x v) pressed?>>> then\n        change [temp v] by (4)\n        set [key - dir v] to [2]\n        set [key - down v] to [1]\n    else\n        set [key - down v] to [0]\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change [temp v] by (2)\n        set [key - dir v] to [-1]\n        if <(KEY - LEFT) < [1]> then\n            set [key - left v] to [1]\n        end\n    else\n        set [key - left v] to [0]\n    end\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        change [temp v] by (1)\n        set [key - dir v] to [1]\n        if <(KEY - RIGHT) < [1]> then\n            set [key - right v] to [1]\n        end\n    else\n        set [key - right v] to [0]\n    end\nend\nrecorder\nif <<(KEY - DIR) > []> and <(GAME STATE) = [BEGIN]>> then\n    set [game state v] to [PLAY]\nend\n\ndefine Set Flipped (flipped)\nif  then\n    set [temp v] to (((flipped) mod (4)) + (1))\n    if <<(PLAYER WALL) = []> and <(PLAYER STATE) = [crouch]>> then\n        replace item (temp) of [psz v] with [7]\n    else\n        replace item (temp) of [psz v] with [17]\n    end\n    set [temp v] to (((temp) mod (4)) + (1))\n    replace item (temp) of [psz v] with [13]\n    set [temp v] to (((temp) mod (4)) + (1))\n    if <<(PLAYER WALL) > []> and <(PLAYER STATE) = [crouch]>> then\n        replace item (temp) of [psz v] with [7]\n    else\n        replace item (temp) of [psz v] with [17]\n    end\n    set [temp v] to (((temp) mod (4)) + (1))\n    replace item (temp) of [psz v] with [13]\nend\nset [flipped v] to (flipped)\n\ndefine touching wall dx (dir)\nif <<(PLAYER STATE) = [spin]> or <(is falling) < [3]>> then\n    stop [this script v]\nend\nset [overlap v] to []\nsolid = is solid at ((PLAYER X) + ((dir) * (-30))) ((PLAYER Y) + (8)) dir (dir)\nsolid = is solid at ((PLAYER X) + ((dir) * (-30))) ((PLAYER Y) + (-8)) dir (dir)\nif <(overlap) = []> then\n    set [overlap v] to []\n    solid = is solid at ((PLAYER X) + ((dir) * (4))) ((PLAYER Y) + (4)) dir (dir)\n    if <(overlap) > []> then\n        set [overlap v] to []\n        solid = is solid at ((PLAYER X) + ((dir) * (4))) ((PLAYER Y) + (-4)) dir (dir)\n        if <<(overlap) > []> and <([abs v] of (PLAYER SX) ) > [3]>> then\n            if <<not <(dir) = (flipped)>> or <(PLAYER STATE) = [wall spin]>> then\n                set [player state v] to [spin]\n                Set Flipped (dir)\n            end\n            set [player wall v] to (dir)\n        end\n    end\nend\n\ndefine touching wall dy (dy)\nset [player sy v] to [0]\nif <<(dy) = [1]> and <(KEY - UP) > [0]>> then\n    if  then\n        set [player sy v] to [4]\n        if <(friction dy) > [0]> then\n            change [player sy v] by (friction dy)\n        end\n        set [is falling v] to [0]\n        set [player wall v] to [0]\n        Set Flipped [0]\n    end\nend\nif <(dy) = [-1]> then\n    if <(friction dy) < [0]> then\n        change [player sy v] by (friction dy)\n    end\nend\n\ndefine Make Upright\nfail [make upright]\nif <(flipped) = [0]> then\n    stop [this script v]\nend\nset [player state v] to [spin]\nSet Flipped Safe [0]\nset [overlap v] to []\nfail [after make upright]\n\ndefine move player y by (dy) (dir)\nif <(dy) > [0]> then\n    change [player y v] by ((dy) + (item (1) of [psz v]))\nelse\n    change [player y v] by ((dy) - (item (3) of [psz v]))\nend\nset [overlap v] to []\nif <(dy) > []> then\n    set [friction v] to []\n    set [friction dx v] to []\n    set [friction dy v] to []\nend\nif <(EDIT) < [1]> then\n    solid = is solid at ((PLAYER X) + (item (2) of [psz v])) (PLAYER Y) dir (dir)\n    active block (dir)\n    solid = is solid at ((PLAYER X) - (item (4) of [psz v])) (PLAYER Y) dir (dir)\n    active block (dir)\nend\nif <(overlap) > []> then\n    if <([abs v] of (dy) ) > [6]> then\n        if <(PLAYER WALL) = []> then\n            if <(is falling) > [4]> then\n                if <(SFX) > [0]> then\n                    start sound [420673__sypherzent__basic-melee-hit v]\n                end\n            end\n        end\n    end\n    if <(dy) > [0]> then\n        change [player y v] by ((-0.01) - (overlap))\n        touching wall dy [1]\n        if < (PLAYER STATE) contains [spin]?> then\n            set [player state v] to []\n        end\n    else\n        change [player y v] by ((0.01) + (overlap))\n        touching wall dy [-1]\n        set [is falling v] to [0]\n        set [is jumping v] to [0]\n        if <not <(PLAYER WALL) = [2]>> then\n            set [player wall v] to []\n        end\n    end\n    if <(PLAYER STATE) = [wall spin]> then\n        set [player state v] to []\n    end\nend\nif <(dy) > [0]> then\n    change [player y v] by ((0) - (item (1) of [psz v]))\nelse\n    change [player y v] by ((0) + (item (3) of [psz v]))\nend\n\ndefine move player x by (sx) dir (dir)\nfail [move player x by]\nset [rem x v] to (PLAYER X)\nif <(sx) > [0]> then\n    change [player x v] by ((sx) + (item (2) of [psz v]))\nelse\n    change [player x v] by ((sx) - (item (4) of [psz v]))\nend\nset [overlap v] to []\nif <(EDIT) < [1]> then\n    solid = is solid at (PLAYER X) ((PLAYER Y) + (item (1) of [psz v])) dir (dir)\n    active block (dir)\n    solid = is solid at (PLAYER X) (PLAYER Y) dir (dir)\n    solid = is solid at (PLAYER X) ((PLAYER Y) - (item (3) of [psz v])) dir (dir)\n    active block (dir)\nend\nif <(overlap) > []> then\n    if <(overlap) > (([abs v] of (sx) ) + (4))> then\n        if <(EDIT) < [1]> then\n            set [temp v] to (PLAYER X)\n            set [player x v] to ((rem x) + (sx))\n            resolve collisions <> from [move player x by]\n            if <(PLAYER DEATH) > []> then\n                set [player x v] to (temp)\n                set [player death v] to [squish?]\n                add [DEATH 1] to [debug v]\n                add (sx) to [debug v]\n            else\n                add [DEATH 1 - Prevented] to [debug v]\n                add (sx) to [debug v]\n                stop [this script v]\n            end\n        end\n    end\n    if <(sx) > [0]> then\n        change [player x v] by ((-0.01) - (overlap))\n        touching wall dx [1]\n    else\n        change [player x v] by ((0.01) + (overlap))\n        touching wall dx [-1]\n    end\n    set [overlap v] to []\n    solid = is solid at (PLAYER X) ((PLAYER Y) + (item (1) of [psz v])) dir (dir)\n    solid = is solid at (PLAYER X) (PLAYER Y) dir (dir)\n    solid = is solid at (PLAYER X) ((PLAYER Y) - (item (3) of [psz v])) dir (dir)\n    if <(overlap) > []> then\n        if <(EDIT) < [1]> then\n            set [player death v] to [1]\n            add [DEATH 2] to [debug v]\n            add (sx) to [debug v]\n        end\n    end\n    set [player sx v] to ((PLAYER SX) * (0.5))\nend\nif <(sx) > [0]> then\n    change [player x v] by ((0) - (item (2) of [psz v]))\nelse\n    change [player x v] by ((0) + (item (4) of [psz v]))\nend\nif <(PLAYER DEATH) > [0]> then\n    set [player x v] to (rem x)\nend\nif <<(length of [boss v]) > [5]> and <(EDIT) < [1]>> then\n    if <(PLAYER X) < ((item (5) of [boss v]) + (8))> then\n        set [player x v] to ((item (5) of [boss v]) + (8))\n    else\n        if <(PLAYER X) > ((item (6) of [boss v]) - (8))> then\n            set [player x v] to ((item (6) of [boss v]) - (8))\n        end\n    end\nelse\n    if <(PLAYER X) < [14]> then\n        set [player x v] to [14]\n        set [player sx v] to [0]\n    end\nend\n\ndefine confirm still touching wall\nset [overlap v] to []\nif <(PLAYER WALL) = [0]> then\n    solid = is solid at (PLAYER X) (((PLAYER Y) + (item (1) of [psz v])) + (1)) dir [0]\nend\nif <(PLAYER WALL) = [1]> then\n    solid = is solid at (((PLAYER X) + (item (2) of [psz v])) + (1)) (PLAYER Y) dir [0]\n    active block (PLAYER WALL)\n    solid = is solid at (((PLAYER X) + (item (2) of [psz v])) + (1)) ((PLAYER Y) - (item (3) of [psz v])) dir [0]\n    active block (PLAYER WALL)\nend\nif <(PLAYER WALL) = [-1]> then\n    solid = is solid at (((PLAYER X) - (item (4) of [psz v])) - (1)) (PLAYER Y) dir [0]\n    active block (PLAYER WALL)\nend\nif <(overlap) = []> then\n    if <(PLAYER STATE) = [crouch]> then\n        if <(PLAYER WALL) = [1]> then\n            change [player x v] by (10)\n        else\n            if <(PLAYER WALL) = [-1]> then\n                change [player x v] by (-10)\n            else\n                if <(PLAYER WALL) = [0]> then\n                    change [player y v] by (10)\n                end\n            end\n        end\n    end\n    set [player wall v] to []\n    Set Flipped (flipped)\nend\n\ndefine start wall jump\nif <(SFX) > [0]> then\n    start sound [wall jump v]\nend\nset [is jumping v] to [101]\nset [player state v] to [wall spin]\nSet Flipped ((PLAYER WALL) * (-1))\nset [player sy v] to [20]\nset [player sx v] to ((PLAYER WALL) * (-10))\nset [player wall v] to []\nset [is falling v] to [10]\nset [key - up v] to [2]\n\ndefine Scroll (last x) (last y)\nSet TIME\nif <<(PLAYER Y) > (CAMERA SHIFT DY)> and <((PLAYER Y) - (180)) < (CAMERA SHIFT DY)>> then\n    set [temp v] to (CAMERA SHIFT DY)\nelse\n    set [temp v] to (PLAYER Y)\nend\nif <(PLAYER DEATH) < [1]> then\n    change [camera x v] by (round (((PLAYER X) - (CAMERA X)) * (0.2)))\n    change [camera y v] by (round (((temp) - ((CAMERA Y) + (-8))) * (0.2)))\n    if <(EDIT) < [1]> then\n        if <(length of [boss v]) > [5]> then\n            if <(CAMERA X) < ((item (5) of [boss v]) + (240))> then\n                if <(last x) < ((item (5) of [boss v]) + (240))> then\n                    if <((last x) + (2)) > (CAMERA X)> then\n                        set [camera x v] to ((last x) + (2))\n                    end\n                else\n                    set [camera x v] to ((item (5) of [boss v]) + (240))\n                end\n            else\n                if <(CAMERA X) > ((item (6) of [boss v]) - (240))> then\n                    set [camera x v] to ((item (6) of [boss v]) - (240))\n                end\n            end\n        end\n        if <(CAMERA X) > (max camera x)> then\n            set [camera x v] to (max camera x)\n        end\n    end\nend\nif <([abs v] of (SHAKE) ) > [0.5]> then\n    if <((TICK) mod (2)) = [0]> then\n        change [camera y v] by (round (SHAKE))\n        set [shake v] to ((SHAKE) * (-0.6))\n    end\nend\nif <(CAMERA Y) < [180]> then\n    set [camera y v] to [180]\nend\nif <(CAMERA X) < [240]> then\n    set [camera x v] to [240]\nend\nif <(CAMERA X) > (((LSX) * (60)) - (240))> then\n    set [camera x v] to (((LSX) * (60)) - (240))\nend\nset [camera shift dy v] to [9999999]\n\ndefine check dangers\nif <(EDIT) > [0]> then\n    stop [this script v]\nend\nif <((PLAYER DIR) mod (2)) = [0]> then\n    set [temp v] to [1]\nelse\n    set [temp v] to [1]\nend\nget block at ((PLAYER X) + ((item (2) of [psz v]) - (temp))) (PLAYER Y)\nif <(mask char) = [.]> then\n    broadcast (check spikes v)\nend\nget block at ((PLAYER X) - ((item (4) of [psz v]) - (temp))) (PLAYER Y)\nif <(mask char) = [.]> then\n    broadcast (check spikes v)\nend\nif <((PLAYER DIR) mod (2)) = [0]> then\n    set [temp v] to [10]\nelse\n    set [temp v] to [1]\nend\nget block at (PLAYER X) ((PLAYER Y) + ((item (1) of [psz v]) - (temp)))\nif <(mask char) = [.]> then\n    broadcast (check spikes v)\nend\nget block at (PLAYER X) ((PLAYER Y) - ((item (3) of [psz v]) - (temp)))\nif <(mask char) = [.]> then\n    broadcast (check spikes v)\nend\nget block at (PLAYER X) (PLAYER Y)\nset [player substance v] to []\nif <<(tile) > [78]> and <(tile) < [83]>> then\n    set [player substance v] to [hidden]\nend\nif <(tile) = [15]> then\n    if <(SFX) > [0]> then\n        start sound [coin 2 v]\n        start sound [crunch v]\n    end\n    replace item (idx) of [map v] with [1]\n    add [15] to [particle v]\n    add (((60) * ([floor v] of ((PLAYER X) / (60)) )) + (30)) to [particle v]\n    add (((60) * ([floor v] of ((PLAYER Y) / (60)) )) + (30)) to [particle v]\n    change [apples v] by (1)\nend\nif <(tile) = [25]> then\n    if <(SFX) > [0]> then\n        start sound [Flag v]\n    end\n    set [spawn idx v] to (idx)\n    replace item (idx) of [map v] with [26]\n    add [25] to [particle v]\n    add (((60) * ([floor v] of ((PLAYER X) / (60)) )) + (30)) to [particle v]\n    add (((60) * ([floor v] of ((PLAYER Y) / (60)) )) + (30)) to [particle v]\nend\nif <<(tile) = [63]> and <(GAME STATE) = [PLAY]>> then\n    if <(SFX) > [0]> then\n        start sound [Complete v]\n    end\n    set [spawn idx v] to (idx)\n    add [25] to [particle v]\n    add (((60) * ([floor v] of ((PLAYER X) / (60)) )) + (30)) to [particle v]\n    add (((60) * ([floor v] of ((PLAYER Y) / (60)) )) + (30)) to [particle v]\n    set [game state v] to [WIN]\n    if <(REPLAY IDX) = []> then\n        broadcast (CLOUD - Save v)\n    end\n    broadcast (Level - Complete v)\nend\nif <<(tile) = [71]> or <(tile) = [84]>> then\n    if <not <[active idx v] contains (idx)?>> then\n        add (idx) to [active idx v]\n    end\nend\n\nwhen I receive [event - explode v]\nwait (0.03) seconds\nhide\n\nwhen I receive [event - explode v]\nset [player inv v] to [0]\nset [shake v] to [30]\nchange [camera y v] by (-20)\ncheck keys\nif <(KEY - UP) = [1]> then\n    set [key - up v] to [2]\nend\nset [tx v] to [0]\nrepeat (70)\n    change [tx v] by (1)\n    check keys\n    if <<key (r v) pressed?> and <key (q v) pressed?>> then\n        set [player death v] to [reset]\n        stop [this script v]\n    end\n    if <<(KEY - UP) = [1]> or <(PLAYER DEATH) = [reset]>> then\n        set [key - up v] to [2]\n        if <(tx) > [13]> then\n            stop [this script v]\n        end\n    end\n    change [tick v] by (1)\n    Scroll (CAMERA X) (CAMERA Y)\n    position now\n    broadcast (game - loop obj v)\n    broadcast (game loop - particles v)\n    broadcast (game loop - scroll v)\nend\n\ndefine reset player\nif <(SFX) > [0]> then\n    start sound [Start v]\nend\nset [player state v] to []\nif <(SPAWN IDX) > [0]> then\n    set [player x v] to (((((SPAWN IDX) - (1)) mod (LSX)) * (60)) + (30))\n    set [player y v] to ((([floor v] of (((SPAWN IDX) - (1)) / (LSX)) ) * (60)) + (17))\nelse\n    set [player x v] to [128]\n    set [player y v] to [280]\nend\nset [mask char v] to []\ncheck square (PLAYER X) (PLAYER Y)\nrepeat until <(mask char) < [5]>\n    change [player y v] by (30)\n    set [mask char v] to []\n    check square (PLAYER X) (PLAYER Y)\nend\nset [player sx v] to [0]\nset [player sy v] to [0]\nset [player no slow v] to [0]\nset [is falling v] to [999]\nset [player wall v] to []\nset [extra bounce v] to [0]\nset [player dir v] to [1]\nset [player inv v] to [0]\nset [player substance v] to []\npoint in direction (90)\nSet Flipped [0]\n\nwhen I receive [bounce on head v]\nset [is falling v] to [0]\nset [is jumping v] to [1]\nset [extra bounce v] to [3]\n\ndefine game loop\nset [player death v] to []\nrepeat until <(GAME STATE) = [next level]>\n    if <(GAME STATE) = [MENU]> then\n        stop [this script v]\n    end\n    if <<key (r v) pressed?> and <key (q v) pressed?>> then\n        set [player death v] to [reset]\n    end\n    if <not <(GAME STATE) = [WIN]>> then\n        if <<key (p v) pressed?> or <(IN-GAME MENU) = [pause button]>> then\n            pause\n        end\n        if <(PLAYER DEATH) > []> then\n            if <([abs v] of (x position) ) < [240]> then\n                if <<(PLAYER INV) < [1]> or <(PLAYER DEATH) = [reset]>> then\n                    stop [this script v]\n                end\n            end\n            set [player death v] to []\n        end\n    end\n    change [ghost v] effect by (-10)\n    change [tick v] by (1)\n    if <(GAME STATE) = [PLAY]> then\n        change [time v] by (1)\n    end\n    broadcast (game - loop obj v)\n    broadcast (game loop - player v)\n    broadcast (game loop - particles v)\n    if <([wipe mode v] of [wipe v]) > []> then\n        broadcast (game loop - scroll v)\n    else\n        broadcast (game loop - scroll v) and wait\n    end\nend\n\ndefine Set Flipped Safe (dir)\nif <(dir) = (flipped)> then\n    \n        stop [this script v]\n    end\nend\nfail [pre flip]\nSet Flipped (dir)\nfail [post flip]\nset [safe v] to []\nset [safed v] to [64]\nfull overlap ((PLAYER X) - (item (4) of [psz v])) ((PLAYER Y) + (item (1) of [psz v])) dir [0] width ((item (4) of [psz v]) + (item (2) of [psz v]))\nif <<(toverlap) > []> and <(toverlap) < (safed)>> then\n    set [safe v] to [0]\n    set [safed v] to (toverlap)\nend\nfull overlap ((PLAYER X) - (item (4) of [psz v])) ((PLAYER Y) - (item (3) of [psz v])) dir [2] width ((item (4) of [psz v]) + (item (2) of [psz v]))\nif <<(toverlap) > []> and <(toverlap) < (safed)>> then\n    set [safe v] to [2]\n    set [safed v] to (toverlap)\nend\nfull overlap ((PLAYER X) - (item (4) of [psz v])) ((PLAYER Y) - (item (3) of [psz v])) dir [-1] width ((item (1) of [psz v]) + (item (3) of [psz v]))\nif <<(toverlap) > []> and <(toverlap) < (safed)>> then\n    set [safe v] to [-1]\n    set [safed v] to (toverlap)\nend\nfull overlap ((PLAYER X) + (item (2) of [psz v])) ((PLAYER Y) - (item (3) of [psz v])) dir [1] width ((item (1) of [psz v]) + (item (3) of [psz v]))\nif <<(toverlap) > []> and <(toverlap) < (safed)>> then\n    set [safe v] to [1]\n    set [safed v] to (toverlap)\nend\nif <(safe) > []> then\n    if <(EDIT) > [0]> then\n        stop [this script v]\n    end\n    add [UNSAFE] to [debug v]\n    add (safe) to [debug v]\n    add (safed) to [debug v]\n    if <(safe) > [0]> then\n        if <(safe) > [1]> then\n            change [player y v] by (safed)\n        else\n            change [player x v] by ((0) - (safed))\n        end\n    else\n        if <(safe) > [-1]> then\n            change [player y v] by ((0) - (safed))\n        else\n            change [player x v] by (safed)\n        end\n    end\n    resolve collisions  from [set flipped safe - post]\nend\n\ndefine full overlap (x) (y) dir (dir) width (dxy2)\nset [tx v] to (x)\nset [ty v] to (y)\nset [toverlap v] to []\nrepeat (4)\n    set [overlap v] to []\n    solid = is solid at (tx) (ty) dir (dir)\n    if <((dir) mod (2)) = [0]> then\n        solid = is solid at ((tx) + (dxy2)) (ty) dir (dir)\n    else\n        solid = is solid at (tx) ((ty) + (dxy2)) dir (dir)\n    end\n    if <(overlap) = []> then\n        stop [this script v]\n    end\n    change [overlap v] by (0.01)\n    change [toverlap v] by (overlap)\n    if <(dir) > [0]> then\n        if <(dir) = [1]> then\n            change [tx v] by ((0) - (overlap))\n        else\n            change [ty v] by (overlap)\n        end\n    else\n        if <(dir) = [-1]> then\n            change [tx v] by (overlap)\n        else\n            change [ty v] by ((0) - (overlap))\n        end\n    end\nend\n\ndefine fail (where)\nset [overlap v] to []\n\n    solid = is solid at ((PLAYER X) - (item (4) of [psz v])) ((PLAYER Y) - (item (3) of [psz v])) dir [0]\n    solid = is solid at ((PLAYER X) + (item (2) of [psz v])) ((PLAYER Y) - (item (3) of [psz v])) dir [0]\n    solid = is solid at ((PLAYER X) - (item (4) of [psz v])) ((PLAYER Y) + (item (1) of [psz v])) dir [0]\n    solid = is solid at ((PLAYER X) + (item (2) of [psz v])) ((PLAYER Y) + (item (1) of [psz v])) dir [0]\n    if <(overlap) > [0]> then\n        add (join (join [FAIL - ] (where)) (join [: ] (join (PLAYER STATE) (flipped)))) to [debug v]\n    end\nend\n\ndefine active block (dir)\nif <<(mask char) = [6]> and <not <[active idx v] contains (idx)?>>> then\n    add (idx) to [active idx v]\nend\nif <(mask char) = [7]> then\n    if <(((item (idx) of [map r v]) + (1)) mod (4)) = ((dir) mod (4))> then\n        if <(tile) = [50]> then\n            set [temp v] to [5]\n        else\n            set [temp v] to [-5]\n        end\n        if <(dir) = [2]> then\n            set [friction dx v] to (temp)\n        else\n            if <(dir) = [1]> then\n                set [friction dy v] to (temp)\n                set [friction v] to [1]\n            else\n                if <(dir) = [0]> then\n                    set [friction dx v] to ((0) - (temp))\n                else\n                    if <(dir) = [-1]> then\n                        set [friction dy v] to ((0) - (temp))\n                        set [friction v] to [1]\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine pause\nset [in-game menu v] to []\nbroadcast (pause menu v) and wait\n\n    repeat until <not <key (p v) pressed?>>\n        wait (0) seconds\n    end\n    repeat until <key (p v) pressed?>\n        wait (0) seconds\n    end\n    repeat until <not <key (p v) pressed?>>\n        wait (0) seconds\n    end\nend\n\ndefine process jump key pressed\nif <(KEY - UP) = [1]> then\n    if <([abs v] of (PLAYER WALL) ) = [1]> then\n        start wall jump\n    else\n        if <(is jumping) = [100]> then\n    end\nend\nif <<(is jumping) > [0]> and <(is jumping) < [5]>> then\n    if <(extra bounce) < [1]> then\n        if <(PLAYER SY) < [16]> then\n            set [player sy v] to [16]\n        end\n        change [is jumping v] by (1)\n    else\n        if <(PLAYER SY) < [16]> then\n            set [player sy v] to [16]\n        end\n    end\n    set [key - up v] to [2]\nend\n\ndefine Set TIME\nset [temp v] to ([floor v] of (((time) * (10)) / (30)) )\nset [time v] to ((temp) mod (10))\nset [temp v] to ([floor v] of ((temp) / (10)) )\nset [time v] to (join ((temp) mod (10)) (TIME))\nset [temp v] to ([floor v] of ((temp) / (10)) )\nset [time v] to (join ((temp) mod (6)) (TIME))\nset [temp v] to ([floor v] of ((temp) / (6)) )\nset [time v] to (join ((temp) mod (10)) (TIME))\nif <(temp) < [10]> then\n    set [time v] to (join [ ] (TIME))\nelse\n    set [temp v] to ([floor v] of ((temp) / (10)) )\n    set [time v] to (join ((temp) mod (10)) (TIME))\nend\n\nwhen I receive [edit - reload v]\nset [idx v] to (item # of [63] in [map v])\nif <(idx) > [0]> then\n    set [max camera x v] to ((((idx) mod (LSX)) + (-1.5)) * (60))\nelse\n    set [max camera x v] to [9999999]\nend\n\ndefine get block at (x) (y)\nset [idx v] to (([floor v] of ((x) / (60)) ) + (1))\nchange [idx v] by (([floor v] of ((y) / (60)) ) * (LSX))\nset [tile v] to (item (idx) of [map v])\nset [mask v] to (item (tile) of [mask v])\nif <((x) mod (60)) < [30]> then\n    if <((y) mod (60)) < [30]> then\n        set [mid v] to [1]\n    else\n        set [mid v] to [2]\n    end\nelse\n    if <((y) mod (60)) < [30]> then\n        set [mid v] to [0]\n    else\n        set [mid v] to [3]\n    end\nend\nset [mask char v] to (letter ((((mid) - (item (idx) of [map r v])) mod (4)) + (1)) of (mask))\n\ndefine resolve collisions <deep> from (label)\nif <(EDIT) > [0]> then\n    stop [this script v]\nend\ncheck square (PLAYER X) (PLAYER Y)\nif <(mask char) < [5]> then\n    stop [this script v]\nend\nif <deep> then\n    resolve (PLAYER X) (PLAYER Y) [10]\nelse\n    resolve (PLAYER X) (PLAYER Y) [4]\nend\n\n    add (label) to [debug v]\n    stop [all v]\nend\n\ndefine check square (x) (y)\nget block at ((x) - (item (4) of [psz v])) ((y) - (item (3) of [psz v]))\nif <(mask char) < [5]> then\n    get block at ((x) + (item (2) of [psz v])) ((y) - (item (3) of [psz v]))\n    if <(mask char) < [5]> then\n        set [overlap v] to []\n        solid = is solid at ((x) - (item (4) of [psz v])) ((y) + (item (1) of [psz v])) dir [0]\n        if <(overlap) = []> then\n            solid = is solid at ((x) + (item (2) of [psz v])) ((y) + (item (1) of [psz v])) dir [0]\n            if <(overlap) = []> then\n                get block at ((x) - (item (4) of [psz v])) (y)\n                if <(mask char) < [5]> then\n                    get block at ((x) + (item (2) of [psz v])) (y)\n                    if <(mask char) < [5]> then\n                        set [mask char v] to []\n                        stop [this script v]\n                    end\n                end\n            end\n        end\n    end\nend\nset [mask char v] to [9]\n\ndefine Can Get Up\nset [overlap v] to []\nif <(flipped) = [0]> then\n    if <(PLAYER WALL) = [0]> then\n        solid = is solid at ((PLAYER X) - (item (4) of [psz v])) (((PLAYER Y) - (item (3) of [psz v])) + (-8)) dir [0]\n        solid = is solid at ((PLAYER X) + (item (2) of [psz v])) (((PLAYER Y) - (item (3) of [psz v])) + (-8)) dir [0]\n    else\n        solid = is solid at ((PLAYER X) - (item (4) of [psz v])) (((PLAYER Y) + (item (1) of [psz v])) + (8)) dir [0]\n        solid = is solid at ((PLAYER X) + (item (2) of [psz v])) (((PLAYER Y) + (item (1) of [psz v])) + (8)) dir [0]\n    end\nelse\n    if <(flipped) = [1]> then\n        solid = is solid at (((PLAYER X) - (item (4) of [psz v])) + (-8)) ((PLAYER Y) + (item (1) of [psz v])) dir [1]\n        solid = is solid at (((PLAYER X) - (item (4) of [psz v])) + (-8)) ((PLAYER Y) - (item (3) of [psz v])) dir [1]\n    else\n        if <(flipped) = [2]> then\n            solid = is solid at ((PLAYER X) - (item (4) of [psz v])) (((PLAYER Y) - (item (3) of [psz v])) + (-8)) dir [2]\n            solid = is solid at ((PLAYER X) + (item (2) of [psz v])) (((PLAYER Y) - (item (3) of [psz v])) + (-8)) dir [2]\n        else\n            solid = is solid at (((PLAYER X) + (item (2) of [psz v])) + (8)) ((PLAYER Y) + (item (1) of [psz v])) dir [-1]\n            solid = is solid at (((PLAYER X) + (item (2) of [psz v])) + (8)) ((PLAYER Y) - (item (3) of [psz v])) dir [-1]\n        end\n    end\nend\n\nwhen I receive [order v]\nshow\n\nwhen I receive [menu tick v]\nposition now\nset [flipped v] to [0]\nset [player state v] to []\nset [player wall v] to []\nset [player dir v] to [1]\nset [player inv v] to [0]\nset [player substance v] to []\npoint in direction (90)\n\nwhen I receive [back to main menu v]\nstop [other scripts in sprite v]\n\ndefine recorder\nif <(REPLAY IDX) = []> then\n    if <not <(temp) = (key state)>> then\n        set [key state v] to (temp)\n        add (TICK) to [black box v]\n        add (key state) to [black box v]\n    end\n    stop [this script v]\nend\nset [temp v] to (item (REPLAY IDX) of [black box v])\nif <<(temp) > []> and <not <(TICK) < (temp)>>> then\n    change [replay idx v] by (1)\n    set [key state v] to (item (REPLAY IDX) of [black box v])\n    change [replay idx v] by (1)\nend\nset [key - dir v] to []\nset [temp v] to (key state)\nif <(temp) > [7]> then\n    change [temp v] by (-8)\n    if <(KEY - UP) < [1]> then\n        set [key - up v] to [1]\n    end\n    set [key - dir v] to [-1]\nelse\n    set [key - up v] to [0]\nend\nif <(temp) > [3]> then\n    change [temp v] by (-4)\n    set [key - down v] to [1]\n    set [key - dir v] to [2]\nelse\n    set [key - down v] to [0]\nend\nif <(temp) > [1]> then\n    change [temp v] by (-2)\n    if <(KEY - LEFT) < [1]> then\n        set [key - left v] to [1]\n    end\n    set [key - dir v] to [-1]\nelse\n    set [key - left v] to [0]\nend\nif <(temp) > [0]> then\n    if <(KEY - RIGHT) < [1]> then\n        set [key - right v] to [1]\n    end\n    set [key - dir v] to [1]\nelse\n    set [key - right v] to [0]\nend\n\nwhen flag clicked\nset [replay idx v] to []\n\ndefine init black box\nset [key state v] to [0]\ndelete all of [black box v]\nadd (username) to [black box v]\nadd [] to [black box v]\nadd (LEVEL #) to [black box v]\nadd (TICK) to [black box v]\n\ndefine init replay\nset [replay idx v] to (length of [black box v])\nrepeat until <(item (REPLAY IDX) of [black box v]) = []>\n    change [replay idx v] by (-1)\nend\nchange [replay idx v] by (3)\nset [key state v] to [0]\n\nwhen [0 v] key pressed\nset [replay idx v] to (length of [black box v])\n\nget block at ((x) - (item (4) of [psz v])) ((y) + (item (1) of [psz v]))\nif <(mask char) < [5]> then\n    get block at ((x) + (item (2) of [psz v])) ((y) + (item (1) of [psz v]))\n    if <(mask char) < [5]> then\n        stop [this script v]\n    end\nend\n\nset [temp v] to (((PLAYER Y) - (item (3) of [psz v])) mod (30))\nif <(temp) > [26]> then\n    change [player y v] by ((30) - (temp))\nend\nchange [player x v] by (-2)\ncheck square (PLAYER X) (PLAYER Y)\nif <(mask char) < [5]> then\n    stop [this script v]\nend\nchange [player x v] by (4)\ncheck square (PLAYER X) (PLAYER Y)\nif <(mask char) < [5]> then\n    stop [this script v]\nend\nchange [player x v] by (-2)\nchange [player y v] by (-2)\ncheck square (PLAYER X) (PLAYER Y)\nif <(mask char) < [5]> then\n    stop [this script v]\nend\nchange [player y v] by (4)\ncheck square (PLAYER X) (PLAYER Y)\nif <(mask char) < [5]> then\n    stop [this script v]\nend\nchange [player y v] by (-2)\nchange [player x v] by (-4)\ncheck square (PLAYER X) (PLAYER Y)\nif <(mask char) < [5]> then\n    stop [this script v]\nend\nchange [player x v] by (8)\ncheck square (PLAYER X) (PLAYER Y)\nif <(mask char) < [5]> then\n    stop [this script v]\nend\nchange [player x v] by (-4)\nchange [player y v] by (-4)\ncheck square (PLAYER X) (PLAYER Y)\nif <(mask char) < [5]> then\n    stop [this script v]\nend\nchange [player y v] by (8)\ncheck square (PLAYER X) (PLAYER Y)\nif <(mask char) < [5]> then\n    stop [this script v]\nend\nchange [player y v] by (-4)\nset [player death v] to [spike]\nstop [all v]\n\ndefine full level reset\nbroadcast (EDIT - Remove Clones v) and wait\nwait (0.03) seconds\nbroadcast (EDIT - Load v) and wait\nwait (0.03) seconds\nbroadcast (EDIT - Reload v) and wait\nrepeat until <not <key (q v) pressed?>>\n    wait (0) seconds\nend\nbroadcast (start v)\n\nresolve collisions <> from []\n\ndefine resolve (x) (y) (deep)\nset [i2 v] to [0]\nrepeat (deep)\n    change [i2 v] by (1)\n    set [i3 v] to [-1]\n    repeat (8)\n        change [i3 v] by (2)\n        set [player x v] to ((x) + ((item (i3) of [resolve v]) * (i2)))\n        set [player y v] to ((y) + ((item ((i3) + (1)) of [resolve v]) * (i2)))\n        check square (PLAYER X) (PLAYER Y)\n        if <(mask char) < [5]> then\n            stop [this script v]\n        end\n    end\nend\nset [player x v] to (x)\nset [player y v] to (y)\nset [player death v] to [spike]\n\nresolve (PLAYER X) (PLAYER Y) [32]\n\nadd (PLAYER X) to [debug v]\nadd (PLAYER Y) to [debug v]\n\nset [player death v] to []\nstop [all v]\n\nwhen I receive [_order v]\norder [-1000]\n\ndefine order (this z)\nif <(this z) < (item (1) of [order v])> then\n    set [i1 v] to [2]\n    set [i2 v] to (length of [order v])\n    repeat until <(i1) > (i2)>\n        set [last z v] to ([floor v] of ((i1) + (((i2) - (i1)) / (5))) )\n        if <(this z) > (item (last z) of [order v])> then\n            set [i2 v] to ((last z) - (1))\n        else\n            set [i1 v] to ((last z) + (1))\n        end\n    end\n    insert (this z) at (i1) of [order v] \n    go [forward v] ((i1) - (1)) layers\nelse\n    insert (this z) at (1) of [order v] \nend\n\nwhen I receive [report order v]\nadd (join [Player ] (costume [name v])) to [debug v]\n\n@Levels\n\nwhen flag clicked\ngo to [back v] layer\ndelete all of [level code v]\n\n    delete all of [debug v]\n    if <(PRODUCTION) > [0]> then\n        set [level # v] to [1]\n    end\n    Load Level (LEVEL #)\n    set [clones v] to [0]\n    broadcast (setup - background v) and wait\n    broadcast (setup - level v) and wait\n    broadcast (start v)\nend\n\ndefine setup (lsx) (lsy)\nif <(lsx) > [0]> then\n    set [lsx v] to (lsx)\nelse\n    set [lsx v] to [140]\nend\nif <(lsy) > [0]> then\n    set [val v] to (lsy)\nelse\n    set [val v] to [80]\nend\ndelete all of [map v]\ndelete all of [map r v]\ndelete all of [map data v]\ndelete all of [wall v]\nrepeat (3)\n    repeat (LSX)\n        add [2] to [map v]\n        add [1] to [map r v]\n    end\nend\nrepeat ((LSX) * ((val) - (3)))\n    add [1] to [map v]\n    add [1] to [map r v]\nend\n\ndefine Save Level (level #)\n\n    stop [this script v]\nend\ndelete all of [append v]\nadd (LSX) to [append v]\nif <[Save] = [Map Tiles]> then\nset [idx v] to [1]\nset [len v] to [1]\nset [tile v] to (item (idx) of [map v])\nrepeat ((length of [map v]) - (1))\n    change [idx v] by (1)\n    if <(tile) = (item (idx) of [map v])> then\n        change [len v] by (1)\n    else\n        add (tile) to [append v]\n        add (len) to [append v]\n        set [len v] to [1]\n        set [tile v] to (item (idx) of [map v])\n    end\nend\nadd (tile) to [append v]\nadd (len) to [append v]\nif <[Save] = [Rotation of Map Tiles]> then\nadd [] to [append v]\nset [idx v] to [1]\nset [len v] to [1]\nset [tile v] to ((item (idx) of [map r v]) + (0))\nrepeat ((length of [map v]) - (1))\n    change [idx v] by (1)\n    if <(tile) = ((item (idx) of [map r v]) + (0))> then\n        change [len v] by (1)\n    else\n        add (tile) to [append v]\n        add (len) to [append v]\n        set [len v] to [1]\n        set [tile v] to ((item (idx) of [map r v]) + (0))\n    end\nend\nadd (tile) to [append v]\nadd (len) to [append v]\nif <[Save] = [Tile Supplementary Data]> then\nadd [] to [append v]\nset [idx v] to [1]\nrepeat (length of [map data v])\n    add (item (idx) of [map data v]) to [append v]\n    change [idx v] by (1)\nend\nif <[Save] = [The Wall \(background\)]> then\nadd [] to [append v]\nset [idx v] to [1]\nrepeat (length of [wall v])\n    add (item (idx) of [wall v]) to [append v]\n    change [idx v] by (1)\nend\nadd [] to [append v]\nadd (HUE) to [append v]\nadd (HUE #2) to [append v]\nif <[Save] = [Bung it in the level list]> then\nrepeat ((level #) - (length of [levels v]))\n    add [] to [levels v]\nend\nreplace item (level #) of [levels v] with (append)\ndelete all of [level code v]\nadd (append) to [level code v]\ndelete all of [append v]\n\ndefine Load Level (level #)\ndelete all of [map v]\ndelete all of [map r v]\ndelete all of [map data v]\ndelete all of [wall v]\ndelete all of [active idx v]\ndelete all of [group v]\nset [idx v] to [1]\nset [len v] to (item (level #) of [levels v])\nval = Read()\nset [lsx v] to (val)\nval = Read()\nrepeat until <(val) = []>\n    set [tile v] to (val)\n    val = Read()\n    repeat (val)\n        add (tile) to [map v]\n    end\n    val = Read()\nend\nif <(idx) > (length of (len))> then\n    repeat (length of [map v])\n        add [1] to [map r v]\n    end\n    stop [this script v]\nend\nval = Read()\nrepeat until <(val) = []>\n    set [tile v] to (val)\n    val = Read()\n    repeat (val)\n        add (tile) to [map r v]\n    end\n    val = Read()\nend\nval = Read()\nrepeat until <(val) = []>\n    add (val) to [map data v]\n    val = Read()\nend\nval = Read()\nrepeat until <(val) = []>\n    add (val) to [wall v]\n    val = Read()\nend\nval = Read()\nif <(val) > []> then\n    set [hue v] to (val)\n    val = Read()\n    set [hue #2 v] to (val)\nelse\n    set [hue v] to [0]\n    set [hue #2 v] to [0]\nend\n\nset [level # v] to [10]\n\ndefine val = Read()\nset [val v] to []\nforever\n    set [c v] to (letter (idx) of (len))\n    change [idx v] by (1)\n    if <<(c) = []> or <(c) = [ ]>> then\n        stop [this script v]\n    end\n    set [val v] to (join (val) (c))\nend\n\nwhen I receive [edit - save v]\nSave Level (LEVEL #)\n\nwhen I receive [edit - load v]\nset [apples v] to [0]\nLoad Level (LEVEL #)\n\nLoad Level (LEVEL #)\n\ndefine fix up <enable>\nif <enable> then\n    set [idx v] to [2]\n    repeat (length of [wall v])\n        set [c v] to (item (idx) of [wall v])\n        if <<(c) = [1]> or <(c) = [2]>> then\n            set [c v] to (item ((idx) - (1)) of [wall v])\n            replace item ((idx) - (1)) of [wall v] with ((c) + (-1))\n        end\n        change [idx v] by (2)\n    end\nend\n\ndefine insert x (x) width (w)\nif <(x) < [1]> then\n    stop [this script v]\nend\nset [idx v] to (x)\nrepeat ((length of [map v]) / (LSX))\n    repeat (w)\n        insert [1] at (idx) of [map v] \n        insert [0] at (idx) of [map r v] \n        change [idx v] by (1)\n    end\n    change [idx v] by (LSX)\nend\nset [c v] to [-1]\nrepeat (length of [map data v])\n    change [c v] by (2)\n    set [idx v] to (item (c) of [map data v])\n    change [idx v] by ((w) * ([floor v] of (((idx) - (1)) / (LSX)) ))\n    if <(((idx) - (1)) mod (LSX)) > ((x) - (1))> then\n        change [idx v] by (w)\n    end\n    replace item (c) of [map data v] with (join [+] (idx))\nend\nchange [lsx v] by (w)\n\ninsert x [4] width [2]\n\ninsert x [129] width [32]\n\nSave Level (LEVEL #)\n\ndefine Add blank level (level) width (width) height (height)\nset [level # v] to (level)\nsetup (width) (width)\nSave Level (level)\n\nAdd blank level [12] width [196] height [80]\n\ninsert x ((LSX) + (1)) width [32]\n\nwhen I receive [edit - new level v]\nAdd blank level [12] width [196] height [80]\n\nwhen I receive [edit - import level v]\nreplace item (12) of [levels v] with (item (1) of [level code v])\n\nwhen I receive [report order v]\nadd (join [Levels ] (costume [name v])) to [debug v]\n\n@Foreground\n\ndefine position\nif <((x) - (CAMERA X)) > [240]> then\n    change [x v] by (-540)\n    change [id v] by (-9)\nelse\n    if <((x) - (CAMERA X)) < [-300]> then\n        change [x v] by (540)\n        change [id v] by (9)\n    end\nend\nif <((y) - (CAMERA Y)) > [180]> then\n    change [y v] by (-420)\n    change [id v] by ((-7) * (LSX))\nelse\n    if <((y) - (CAMERA Y)) < [-240]> then\n        change [y v] by (420)\n        change [id v] by ((7) * (LSX))\n    end\nend\nset [tile v] to (item (id) of [map v])\nset [mask v] to (item (tile) of [mask v])\nif <<(EDIT) = [1]> or <(letter (6) of (mask)) = [ ]>> then\n    if <(tile) > [1]> then\n        if <<([abs v] of (((x) - (CAMERA X)) + (30)) ) > [210]> or <([abs v] of (((y) - (CAMERA Y)) + (30)) ) > [150]>> then\n            switch costume to (big v)\n        end\n        if <(letter (9) of (mask)) = [h]> then\n            set [color v] effect to (HUE)\n        else\n            set [color v] effect to (0)\n        end\n        if <(tile) = [50]> then\n            change [tile v] by ((([floor v] of (TICK) ) mod (6)) + (2))\n        else\n            if <(tile) = [51]> then\n                change [tile v] by ((([floor v] of ((0) - (TICK)) ) mod (6)) + (1))\n            end\n        end\n        go to x: (((x) - (CAMERA X)) + (30)) y: (((y) - (CAMERA Y)) + (30))\n        point in direction ((item (id) of [map r v]) * (90))\n    end\n    switch costume to (tile)\nelse\n    switch costume to (blank v)\n    if <(tile) = [22]> then\n        shift camera away ((x) - (CAMERA X)) ((y) - (CAMERA Y))\n    end\nend\n\nwhen flag clicked\nset [x v] to [0]\nset [y v] to [0]\nswitch costume to (big v)\n\nwhen I receive [game loop - scroll v]\nif <(id) = []> then\n    edit\nelse\n    position\nend\n\ndefine clone\nshow\nset [id v] to [1]\nset [uid v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nrepeat (7)\n    repeat (9)\n        create clone of (_myself_ v)\n        change [id v] by (1)\n        change [uid v] by (1)\n        change [x v] by (60)\n    end\n    change [id v] by ((LSX) - (9))\n    change [y v] by (60)\n    change [x v] by ((-9) * (60))\nend\nset [id v] to []\nset [uid v] to []\nhide\n\ndefine edit\nif <not <(EDIT) = [1]>> then\n    if <(x) > []> then\n        stop [this script v]\n    end\nend\nset [x v] to ([x v] of [editor v])\nif <(x) = [-999]> then\n    hide\n    stop [this script v]\nend\nset [y v] to ([y v] of [editor v])\nset [mask v] to (item ([brush v] of [editor v]) of [mask v])\nif <(letter (9) of (mask)) = [h]> then\n    set [color v] effect to (HUE)\nelse\n    set [color v] effect to (0)\nend\ngo to x: (((x) - (CAMERA X)) + (30)) y: (((y) - (CAMERA Y)) + (30))\npoint in direction (([brush r v] of [editor v]) * (90))\nswitch costume to ([brush v] of [editor v])\nset [ghost v] effect to (10)\ngo to [front v] layer\nshow\n\ndefine shift camera away (dx) (dy)\nif <(dy) > [0]> then\n    set [camera shift dy v] to ((y) - (40))\nend\n\nwhen I receive [order v]\nclone\n\nwhen I start as a clone\nchange [clones v] by (1)\n\nwhen I receive [edit - remove clones v]\nif <(id) = []> then\n    hide\n    go to [back v] layer\n    go [forward v] (11) layers\nend\n\nwhen I receive [start v]\nremap\n\nwhen I receive [edit - remap width v]\nremap\n\ndefine remap\nif <(uid) > []> then\n    set [x v] to ((uid) mod (9))\n    set [y v] to ([floor v] of ((uid) / (9)) )\n    set [id v] to ((((y) * (LSX)) + (x)) + (1))\n    set [x v] to ((x) * (60))\n    set [y v] to ((y) * (60))\nend\n\ndefine order (this z)\nif <(this z) < (item (1) of [order v])> then\n    set [i1 v] to [2]\n    set [i2 v] to (length of [order v])\n    repeat until <(i1) > (i2)>\n        set [last z v] to ([floor v] of ((i1) + (((i2) - (i1)) / (5))) )\n        if <(this z) > (item (last z) of [order v])> then\n            set [i2 v] to ((last z) - (1))\n        else\n            set [i1 v] to ((last z) + (1))\n        end\n    end\n    insert (this z) at (i1) of [order v] \n    go [forward v] ((i1) - (1)) layers\nelse\n    insert (this z) at (1) of [order v] \nend\n\nwhen I receive [_order v]\norder [-1100]\n\nwhen I receive [report order v]\nadd (join [Foreground ] (costume [name v])) to [debug v]\n\n@Background\n\ndefine position\nif <(id) > []> then\n    if <((x) - (CAMERA X)) > [240]> then\n        change [x v] by (-540)\n        change [id v] by (-9)\n    else\n        if <((x) - (CAMERA X)) < [-300]> then\n            change [x v] by (540)\n            change [id v] by (9)\n        end\n    end\n    if <((y) - (CAMERA Y)) > [180]> then\n        change [y v] by (-420)\n        change [id v] by ((-7) * (LSX))\n    else\n        if <((y) - (CAMERA Y)) < [-240]> then\n            change [y v] by (420)\n            change [id v] by ((7) * (LSX))\n        end\n    end\n    set [tile v] to (item (id) of [map v])\n    set [mask v] to (item (tile) of [mask v])\n    if <<(EDIT) = [1]> or <(letter (6) of (mask)) = [ ]>> then\n        set [color v] effect to (HUE #2)\n        if <(tile) > [1]> then\n            if <<([abs v] of (((x) - (CAMERA X)) + (30)) ) > [210]> or <([abs v] of (((y) - (CAMERA Y)) + (30)) ) > [150]>> then\n                switch costume to (big v)\n            end\n            if <(tile) = [15]> then\n                go to x: (((x) - (CAMERA X)) + (30)) y: (((y) - (CAMERA Y)) + ((30) + ((6) * ([sin v] of ((((x) + (y)) + (TICK)) * (5)) ))))\n                set [color v] effect to (0)\n            else\n                if <<(tile) = [26]> or <(tile) = [63]>> then\n                    change [tile v] by ([abs v] of ((([floor v] of ((TICK) / (3)) ) mod (8)) - (3)) )\n                    set [color v] effect to (0)\n                else\n                    if <(tile) = [25]> then\n                        set [color v] effect to (0)\n                    end\n                end\n                go to x: (((x) - (CAMERA X)) + (30)) y: (((y) - (CAMERA Y)) + (30))\n            end\n            point in direction ((item (id) of [map r v]) * (90))\n        end\n        switch costume to (tile)\n    else\n        switch costume to (blank v)\n    end\nend\n\nwhen I receive [game loop - scroll v]\nif <(id) = []> then\n    edit\nelse\n    position\nend\n\ndefine clone\nshow\nset [uid v] to [0]\nset [id v] to [1]\nset [x v] to [0]\nset [y v] to [0]\nrepeat (7)\n    repeat (9)\n        create clone of (_myself_ v)\n        change [id v] by (1)\n        change [uid v] by (1)\n        change [x v] by (60)\n    end\n    change [id v] by ((LSX) - (9))\n    change [y v] by (60)\n    change [x v] by ((-9) * (60))\nend\nset [id v] to []\nset [uid v] to []\nhide\n\nwhen I receive [setup - level v]\ngo to [back v] layer\ngo [forward v] (11) layers\nclone\n\ndefine edit\nif <not <(EDIT) = [1]>> then\n    if <(x) > []> then\n        hide\n        set [x v] to []\n    end\n    stop [this script v]\nend\nset [x v] to ([x v] of [editor v])\nif <(x) = [-999]> then\n    hide\n    stop [this script v]\nend\nset [y v] to ([y v] of [editor v])\nset [mask v] to (item ([brush v] of [editor v]) of [mask v])\nif <(letter (9) of (mask)) = [h]> then\n    set [color v] effect to (HUE)\nelse\n    set [color v] effect to (0)\nend\ngo to x: (((x) - (CAMERA X)) + (30)) y: (((y) - (CAMERA Y)) + (30))\npoint in direction (([brush r v] of [editor v]) * (90))\nswitch costume to ([brush v] of [editor v])\nset [ghost v] effect to (33)\nshow\n\nwhen I start as a clone\nchange [clones v] by (1)\n\nwhen I receive [check spikes v]\nif <(letter (1) of (costume [name v])) = [.]> then\n    if <touching (player v)?> then\n        set [player death v] to [spike]\n    end\nend\n\nwhen I receive [start v]\nremap\n\ndefine remap\nif <(uid) > []> then\n    set [x v] to ((uid) mod (9))\n    set [y v] to ([floor v] of ((uid) / (9)) )\n    set [id v] to ((((y) * (LSX)) + (x)) + (1))\n    set [x v] to ((x) * (60))\n    set [y v] to ((y) * (60))\nend\n\nwhen I receive [edit - remap width v]\nremap\n\ndefine order (this z)\nif <(this z) < (item (1) of [order v])> then\n    set [i1 v] to [2]\n    set [i2 v] to (length of [order v])\n    repeat until <(i1) > (i2)>\n        set [last z v] to ([floor v] of ((i1) + (((i2) - (i1)) / (5))) )\n        if <(this z) > (item (last z) of [order v])> then\n            set [i2 v] to ((last z) - (1))\n        else\n            set [i1 v] to ((last z) + (1))\n        end\n    end\n    insert (this z) at (i1) of [order v] \n    go [forward v] ((i1) - (1)) layers\nelse\n    insert (this z) at (1) of [order v] \nend\n\nwhen I receive [_order v]\norder [-200]\n\nwhen I receive [report order v]\nadd (join [Background ] (costume [name v])) to [debug v]\n\n@Dynamic\n\nwhen flag clicked\ngo to [back v] layer\nhide\npoint in direction (90)\nset [obj* v] to [7]\ndelete all of [obj v]\n\nwhen I receive [game - loop obj v]\nif <(id) > []> then\n    move (mob x) (mob y)\nend\n\nwhen I receive [game loop - scroll v]\nif <<([abs v] of ((mob x) - (CAMERA X)) ) > [240]> or <([abs v] of ((mob y) - (CAMERA Y)) ) > [180]>> then\n    switch costume to (big v)\nend\ngo to x: ((mob x) - (CAMERA X)) y: ((mob y) - (CAMERA Y))\nif <(typ) = [82]> then\n    switch costume to (stomp-teeth v)\n    Check Touching Death\n    if <<(state) = [1]> and <(frame) > [0]>> then\n        switch costume to (stomp-02 v)\n    else\n        switch costume to (stomp-01 v)\n    end\nelse\n    if <(typ) = [83]> then\n        switch costume to (crumble-6 v)\n    else\n        if <(typ) = [84]> then\n            if <(frame) < [1]> then\n                switch costume to (burtha v)\n                set [color v] effect to (HUE)\n            else\n                if <(frame) < [50]> then\n                    if <((frame) mod (10)) < [5]> then\n                        switch costume to (burtha v)\n                        set [color v] effect to (HUE)\n                    else\n                        switch costume to (burtha2 v)\n                        set [color v] effect to (0)\n                        if <((frame) mod (5)) = [0]> then\n                            if <(SFX) > [0]> then\n                                start sound [grunt v]\n                            end\n                        end\n                    end\n                else\n                    switch costume to (burtha3 v)\n                    if <touching (player v)?> then\n                        if <(EDIT) < [1]> then\n                            set [player death v] to [1]\n                        end\n                    end\n                end\n            end\n        else\n            if <(variation) < [2]> then\n                switch costume to (green-1100 v)\n            else\n                if <(variation) = [4]> then\n                    switch costume to (green-v3-teeth v)\n                    Check Touching Death\n                    switch costume to (green-v3 v)\n                else\n                    switch costume to (green-v2-teeth v)\n                    Check Touching Death\n                    switch costume to (green-v2 v)\n                end\n            end\n        end\n    end\nend\n\ndefine move (ox) (oy)\nif <((PLAYER X) + (item (2) of [psz v])) > ((nx) - (sx))> then\n    if <((PLAYER X) - (item (4) of [psz v])) < ((nx) + (sx))> then\n        if <((PLAYER Y) + (item (1) of [psz v])) > ((ny) - (sy))> then\n            if <((PLAYER Y) - (item (3) of [psz v])) < ((ny) + (sy))> then\n                if <(EDIT) < [1]> then\n                    change [player x v] by ((nx) - (mob x))\n                    change [player y v] by ((ny) - (mob y))\n                end\n            end\n        end\n    end\nend\nreplace item ((id) + (6)) of [obj v] with ((nx) - (mob x))\nreplace item ((id) + (7)) of [obj v] with ((ny) - (mob y))\nset [mob x v] to (nx)\nset [mob y v] to (ny)\nreplace item ((id) + (1)) of [obj v] with [lift]\nreplace item ((id) + (2)) of [obj v] with (mob x)\nreplace item ((id) + (3)) of [obj v] with (mob y)\nreplace item ((id) + (4)) of [obj v] with (sx)\nreplace item ((id) + (5)) of [obj v] with (sy)\nif <not <(item (group) of [group v]) = [hold]>> then\n    if <(typ) < [82]> then\n        saw\n    else\n        if <(typ) < [83]> then\n            drop\n        else\n            if <(typ) < [85]> then\n                burtha\n            end\n        end\n    end\nend\n\ndefine init\nset size to (100) %\nshow\nset [id v] to [0]\nset [idx v] to [0]\nrepeat (length of [map v])\n    change [idx v] by (1)\n    set [typ v] to (item (idx) of [map v])\n    set [temp v] to (item (typ) of [mask v])\n    if <(letter (6) of (temp)) > []> then\n        spawn (join (letter (5) of (temp)) (letter (6) of (temp)))\n    end\nend\nset [id v] to []\nhide\n\nwhen I receive [setup - level v]\ngo to [front v] layer\ngo [backward v] (GUI SPRITE #) layers\ninit\n\ndefine spawn (typ)\nset [color v] effect to (0)\nset [typ v] to (typ)\nset [variation v] to []\nif <(typ) < [80]> then\n    stop [this script v]\nend\nset [state v] to []\nset [frame v] to []\nset [id v] to (length of [obj v])\nrepeat (OBJ*)\n    add [] to [obj v]\nend\nset [root x v] to (((((idx) - (1)) mod (LSX)) * (60)) + (30))\nset [root y v] to ((([floor v] of (((idx) - (1)) / (LSX)) ) * (60)) + (30))\ndelete all of [cmds v]\nset [dx v] to (item # of (join [+] (idx)) in [map data v])\nif <(dx) > [0]> then\n    parse commands (item ((dx) + (1)) of [map data v])\nend\nset [c v] to (item # of [g] in [cmds v])\nif <(c) > [0]> then\n    set [group v] to (item ((c) + (1)) of [cmds v])\nelse\n    set [group v] to []\nend\nset [c v] to (item # of [a] in [cmds v])\nif <(c) > [0]> then\n    set [acc v] to ((item ((c) + (1)) of [cmds v]) / (100))\nelse\n    set [acc v] to [0.15]\nend\nset [dx v] to [0]\nset [dy v] to [0]\npoint in direction ((90) * (item (idx) of [map r v]))\nif <((direction) mod (180)) = [90]> then\n    set [sx v] to [30]\n    set [sy v] to [15]\nelse\n    set [sx v] to [15]\n    set [sy v] to [30]\nend\nif <(typ) = [80]> then\n    init [30] [15] [0] [15] ((direction) / (90))\nelse\n    if <(typ) = [81]> then\n        init [30] [15] [0] [15] ((direction) / (90))\n        set [dir v] to ((((dir) + (2)) mod (4)) - (1))\n    else\n        if <(typ) = [82]> then\n            set [color v] effect to (HUE)\n            set [dir v] to ((((item (idx) of [map r v]) + (2)) mod (4)) - (1))\n            set [speed v] to [0]\n            set [sx v] to [30]\n            set [sy v] to [30]\n            set [frame v] to [30]\n            set [c v] to (item # of [d] in [cmds v])\n            set [delay v] to [30]\n            if <(c) > [0]> then\n                set [delay v] to (item ((c) + (1)) of [cmds v])\n            end\n            change dxy (dir) [1] [1]\n            set [reach v] to (item # of [m] in [cmds v])\n            if <(reach) > [0]> then\n                set [reach v] to ((item ((reach) + (1)) of [cmds v]) * (30))\n            end\n        else\n            if <(typ) = [83]> then\n                change [root y v] by (15)\n            else\n                if <(typ) = [84]> then\n                    change [root x v] by (30)\n                    change [root y v] by (30)\n                    set [sx v] to [60]\n                    set [sy v] to [60]\n                    set [frame v] to [0]\n                    set [color v] effect to (HUE)\n                end\n            end\n        end\n    end\nend\nset [c v] to (item # of [h] in [cmds v])\nif <(c) > [0]> then\n    set [frame v] to (item ((c) + (1)) of [cmds v])\nend\nset [nx v] to (root x)\nset [ny v] to (root y)\nset [mob x v] to (nx)\nset [mob y v] to (ny)\ncreate clone of (_myself_ v)\n\ndefine solid = is solid at (x) (y) dir (dir) solid (schk) <spikeissolid>\nset [idx v] to (([floor v] of ((x) / (60)) ) + (1))\nchange [idx v] by (([floor v] of ((y) / (60)) ) * (LSX))\nset [tile v] to (item (idx) of [map v])\nset [mask v] to (item (tile) of [mask v])\nif <((x) mod (60)) < [30]> then\n    if <((y) mod (60)) < [30]> then\n        set [mid v] to [1]\n    else\n        set [mid v] to [2]\n    end\nelse\n    if <((y) mod (60)) < [30]> then\n        set [mid v] to [0]\n    else\n        set [mid v] to [3]\n    end\nend\nset [c v] to (letter ((((mid) - (item (idx) of [map r v])) mod (4)) + (1)) of (mask))\nif <<spikeissolid> and <(c) = [.]>> then\n    set [c v] to [9]\nend\nif <(c) > (schk)> then\n    if <(dir) > [0]> then\n        if <(dir) = [1]> then\n            set [temp v] to ((x) mod (30))\n        else\n            set [temp v] to ((30) - ((y) mod (30)))\n        end\n    else\n        if <(dir) = [-1]> then\n            set [temp v] to ((30) - ((x) mod (30)))\n        else\n            set [temp v] to ((y) mod (30))\n        end\n    end\n    if <(temp) > (overlap)> then\n        set [overlap v] to (temp)\n        set [solid v] to [1]\n    end\nend\n\ndefine saw\nchange [frame v] by (-1)\nif <(frame) > [0]> then\n    stop [this script v]\nend\nset [overlap v] to []\nset [collide v] to [0]\nif <(dir) < [2]> then\n    if <(dir) = [0]> then\n        accelerate dy [1]\n    else\n        accelerate dx [1]\n    end\nelse\n    if <(dir) = [2]> then\n        accelerate dy [-1]\n    else\n        accelerate dx [-1]\n    end\nend\nchange [nx v] by (round (dx))\nchange [ny v] by (round (dy))\nif <(overlap) > []> then\n    if <(collide) > [0]> then\n        set [dx v] to [0]\n        set [dy v] to [0]\n        set [c v] to (item # of [d] in [cmds v])\n        if <(c) > [0]> then\n            set [frame v] to (item ((c) + (1)) of [cmds v])\n        else\n            set [frame v] to [5]\n        end\n        set [nx v] to ((round ((nx) / (15))) * (15))\n        set [ny v] to ((round ((ny) / (15))) * (15))\n    else\n        set [dir v] to (((dir) + (2)) mod (4))\n    end\nend\n\ndefine drop\nchange [frame v] by (-1)\nif <(frame) > [0]> then\n    stop [this script v]\nend\nset [overlap v] to []\nset [dist x v] to ([floor v] of ((([abs v] of ((mob x) - (CAMERA X)) ) - (0)) / (80)) )\nif <(dist x) < [1]> then\n    set [dist x v] to [1]\nend\nif <(state) = []> then\n    if <(frame) = [0]> then\n        if <(dist x) < [4]> then\n            if <([abs v] of ((mob y) - (CAMERA Y)) ) < [180]> then\n                if <(SFX) > [0]> then\n                    start sound (join [woosh] (dist x))\n                end\n            end\n        end\n    end\n    change [speed v] by (2)\n    if <(speed) > [30]> then\n        set [speed v] to [30]\n    end\n    change [nx v] by (round ((dx) * (speed)))\n    change [ny v] by (round ((dy) * (speed)))\n    solid = is solid at ((nx) + ((dx) * (sx))) ((ny) + ((dy) * (sy))) dir (dir) solid [0] \n    if <(reach) > [0]> then\n        set [temp v] to (([abs v] of ((ny) - (root y)) ) - (reach))\n        if <<(temp) > [0]> or <<(dir) = [0]> and <(temp) = [0]>>> then\n            set [overlap v] to (([abs v] of ((ny) - (root y)) ) - (reach))\n        end\n    end\n    if <(overlap) > []> then\n        change [nx v] by ((0) - ((dx) * (overlap)))\n        change [ny v] by ((0) - ((dy) * (overlap)))\n        set [state v] to [1]\n        set [speed v] to [0]\n        set [frame v] to [15]\n        if <(dist x) < [4]> then\n            if <([abs v] of ((mob y) - (CAMERA Y)) ) < [180]> then\n                set [shake v] to (round (((4) - (dist x)) * (3.4)))\n                if <(SFX) > [0]> then\n                    start sound (join [stomp] (dist x))\n                end\n            end\n        end\n    end\n    stop [this script v]\nend\nchange [speed v] by (((-4) - (speed)) * (0.05))\nchange [nx v] by (round ((dx) * (speed)))\nchange [ny v] by (round ((dy) * (speed)))\nsolid = is solid at ((nx) - ((dx) * (sx))) ((ny) - ((dy) * (sy))) dir ((((dir) + (3)) mod (4)) - (1)) solid [0] \nif <(overlap) > []> then\n    change [nx v] by ((dx) * (overlap))\n    change [ny v] by ((dy) * (overlap))\n    set [state v] to []\n    set [speed v] to [0]\n    set [frame v] to (delay)\nend\nif <(dir) = [2]> then\n    if <(pick random (round ((frame) / (2))) to (2)) = [-2]> then\n        if <([abs v] of ((mob x) - (CAMERA X)) ) < [240]> then\n            if <([abs v] of ((mob y) - (CAMERA Y)) ) < [200]> then\n                add [dirt drop] to [particle v]\n                add ((nx) + (pick random (-25) to (25))) to [particle v]\n                add ((ny) + (-34)) to [particle v]\n            end\n        end\n    end\nend\n\ndefine change dxy (dir) (amount) (max)\nif <(dir) > [0]> then\n    if <(dir) > [1]> then\n        change [dy v] by ((0) - (amount))\n        if <(dy) < ((0) - (max))> then\n            set [dy v] to ((0) - (max))\n        end\n    else\n        change [dx v] by (amount)\n        if <(dx) > (max)> then\n            set [dx v] to (max)\n        end\n    end\nelse\n    if <(dir) > [-1]> then\n        change [dy v] by (amount)\n        if <(dy) > (max)> then\n            set [dy v] to (max)\n        end\n    else\n        change [dx v] by ((0) - (amount))\n        if <(dx) < ((0) - (max))> then\n            set [dx v] to ((0) - (max))\n        end\n    end\nend\n\ndefine init (w) (h) (ox) (oy) (dir)\nset [dir v] to (dir)\nif <((dir) mod (2)) = [1]> then\n    set [sx v] to (w)\n    set [sy v] to (h)\n    if <(dir) = [1]> then\n        change [root x v] by (ox)\n        change [root y v] by (oy)\n    else\n        change [root x v] by ((0) - (ox))\n        change [root y v] by ((0) - (oy))\n    end\n    set [dir v] to [-1]\nelse\n    set [sx v] to (h)\n    set [sy v] to (w)\n    if <(dir) = [0]> then\n        change [root x v] by ((0) - (oy))\n        change [root y v] by (ox)\n    else\n        change [root x v] by (oy)\n        change [root y v] by ((0) - (ox))\n    end\n    set [dir v] to [0]\nend\nset [speed v] to [4]\nset [c v] to (item # of [s] in [cmds v])\nif <(c) > [0]> then\n    set [speed v] to (item ((c) + (1)) of [cmds v])\nend\nset [c v] to (item # of [v] in [cmds v])\nif <(c) > [0]> then\n    set [variation v] to (item ((c) + (1)) of [cmds v])\n    if <(variation) = [3]> then\n        turn right (180) degrees\n    end\nend\n\nwhen I start as a clone\nchange [clones v] by (1)\n\ndefine burtha\nif <(frame) < [1]> then\n    if <(frame) < [0]> then\n        if <(frame) = [-999]> then\n            change [dy v] by (-1.5)\n            if <(dy) < [-30]> then\n                set [dy v] to [-30]\n            end\n            change [ny v] by (dy)\n            set [overlap v] to []\n            solid = is solid at ((nx) + (-15)) ((ny) + (-60)) dir [2] solid [4] <>\n            solid = is solid at ((nx) + (-45)) ((ny) + (-60)) dir [2] solid [4] <>\n            solid = is solid at ((nx) + (45)) ((ny) + (-60)) dir [2] solid [4] <>\n            solid = is solid at ((nx) + (15)) ((ny) + (-60)) dir [2] solid [4] <>\n            if <(overlap) = []> then\n                set [mob y v] to (ny)\n                stop [this script v]\n            end\n            set [ny v] to (round ((ny) + ((overlap) + (0.01))))\n            set [mob y v] to (ny)\n            set [frame v] to [-60]\n            set [shake v] to [20]\n            if <(SFX) > [0]> then\n                start sound [Boom v]\n            end\n        end\n        change [frame v] by (1)\n        stop [this script v]\n    end\n    if <([abs v] of ((PLAYER X) - (mob x)) ) > [160]> then\n        stop [this script v]\n    end\n    if <([abs v] of (((PLAYER Y) + (30)) - (mob y)) ) > [75]> then\n        stop [this script v]\n    end\n    if <(PLAYER X) < (mob x)> then\n        set [dir v] to [-1]\n    else\n        set [dir v] to [1]\n    end\n    set [overlap v] to []\n    set [dy v] to ((ny) + (-45))\n    repeat (4)\n        set [dx v] to ((nx) + ((dir) * (85)))\n        repeat (4)\n            solid = is solid at (dx) (dy) dir [2] solid [4] <>\n            change [dx v] by ((dir) * (30))\n        end\n        change [dy v] by (30)\n    end\n    if <(overlap) > [0]> then\n        set [frame v] to [-15]\n        stop [this script v]\n    end\nend\nchange [frame v] by (1)\nif <(frame) < [50]> then\n    stop [this script v]\nend\nif <(frame) = [50]> then\n    if <(SFX) > [0]> then\n        start sound [woosh1 v]\n    end\n    point in direction ((45) - ((45) * (dir)))\n    change [nx v] by ((60) * (dir))\n    change [ny v] by (-60)\n    set [mob x v] to (nx)\n    set [mob y v] to (ny)\nend\nreplace item ((id) + (2)) of [obj v] with [-1000]\nif <(frame) < [60]> then\n    turn right ((9) * (dir)) degrees\n    stop [this script v]\nend\npoint in direction (0)\nset [frame v] to [-999]\nchange [nx v] by ((60) * (dir))\nchange [ny v] by (60)\nset [mob x v] to (nx)\nset [mob y v] to (ny)\nset [dy v] to [0]\n\nwhen I receive [edit - reload v]\ninit\n\ndefine accelerate dy (mul)\nif <((dy) * (mul)) < (speed)> then\n    change [dy v] by ((acc) * (mul))\n    if <((dy) * (mul)) > (speed)> then\n        set [dy v] to ((speed) * (mul))\n    end\n    set [reach v] to ((mul) * ((((dy) * (dy)) / ((2) * (acc))) + (sy)))\nend\nif <((mul) * (dy)) < [0]> then\n    set [overlap v] to []\n    solid = is solid at (mob x) (((mob y) - ((mul) * (sy))) + (dy)) dir ((mul) + (1)) solid [0] \n    set [collide v] to [1]\n    if <(overlap) > []> then\n        change [dy v] by ((1) * ((mul) * (overlap)))\n    end\nelse\n    solid = is solid at (mob x) ((mob y) + (reach)) dir [0] solid [0] \nend\n\ndefine accelerate dx (mul)\nif <((dx) * (mul)) < (speed)> then\n    change [dx v] by ((acc) * (mul))\n    if <((dx) * (mul)) > (speed)> then\n        set [dx v] to ((speed) * (mul))\n    end\n    set [reach v] to ((mul) * ((((dx) * (dx)) / ((2) * (acc))) + (sx)))\nend\nif <((mul) * (dx)) < [0]> then\n    set [overlap v] to []\n    solid = is solid at (((mob x) - ((mul) * (sx))) + (dx)) (mob y) dir ((0) - (mul)) solid [0] \n    if <(overlap) > []> then\n        change [dx v] by ((1) * ((mul) * (overlap)))\n    end\n    set [collide v] to [1]\nelse\n    solid = is solid at ((mob x) + (reach)) (mob y) dir [0] solid [0] \nend\n\nwhen I receive [reset after death v]\nset [temp v] to (item # of [r] in [cmds v])\nif <(temp) > [0]> then\n    set [temp v] to (item ((temp) + (1)) of [cmds v])\n    set [mob x v] to (root x)\n    set [mob y v] to (root y)\nend\n\ndefine parse commands (txt)\ndelete all of [cmds v]\nset [dx v] to [1]\nset [dy v] to []\nrepeat (length of (txt))\n    set [c v] to (letter (dx) of (txt))\n    if <[digits v] contains (c)?> then\n        set [dy v] to (join (dy) (c))\n    else\n        if <(dy) > []> then\n            add (dy) to [cmds v]\n            set [dy v] to []\n        end\n        add (c) to [cmds v]\n    end\n    change [dx v] by (1)\nend\nif <(dy) > []> then\n    add (dy) to [cmds v]\nend\n\nwhen I receive [edit - remove clones v]\nif <(id) > []> then\n    change [clones v] by (-1)\n    delete this clone\nend\ndelete all of [obj v]\n\ndefine Check Touching Death\nif <<(EDIT) < [1]> and <([abs v] of ((PLAYER X) - (mob x)) ) < [128]>> then\n    if <([abs v] of ((PLAYER Y) - (mob y)) ) < [128]> then\n        if <touching (player v)?> then\n            set [player death v] to [1]\n        end\n    end\nend\n\ndefine order (this z)\nif <(this z) < (item (1) of [order v])> then\n    set [i1 v] to [2]\n    set [i2 v] to (length of [order v])\n    repeat until <(i1) > (i2)>\n        set [last z v] to ([floor v] of ((i1) + (((i2) - (i1)) / (5))) )\n        if <(this z) > (item (last z) of [order v])> then\n            set [i2 v] to ((last z) - (1))\n        else\n            set [i1 v] to ((last z) + (1))\n        end\n    end\n    insert (this z) at (i1) of [order v] \n    go [forward v] ((i1) - (1)) layers\nelse\n    insert (this z) at (1) of [order v] \nend\n\nwhen I receive [_order v]\norder [-800]\n\nwhen I receive [report order v]\nadd (join [Dynamic ] (costume [name v])) to [debug v]\n\n@Mob\n\nwhen flag clicked\nhide\n\nwhen I receive [game - loop obj v]\nif <(typ) = []> then\n    stop [this script v]\nend\nif <(state) = [show]> then\n    show\n    set [state v] to []\n    orientate\nend\nif <(state) = [spawn]> then\n    if <(item (group) of [group v]) < [1]> then\n        if <([abs v] of ((mob x) - (CAMERA X)) ) > [320]> then\n            stop [this script v]\n        end\n        if <([abs v] of ((mob y) - (CAMERA Y)) ) > [260]> then\n            stop [this script v]\n        end\n        if <([abs v] of ((mob x) - (PLAYER X)) ) > [340]> then\n            stop [this script v]\n        end\n        if <([abs v] of ((mob y) - (PLAYER Y)) ) > [360]> then\n            stop [this script v]\n        end\n    end\n    spawn trigger\nend\nif <(state) = [hold]> then\n    set [c v] to (item # of [g] in [cmds v])\n    if <(c) > [0]> then\n        set [c v] to (item (item ((c) + (1)) of [cmds v]) of [group v])\n        if <not <(c) = [hold]>> then\n            set [state v] to []\n        end\n    end\nend\nif <<(typ) = [2]> or <(typ) = [13]>> then\n    tick walk - squish  run  solid-spike? \nelse\n    if <(typ) < [6]> then\n        saw\n    else\n        if <(typ) = [6]> then\n            BIRD\n        else\n            if <(typ) = [7]> then\n                Egg Bomb\n            else\n                if <(typ) = [8]> then\n                    Eye Launcher\n                else\n                    if <(typ) = [9]> then\n                        tick walk - squish <> run <> solid-spike? <>\n                    else\n                        if <<(typ) = [10]> or <(typ) = [11]>> then\n                            tick worm <(typ) = [10]>\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [game loop - scroll v]\nprocess ((mob x) - (CAMERA X)) ((mob y) - (CAMERA Y))\n\ndefine init\nswitch costume to (blank v)\npoint in direction (-90)\nset [id v] to [0]\nset [root idx v] to [0]\nrepeat (length of [map v])\n    change [root idx v] by (1)\n    set [typ v] to (item (root idx) of [map v])\n    set [temp v] to (item (typ) of [mask v])\n    if <(letter (6) of (temp)) > [ ]> then\n        set [root x v] to (((((root idx) - (1)) mod (LSX)) * (60)) + (30))\n        set [root y v] to ((([floor v] of (((root idx) - (1)) / (LSX)) ) * (60)) + (30))\n        set [de-clone v] to []\n        spawn (join (letter (5) of (temp)) (letter (6) of (temp))) \n    end\nend\nset [typ v] to []\nhide\n\nwhen I receive [setup - level v]\ngo to [front v] layer\ngo [backward v] (GUI SPRITE #) layers\ninit\n\ndefine spawn (typ) <clone?>\nset [state v] to [spawn]\nset [group v] to []\nif <(typ) < [2]> then\n    stop [this script v]\nend\nif <(typ) > [79]> then\n    stop [this script v]\nend\nif <(typ) = [2]> then\n    set [costume# v] to [Mob A1]\n    set [speed v] to [2]\nelse\n    if <(typ) = [13]> then\n        set [costume# v] to [Enemy-big-purple]\n        set [speed v] to [3]\n    else\n        if <<(typ) = [4]> or <(typ) = [5]>> then\n            set [costume# v] to [saw-22]\n        else\n            if <(typ) = [6]> then\n                set [costume# v] to [BIRD-01]\n            else\n                if <(typ) = [8]> then\n                    set [costume# v] to [eye-launcher]\n                else\n                    if <(typ) = [9]> then\n                        set [costume# v] to [pip]\n                        set [speed v] to [8]\n                        set [count v] to [2]\n                    else\n                        if <<(typ) = [10]> or <(typ) = [11]>> then\n                            set [speed v] to [8]\n                        else\n                            stop [this script v]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\ndelete all of [cmds v]\nset [dx v] to (item # of (join [+] (root idx)) in [map data v])\nif <(dx) > [0]> then\n    parse commands (item ((dx) + (1)) of [map data v])\nend\nset [typ v] to (typ)\nset [c v] to (item # of [g] in [cmds v])\nif <(c) > [0]> then\n    set [group v] to (item ((c) + (1)) of [cmds v])\n    repeat ((group) - (length of [group v]))\n        add [] to [group v]\n    end\nend\nset [id v] to [1]\nset [sx v] to [11.5]\nset [sy v] to [23]\nset [dx v] to [0]\nset [dy v] to [0]\nset [dir v] to [1]\nif <(typ) = [4]> then\n    set [dir v] to (item (root idx) of [map r v])\n    if <(dir) > [1]> then\n        if <(dir) > [2]> then\n            set [dir v] to [0]\n            change [root x v] by (-26)\n            set [dy v] to [4]\n        else\n            set [dir v] to [1]\n            change [root y v] by (-26)\n            set [dx v] to [4]\n        end\n    else\n        set [typ v] to [5]\n        if <(dir) > [0]> then\n            set [dir v] to [0]\n            change [root x v] by (26)\n            set [dy v] to [4]\n        else\n            set [dir v] to [1]\n            change [root y v] by (26)\n            set [dx v] to [4]\n        end\n    end\nelse\n    if <(typ) = [5]> then\n        set [overlap v] to []\n        solid = is solid at (root x) ((root y) + (31)) dir [0] solid [4] <>\n        solid = is solid at (root x) ((root y) + (61)) dir [0] solid [4] <>\n    else\n        if <(typ) = [6]> then\n            set [overlap v] to []\n            change [root y v] by (-12)\n            set [dx v] to [4]\n            set [dir v] to [1]\n        else\n            if <(typ) = [8]> then\n                init eye launcher\n            else\n                if <(typ) = [10]> then\n                    init worm <>\n                else\n                    if <(typ) = [11]> then\n                        init worm \n                    else\n                        if <(typ) = [13]> then\n                            set [sx v] to [22]\n                            set [sy v] to [43]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nset [mob x v] to (root x)\nset [mob y v] to (root y)\nif <clone?> then\n    create clone of (_myself_ v)\nend\n\ndefine tick walk - squish <sqishable?> run <run?> solid-spike? <solid-spike?>\nset [dir v] to ((direction) / ([abs v] of (direction) ))\nif <(state) = []> then\n    if <<(EDIT) < [1]> and <(PLAYER DEATH) = []>> then\n        if <([abs v] of ((PLAYER X) - (mob x)) ) < [80]> then\n            if <([abs v] of ((PLAYER Y) - (mob y)) ) < [80]> then\n                if <touching (stencil v)?> then\n                    if <sqishable?> then\n                        if <(PLAYER Y) < (PLAYER LSY)> then\n                            if <((PLAYER LSY) - (6)) > ((mob y) + (sy))> then\n                                if <(SFX) > [0]> then\n                                    start sound [boing v]\n                                end\n                                set [player sy v] to [16]\n                                broadcast (bounce on head v)\n                                if <(typ) = [2]> then\n                                    set [costume# v] to [Mob A3]\n                                    set [state v] to [squish]\n                                else\n                                    set [costume# v] to [Mob P squish]\n                                    set [state v] to [squish]\n                                end\n                                set [dx v] to [0]\n                                set [dy v] to [0]\n                                set [frame v] to [0]\n                                stop [this script v]\n                            end\n                        end\n                    end\n                    set [player death v] to [1]\n                end\n            end\n        end\n    end\n    if <<run?> and <([abs v] of ((PLAYER X) - ((mob x) + ((dir) * (180)))) ) < [180]>> then\n        if <([abs v] of ((PLAYER Y) - ((mob y) + (22))) ) < [50]> then\n            set [temp v] to ((speed) * (2))\n        else\n            set [temp v] to (speed)\n        end\n    else\n        set [temp v] to (speed)\n    end\n    if <((((frame) - (20)) mod (36)) + (temp)) > [35.99]> then\n        if <([abs v] of ((mob x) - (CAMERA X)) ) < [240]> then\n            if <([abs v] of ((mob y) - (CAMERA Y)) ) < [180]> then\n                if <(SFX) > [0]> then\n                    start sound [blip2 v]\n                end\n            end\n        end\n    end\n    change [frame v] by (temp)\n    change [dx v] by ((((dir) * (temp)) - (dx)) * (0.05))\n    set [schk v] to [0]\nelse\n    set [schk v] to [4]\n    if <(state) = [squish]> then\n        change [dx v] by (((0) - (dx)) * (0.2))\n        change [frame v] by (1)\n        if <(frame) > [10]> then\n            if <(typ) = [2]> then\n                if <(SFX) > [0]> then\n                    start sound [squish v]\n                end\n                pop1 [pop orange]\n                pop1 [pop orange]\n                pop1 [pop eye]\n                delete clone\n            else\n                set [costume# v] to [Enemy-big-purple]\n                set [state v] to []\n            end\n        end\n    end\nend\nchange [dy v] by (-1)\nchange [mob y v] by (dy)\nset [overlap v] to []\nsolid = is solid at ((mob x) + ((dir) * (11))) ((mob y) - (1)) dir [2] solid [4] <>\nsolid = is solid at ((mob x) + ((dir) * (-11))) ((mob y) - (1)) dir [2] solid [4] <>\nif <(overlap) > []> then\n    change [mob y v] by ((overlap) + (0.01))\n    set [dy v] to [0]\n    if <(typ) = [9]> then\n        if <(pick random (1) to (15)) = [1]> then\n            set [dy v] to (pick random (5) to (8))\n        end\n    end\nelse\n    set [schk v] to [4]\nend\nif <(delay) > [0]> then\n    change [delay v] by (-1)\n    stop [this script v]\nend\nset [overlap v] to []\nset [schk v] to [0]\nsolid = is solid at ((mob x) + ((dx) + ((dir) * (11)))) ((mob y) - (1)) dir (dir) solid (schk) <solid-spike?>\nif <(overlap) = []> then\n    change [mob x v] by (dx)\nelse\n    if <(typ) = [9]> then\n        if <(dy) = [0]> then\n            set [overlap v] to []\n            solid = is solid at ((mob x) + ((dx) + ((dir) * (11)))) ((mob y) + (30)) dir (dir) solid (schk) <solid-spike?>\n            if <(overlap) > []> then\n                change [count v] by (-1)\n                if <<(count) > [0]> and <<(direction) > [0]> = <(PLAYER X) < (mob x)>>> then\n                    point in direction ((dir) * (-90))\n                else\n                    if <([abs v] of (((mob x) + ((dx) + ((dir) * (11)))) - (CAMERA X)) ) < [239]> then\n                        pop [pop purple]\n                        pop [pop dot]\n                    end\n                    delete clone\n                end\n            end\n            set [dy v] to [10]\n        end\n    else\n        point in direction ((dir) * (-90))\n    end\n    set [dx v] to [0]\nend\n\ndefine solid = is solid at (x) (y) dir (dir) solid (schk) <spikeissolid>\nset [idx v] to (([floor v] of ((x) / (60)) ) + (1))\nchange [idx v] by (([floor v] of ((y) / (60)) ) * (LSX))\nset [tile v] to (item (idx) of [map v])\nset [mask v] to (item (tile) of [mask v])\nif <((x) mod (60)) < [30]> then\n    if <((y) mod (60)) < [30]> then\n        set [mid v] to [1]\n    else\n        set [mid v] to [2]\n    end\nelse\n    if <((y) mod (60)) < [30]> then\n        set [mid v] to [0]\n    else\n        set [mid v] to [3]\n    end\nend\nset [c v] to (letter ((((mid) - (item (idx) of [map r v])) mod (4)) + (1)) of (mask))\nif <<spikeissolid> and <(c) = [.]>> then\n    set [c v] to [9]\nend\nif <(c) > (schk)> then\n    if <(dir) > [0]> then\n        if <(dir) = [1]> then\n            set [temp v] to ((x) mod (30))\n        else\n            set [temp v] to ((30) - ((y) mod (30)))\n        end\n    else\n        if <(dir) = [-1]> then\n            set [temp v] to ((30) - ((x) mod (30)))\n        else\n            set [temp v] to ((y) mod (30))\n        end\n    end\n    if <(temp) > (overlap)> then\n        set [overlap v] to (temp)\n        set [solid v] to [1]\n    end\nend\n\nwhen I start as a clone\nchange [clones v] by (1)\nif <(de-clone) > [0]> then\n    stop [this script v]\nend\nif <<(typ) = [4]> or <(typ) = [5]>> then\n    set rotation style [all around v]\n    go to [back v] layer\n    go [forward v] (11) layers\nelse\n    if <(typ) = [7]> then\n        set [dx v] to ((0) - ((dx) / ([abs v] of (dir) )))\n        set [dy v] to [3]\n        set [frame v] to []\n        set [de-clone v] to [1]\n    else\n        if <<(typ) = [8]> or <<(typ) = [10]> or <(typ) = [11]>>> then\n            set rotation style [all around v]\n        else\n            if <(typ) = [blink]> then\n                set [mob x v] to ((([floor v] of ((mob x) / (60)) ) * (60)) + (30))\n                set [mob y v] to ((([floor v] of ((mob y) / (60)) ) * (60)) + (30))\n                set [costume# v] to [blink]\n                set [frame v] to [0]\n            end\n        end\n    end\nend\n\ndefine saw\nif <<(typ) = [4]> = <((dx) - (dy)) > [0]>> then\n    turn right (-7) degrees\nelse\n    turn right (-5) degrees\nend\nif <(PLAYER STATE) = [crouch]> then\n    set size to (95) %\nend\nCheck Touching Death\nif <(PLAYER STATE) = [crouch]> then\n    set size to (100) %\nend\nif <(state) = [hold]> then\n    stop [this script v]\nend\nset [overlap v] to []\nif <((dir) mod (4)) < [2]> then\n    if <(dir) = [0]> then\n        change [dy v] by (((4) - (dy)) * (0.05))\n        solid = is solid at (mob x) ((mob y) + (57)) dir [0] solid [0] \n    else\n        change [dx v] by (((4) - (dx)) * (0.05))\n        solid = is solid at ((mob x) + (57)) (mob y) dir [0] solid [0] \n    end\nelse\n    if <(dir) = [2]> then\n        change [dy v] by (((-4) - (dy)) * (0.05))\n        solid = is solid at (mob x) ((mob y) + (-57)) dir [0] solid [0] \n    else\n        change [dx v] by (((-4) - (dx)) * (0.05))\n        solid = is solid at ((mob x) + (-57)) (mob y) dir [0] solid [0] \n    end\nend\nchange [mob x v] by (dx)\nchange [mob y v] by (dy)\nif <(overlap) > [0]> then\n    set [dir v] to (((dir) + (2)) mod (4))\nend\n\ndefine BIRD\nCheck Touching Death\nchange [dy v] by (-0.75)\nif <(mob y) < (root y)> then\n    if <([abs v] of ((mob x) - (CAMERA X)) ) < [320]> then\n        set [typ v] to [7]\n        set rotation style [all around v]\n        set [costume# v] to [BIRD-Bomb]\n        switch costume to (costume#)\n        create clone of (_myself_ v)\n        set [costume# v] to [BIRD-01]\n        set rotation style [left-right v]\n        set [typ v] to [6]\n    else\n        if <<(dx) < [0]> = <(mob x) < (CAMERA X)>> then\n            delete clone\n        end\n    end\n    set [dy v] to [7]\nend\nset [overlap v] to []\nchange [mob x v] by (dx)\nchange [mob y v] by (dy)\nif <(overlap) > [0]> then\n    set [dir v] to (((dir) + (2)) mod (4))\nend\n\ndefine Egg Bomb\nCheck Touching Death\nif <(frame) = []> then\n    change [dy v] by (-0.25)\n    change [mob x v] by (dx)\n    change [mob y v] by (dy)\n    turn right (-15) degrees\n    set [overlap v] to []\n    solid = is solid at (mob x) ((mob y) + (-5)) dir [2] solid [4] <>\n    if <(overlap) > []> then\n        if <(SFX) > [0]> then\n            start sound [8bit bang v]\n        end\n        set [costume# v] to [Boom-2]\n        change [mob y v] by (overlap)\n        point in direction (90)\n        set [frame v] to [0]\n        add [dots] to [particle v]\n        add (mob x) to [particle v]\n        add (mob y) to [particle v]\n        set [shake v] to [8]\n    end\nelse\n    change [frame v] by (1)\n    if <(frame) > [3]> then\n        delete clone\n    end\nend\n\ndefine orientate\nif <<(typ) = [8]> or <<(typ) = [10]> or <(typ) = [11]>>> then\n    stop [this script v]\nend\nif <<([abs v] of (dx) ) = [0]> and <not <<(typ) = [2]> or <(typ) = [9]>>>> then\n    if <(PLAYER Y) < (mob y)> then\n        set [dir v] to [2]\n        set [dy v] to ((0) - (dy))\n    end\nelse\n    set [c v] to (item # of [x] in [cmds v])\n    if <(c) > [0]> then\n        set [dir v] to (item ((c) + (1)) of [cmds v])\n        add (dir) to [debug v]\n        set [dir v] to ((dir) / ([abs v] of (dir) ))\n    else\n        if <(PLAYER X) < (mob x)> then\n            set [dir v] to [-1]\n        else\n            set [dir v] to [1]\n        end\n    end\n    set [dx v] to ((dir) * ([abs v] of (dx) ))\n    point in direction ((dir) * (90))\nend\n\nwhen I receive [reset after death v]\nif <(de-clone) > [0]> then\n    delete clone\nend\nset [mob x v] to (root x)\nset [mob y v] to (root y)\nset [state v] to [spawn]\nhide\n\ndefine Eye Launcher\nif <(state) = [hold]> then\n    stop [this script v]\nend\nCheck Touching Death\nif <(frame) < [60]> then\n    change [frame v] by (1)\n    if <(frame) < [60]> then\n        if <(frame) > [30]> then\n            turn right (15) degrees\n        end\n        stop [this script v]\n    end\n    set [dx v] to (ux)\n    set [dy v] to (uy)\n    set [speed v] to (pick random (8) to (20))\n    if <(pick random (1) to (2)) = [1]> then\n        set [speed v] to ((0) - (speed))\n    end\n    if <([abs v] of ((mob x) - (CAMERA X)) ) < [270]> then\n        if <([abs v] of ((mob y) - (CAMERA Y)) ) < [200]> then\n            if <(SFX) > [0]> then\n                start sound [launcher v]\n            end\n        end\n    end\nend\nif <(dir) > [0]> then\n    if <(dir) = [1]> then\n        change [mob x v] by (dx)\n        change [dx v] by (0.5)\n    else\n        change [mob y v] by (dy)\n        change [dy v] by (-0.5)\n    end\nelse\n    if <(dir) = [-1]> then\n        change [mob x v] by (dx)\n        change [dx v] by (-0.5)\n    else\n        change [mob y v] by (dy)\n        change [dy v] by (0.5)\n    end\nend\nturn right (speed) degrees\nif <([abs v] of ((dx) + (dy)) ) > ([abs v] of ((ux) + (uy)) )> then\n    set [c v] to (item # of [d] in [cmds v])\n    set [frame v] to [0]\n    if <(c) > [0]> then\n        set [frame v] to ((56) - (item ((c) + (1)) of [cmds v]))\n        if <(frame) < [1]> then\n            set [frame v] to [1]\n        end\n    end\n    set [mob x v] to (root x)\n    set [mob y v] to (root y)\n    point in direction (90)\n    if <([abs v] of ((mob x) - (CAMERA X)) ) < [270]> then\n        if <([abs v] of ((mob y) - (CAMERA Y)) ) < [200]> then\n            if <(SFX) > [0]> then\n                start sound [launcher2 v]\n            end\n        end\n    end\nend\n\ndefine init eye launcher\nset [dir v] to ((((item (root idx) of [map r v]) + (2)) mod (4)) - (1))\nGet UXY (dir) [60]\nset [frame v] to [0]\nset [speed v] to [0]\nrepeat (8)\n    change [root x v] by (ux)\n    change [root y v] by (uy)\n    set [overlap v] to []\n    change [speed v] by (60)\n    solid = is solid at (root x) (root y) dir (dir) solid [4] <>\n    if <(overlap) > []> then\n        set [speed v] to ([sqrt v] of ((speed) * ((2) * (0.5))) )\n        Get UXY (dir) ((0) - (speed))\n        stop [this script v]\n    end\nend\n\ndefine Get UXY (dir) (mul)\nif <(dir) > [0]> then\n    if <(dir) = [1]> then\n        set [ux v] to (mul)\n        set [uy v] to [0]\n    else\n        set [ux v] to [0]\n        set [uy v] to ((0) - (mul))\n    end\nelse\n    if <(dir) = [-1]> then\n        set [ux v] to ((0) - (mul))\n        set [uy v] to [0]\n    else\n        set [ux v] to [0]\n        set [uy v] to (mul)\n    end\nend\n\ndefine pop (typ)\nadd (typ) to [particle v]\nadd (mob x) to [particle v]\nadd ((mob y) + (10)) to [particle v]\n\ndefine spawn trigger\nshow\nset [state v] to []\norientate\nif <(typ) = [9]> then\n    set [de-clone v] to [1]\n    set [delay v] to [0]\n    repeat (5)\n        create clone of (_myself_ v)\n        change [delay v] by (10)\n    end\n    set [de-clone v] to []\nend\nset [c v] to (item # of [h] in [cmds v])\nif <(c) > [0]> then\n    set [frame v] to (item ((c) + (1)) of [cmds v])\n    if <(typ) = [8]> then\n        set [frame v] to ((58) - (frame))\n    end\nend\nset [c v] to (item # of [g] in [cmds v])\nif <(c) > [0]> then\n    set [c v] to (item ((c) + (1)) of [cmds v])\n    if <(item (c) of [group v]) = [hold]> then\n        set [state v] to [hold]\n    else\n        if <<(group) > [0]> and <(item (group) of [group v]) < [1]>> then\n            replace item (group) of [group v] with [1]\n        end\n    end\nend\n\nwhen I receive [boss - pip v]\nif <not <(typ) = []>> then\n    stop [this script v]\nend\nreplace item (7) of [boss v] with ((1) + (item (7) of [boss v]))\nset [root x v] to (item (2) of [boss v])\nset [root y v] to (item (3) of [boss v])\nset [de-clone v] to [1]\nset [state v] to [show]\npoint in direction (90)\nspawn [2] <>\nset [speed v] to [4]\nset [count v] to [1]\nset [boss spawn v] to [1]\nif <(item (8) of [boss v]) = [0]> then\n    set [dx v] to [2]\n    set [dy v] to [-6]\nelse\n    set [dx v] to [5]\n    set [dy v] to [16]\nend\ncreate clone of (_myself_ v)\nset [boss spawn v] to []\nset [de-clone v] to []\nset [typ v] to []\n\ndefine process (px) (py)\nif <<(typ) = []> or <(state) = [spawn]>> then\n    stop [this script v]\nend\nif <<([abs v] of (px) ) > [340]> or <([abs v] of (py) ) > [280]>> then\n    if <not <(costume [number v]) = [2]>> then\n        switch costume to (blank v)\n    end\n    stop [this script v]\nend\nif <<([abs v] of (px) ) > [240]> or <([abs v] of (py) ) > [180]>> then\n    switch costume to (big v)\nend\ngo to x: (px) y: (py)\nswitch costume to (costume#)\nif <<<(typ) = [2]> or <(typ) = [13]>> and <(state) = []>> then\n    set [temp v] to (([floor v] of ((frame) / (4)) ) mod (9))\n    if <(temp) < [5]> then\n        next costume\n        if <<(temp) = [0]> or <(temp) = [4]>> then\n            next costume\n        end\n    end\nelse\n    if <(typ) = [6]> then\n        if <(frame) = <(dy) > [0]>> then\n            if <(dy) > [0]> then\n                next costume\n            end\n        else\n            if <(frame) = []> then\n                set [frame v] to <(dy) > [0]>\n            else\n                set [frame v] to []\n            end\n            next costume\n            next costume\n        end\n    else\n        if <(typ) = [9]> then\n            if <(frame) > [270]> then\n                next costume\n                if <(frame) > [290]> then\n                    set [frame v] to (pick random (0) to (150))\n                end\n            end\n        else\n            if <<(typ) = [10]> or <(typ) = [11]>> then\n                switch costume to ((costume [number v]) + (uy))\n            end\n        end\n    end\nend\n\ndefine delete clone\nif <(typ) > []> then\n    change [clones v] by (-1)\n    if <(boss spawn) > [0]> then\n        replace item (7) of [boss v] with ((item (7) of [boss v]) - (1))\n    end\n    delete this clone\nend\n\ndefine pop1 (typ)\nadd [pop1] to [particle v]\nadd (typ) to [particle v]\nadd (mob x) to [particle v]\nadd ((mob y) + (10)) to [particle v]\n\ndefine init worm <cw>\npoint in direction ((item (root idx) of [map r v]) * (90))\nif <cw> then\n    set [costume# v] to [worm-cw1]\n    set [ux v] to [90]\nelse\n    turn right (180) degrees\n    set [costume# v] to [worm-ccw1]\n    set [ux v] to [-90]\nend\nset [uy v] to [0]\nset [dir v] to ((((((direction) + (ux)) / (90)) + (1)) mod (4)) - (1))\nset [dx v] to ([sin v] of ((dir) * (90)) )\nset [dy v] to ([cos v] of ((dir) * (90)) )\nrepeat (20)\n    change [root x v] by ((dx) * (30))\n    change [root y v] by ((dy) * (30))\n    set [overlap v] to []\n    solid = is solid at (root x) (root y) dir (dir) solid [4] <>\n    if <(overlap) > []> then\n        set [overlap v] to ((-3) - (overlap))\n        change [root x v] by ((dx) * (overlap))\n        change [root y v] by ((dy) * (overlap))\n        stop [this script v]\n    end\nend\n\ndefine tick worm <cw>\nCheck Touching Death\nchange [frame v] by (1)\nif <(frame) < [1]> then\n    stop [this script v]\nend\nset [frame v] to [0]\nif <(state) = [curl]> then\n    set [state v] to []\n    set [uy v] to [3]\n    turn right (ux) degrees\n    set [dx v] to ([sin v] of ((direction) + (ux)) )\n    set [dy v] to ([cos v] of ((direction) + (ux)) )\n    set [dir v] to (round ((((((direction) + (ux)) / (90)) + (1)) mod (4)) - (1)))\n    change [mob x v] by ((10) * ([sin v] of (direction) ))\n    change [mob y v] by ((10) * ([cos v] of (direction) ))\n    set [overlap v] to []\n    change [mob x v] by ((24) * (dx))\n    change [mob y v] by ((24) * (dy))\n    solid = is solid at (mob x) (mob y) dir (dir) solid [4] <>\n    if <(overlap) > []> then\n        set [overlap v] to ((-3) - (overlap))\n        change [mob x v] by ((overlap) * (dx))\n        change [mob y v] by ((overlap) * (dy))\n    end\n    stop [this script v]\nend\nif <(uy) > [0]> then\n    change [uy v] by (-1)\nelse\n    if <(uy) < [0]> then\n        change [uy v] by (1)\n    end\nend\nset [overlap v] to []\nsolid = is solid at ((mob x) + ((4) * (dx))) ((mob y) + ((4) * (dy))) dir (dir) solid [4] <>\nif <(overlap) = []> then\n    set [state v] to [curl]\nend\nchange [mob x v] by ((10) * ([sin v] of (direction) ))\nchange [mob y v] by ((10) * ([cos v] of (direction) ))\nset [overlap v] to []\nsolid = is solid at (mob x) (mob y) dir ((direction) / (90)) solid [4] <>\nif <(overlap) > []> then\n    set [overlap v] to ((-3) - (overlap))\n    change [mob x v] by ((overlap) * ([sin v] of (direction) ))\n    change [mob y v] by ((overlap) * ([cos v] of (direction) ))\n    turn left (ux) degrees\n    set [dx v] to ([sin v] of ((direction) + (ux)) )\n    set [dy v] to ([cos v] of ((direction) + (ux)) )\n    set [dir v] to (round ((((((direction) + (ux)) / (90)) + (1)) mod (4)) - (1)))\n    set [uy v] to [-3]\n    change [mob x v] by ((23) * ([sin v] of (direction) ))\n    change [mob y v] by ((23) * ([cos v] of (direction) ))\nend\n\nwhen I receive [edit - reload v]\ninit\n\ndefine Check Touching Death\nif <<(EDIT) < [1]> and <([abs v] of ((PLAYER X) - (mob x)) ) < [128]>> then\n    if <([abs v] of ((PLAYER Y) - (mob y)) ) < [128]> then\n        if <touching (player v)?> then\n            set [player death v] to [1]\n        end\n    end\nend\n\ndefine parse commands (txt)\ndelete all of [cmds v]\nset [dx v] to [1]\nset [dy v] to []\nrepeat (length of (txt))\n    set [c v] to (letter (dx) of (txt))\n    if <[digits v] contains (c)?> then\n        set [dy v] to (join (dy) (c))\n    else\n        if <(dy) > []> then\n            add (dy) to [cmds v]\n            set [dy v] to []\n        end\n        add (c) to [cmds v]\n    end\n    change [dx v] by (1)\nend\nif <(dy) > []> then\n    add (dy) to [cmds v]\nend\n\nwhen I receive [edit - remove clones v]\nif <(typ) > []> then\n    change [clones v] by (-1)\n    delete this clone\nend\n\ndefine order (this z)\nif <(this z) < (item (1) of [order v])> then\n    set [i1 v] to [2]\n    set [i2 v] to (length of [order v])\n    repeat until <(i1) > (i2)>\n        set [last z v] to ([floor v] of ((i1) + (((i2) - (i1)) / (5))) )\n        if <(this z) > (item (last z) of [order v])> then\n            set [i2 v] to ((last z) - (1))\n        else\n            set [i1 v] to ((last z) + (1))\n        end\n    end\n    insert (this z) at (i1) of [order v] \n    go [forward v] ((i1) - (1)) layers\nelse\n    insert (this z) at (1) of [order v] \nend\n\nwhen I receive [_order v]\norder [-700]\n\nwhen I receive [report order v]\nadd (join [Mob ] (costume [name v])) to [debug v]\n\n@Editor\n\nwhen I receive [game loop - scroll v]\nif <(toggle) = [1]> then\n    if <(EDIT) = [1]> then\n        wait (0) seconds\n        broadcast (EDIT - Remove Clones v) and wait\n        go to [back v] layer\n        go [forward v] (11) layers\n        hide\n        broadcast (EDIT - Save v) and wait\n        set [edit v] to [0]\n        set [spawn idx v] to (([floor v] of ((PLAYER Y) / (60)) ) * (LSX))\n        change [spawn idx v] by (([floor v] of ((PLAYER X) / (60)) ) + (1))\n        set [player inv v] to [45]\n        wait (0) seconds\n        broadcast (EDIT - Reload v) and wait\n    else\n        wait (0) seconds\n        broadcast (EDIT - Remove Clones v) and wait\n        broadcast (EDIT - Load v) and wait\n        set [edit v] to [1]\n        show\n        go to [front v] layer\n        set [ghost v] effect to (75)\n    end\n    set [toggle v] to []\nend\nif <(EDIT) = [1]> then\n    edit\nend\n\nwhen I receive [setup - level v]\nif <([production v] of [menu v]) > [0]> then\n    set [edit v] to []\nelse\n    set [edit v] to [0]\nend\nset [chosen brush v] to [2]\nset [chosen brush r v] to [1]\nset [chosen brush data v] to []\nset [drawing v] to []\nset [toggle v] to []\nhide\n\nwhen [m v] key pressed\nif <key (q v) pressed?> then\n    if <(EDIT) > []> then\n        set [toggle v] to [1]\n    end\nend\n\nwhen [1 v] key pressed\nNext Brush [1]\n\nwhen [e v] key pressed\nset [chosen brush v] to (item (idx) of [map v])\nset [chosen brush r v] to (item (idx) of [map r v])\nset [chosen brush data v] to (item # of (join [+] (idx)) in [map data v])\nif <(chosen brush data) > [0]> then\n    set [chosen brush data v] to (item ((chosen brush data) + (1)) of [map data v])\nelse\n    set [chosen brush data v] to []\nend\n\nwhen [r v] key pressed\nset [chosen brush r v] to (((chosen brush r) + (1)) mod (4))\n\ndefine Next Brush (category)\nset [chosen brush data v] to []\nset [category v] to (letter (8) of (item (chosen brush) of [mask v]))\nif <not <(category) = (category)>> then\n    set [chosen brush v] to [0]\nend\nrepeat (length of [mask v])\n    change [chosen brush v] by (1)\n    if <(chosen brush) > (length of [mask v])> then\n        set [chosen brush v] to [1]\n    end\n    set [category v] to (letter (8) of (item (chosen brush) of [mask v]))\n    if <(category) = (category)> then\n        stop [this script v]\n    end\nend\nset [chosen brush v] to [1]\n\nwhen [2 v] key pressed\nNext Brush [2]\n\nwhen [3 v] key pressed\nNext Brush [3]\n\nwhen [4 v] key pressed\nNext Brush [4]\n\nwhen [5 v] key pressed\nNext Brush [5]\n\nwhen [6 v] key pressed\nNext Brush [6]\n\nwhen [n v] key pressed\nset [category v] to (letter (8) of (item (chosen brush) of [mask v]))\nNext Brush (category)\n\nwhen [7 v] key pressed\nNext Brush [7]\n\ndefine ensure wall (idx)\nrepeat (((idx) - (length of [wall v])) + (1))\n    add [0] to [wall v]\nend\n\ndefine edit\nif <(drawing) < [1]> then\n    if <<([over v] of [in-game menu v]) > [0]> or <(IN-GAME MENU) > [0]>> then\n        set [idx v] to [-999]\n        set [x v] to [-999]\n        set [y v] to [-999]\n        set [drawing v] to [-1]\n        hide\n        stop [this script v]\n    end\nend\nif <(idx) < [1]> then\n    show\nend\nset [x v] to ([floor v] of (((mouse x) + (CAMERA X)) / (60)) )\nset [y v] to ([floor v] of (((mouse y) + (CAMERA Y)) / (60)) )\nset [idx v] to ((x) + (1))\nchange [idx v] by ((y) * (LSX))\nset [x v] to ((x) * (60))\nset [y v] to ((y) * (60))\ngo to x: (((x) - (CAMERA X)) + (30)) y: (((y) - (CAMERA Y)) + (30))\nset [data# v] to (item # of (join [+] (idx)) in [map data v])\nif <<mouse down?> or <key (x v) pressed?>> then\n    if <(drawing) = []> then\n        if <<(item (idx) of [map v]) = (chosen brush)> and <(item (idx) of [map r v]) = (chosen brush r)>> then\n            set [drawing v] to [1]\n            set [drawing r v] to [1]\n            set [drawing data v] to []\n        else\n            set [drawing v] to (chosen brush)\n            set [drawing r v] to (chosen brush r)\n            set [drawing data v] to (chosen brush data)\n        end\n    end\n    if <(drawing) > [0]> then\n        set [brush v] to (drawing)\n        set [brush r v] to (drawing r)\n        set [brush data v] to (drawing data)\n        if <<(brush) = [63]> or <<(brush) = [76]> or <<(brush) = [70]> or <(brush) = [85]>>>> then\n            replace item (item # of (brush) in [map v]) of [map v] with [1]\n        end\n        replace item (idx) of [map v] with (brush)\n        replace item (idx) of [map r v] with (brush r)\n        if <(data#) > [0]> then\n            delete (data#) of [map data v]\n            delete (data#) of [map data v]\n            set [data# v] to [0]\n        end\n        if <(brush data) > []> then\n            add (join [+] (idx)) to [map data v]\n            set [data# v] to (length of [map data v])\n            add (brush data) to [map data v]\n        end\n    end\nelse\n    set [brush v] to (chosen brush)\n    set [brush r v] to (chosen brush r)\n    set [brush data v] to (chosen brush data)\n    set [drawing v] to []\n    set [drawing r v] to []\n    set [drawing data v] to []\nend\nif <(data#) > [0]> then\n    say (item ((data#) + (1)) of [map data v])\nelse\n    say []\nend\nif <key ((join [/] []) v) pressed?> then\n    ask (join [Enter Data: ] (item ((data#) + (1)) of [map data v])) and wait\n    repeat until <not <<< (answer) contains [ ]?> or < (answer) contains [Z]?>> or << (answer) contains [B]?> or < (answer) contains [C]?>>>>\n        ask [Sorry - No spaces, B, C or Z's allowed...] and wait\n    end\n    if <(answer) = []> then\n        if <(data#) > [0]> then\n            ask [Enter Y to clear] and wait\n            if <(answer) = [Y]> then\n                delete (data#) of [map data v]\n                delete (data#) of [map data v]\n            end\n        end\n    else\n        if <(data#) > [0]> then\n            replace item ((data#) + (1)) of [map data v] with (answer)\n        else\n            add (join [+] ([idx v] of [editor v])) to [map data v]\n            add (answer) to [map data v]\n        end\n    end\nend\nif <key (g v) pressed?> then\n    set [i v] to (((2) * ([floor v] of (((mouse x) + ((CAMERA X) * (0.75))) / (60)) )) + (3))\n    set [tmp v] to ((round (((mouse y) + ((CAMERA Y) * (0.75))) / (30))) - (6))\n    if <(item (i) of [wall v]) = (tmp)> then\n        replace item ((i) + (1)) of [wall v] with (((1) + (item ((i) + (1)) of [wall v])) mod (4))\n        repeat until <not <key (g v) pressed?>>\n            wait (0) seconds\n        end\n    else\n        ensure wall (i)\n        replace item (i) of [wall v] with (tmp)\n    end\nend\n\nwhen I receive [edit - toggle play v]\nset [toggle v] to [1]\n\nset [i v] to [0]\n\ndefine order (this z)\nif <(this z) < (item (1) of [order v])> then\n    set [i1 v] to [2]\n    set [i2 v] to (length of [order v])\n    repeat until <(i1) > (i2)>\n        set [last z v] to ([floor v] of ((i1) + (((i2) - (i1)) / (5))) )\n        if <(this z) > (item (last z) of [order v])> then\n            set [i2 v] to ((last z) - (1))\n        else\n            set [i1 v] to ((last z) + (1))\n        end\n    end\n    insert (this z) at (i1) of [order v] \n    go [forward v] ((i1) - (1)) layers\nelse\n    insert (this z) at (1) of [order v] \nend\n\nwhen I receive [_order v]\norder [-1500]\n\nwhen I receive [report order v]\nadd (join [Editor ] (costume [name v])) to [debug v]\n\n@wallpaper\n\nwhen I receive [setup - background v]\nwait (0) seconds\ngo to [back v] layer\nset [color v] effect to (0)\nset [brightness v] effect to (0)\nset [color v] effect to (HUE #2)\n\nwhen I receive [game loop - scroll v]\nif <(GAME STATE) = [MENU LEVELS]> then\n    set x to (((((CAMERA X) * (-0.5)) - (round ((timer) * (75)))) mod (80)) - (40))\nelse\n    set x to ((((CAMERA X) * (-0.5)) mod (80)) - (40))\nend\nset y to ((((CAMERA Y) * (-0.5)) mod (80)) - (40))\nif <(length of [boss v]) > [5]> then\n    bright to (((20) * ([sin v] of ((timer) * (200)) )) - (15))\nelse\n    bright to [0]\nend\n\ndefine bright to (val)\nset [nxt v] to ((bright) + ((0.1) * ((val) - (bright))))\nif <not <(round (nxt)) = (bright)>> then\n    set [bright v] to (round (nxt))\n    set [brightness v] effect to (bright)\nend\n\nwhen I receive [start v]\nset [color v] effect to (HUE #2)\n\nwhen I receive [edit - remap width v]\nset [color v] effect to (HUE #2)\n\ndefine order (this z)\nif <(this z) < (item (1) of [order v])> then\n    set [i1 v] to [2]\n    set [i2 v] to (length of [order v])\n    repeat until <(i1) > (i2)>\n        set [last z v] to ([floor v] of ((i1) + (((i2) - (i1)) / (5))) )\n        if <(this z) > (item (last z) of [order v])> then\n            set [i2 v] to ((last z) - (1))\n        else\n            set [i1 v] to ((last z) + (1))\n        end\n    end\n    insert (this z) at (i1) of [order v] \n    go [forward v] ((i1) - (1)) layers\nelse\n    insert (this z) at (1) of [order v] \nend\n\nwhen I receive [_order v]\norder [-50]\n\nwhen I receive [report order v]\nadd (join [wallpaper ] (costume [name v])) to [debug v]\n\n@Wallpaper Tiles\n\ndefine position\nif <((x) - ((CAMERA X) * (0.75))) > [240]> then\n    change [x v] by (-540)\n    change [id v] by (-18)\nelse\n    if <((x) - ((CAMERA X) * (0.75))) < [-300]> then\n        change [x v] by (540)\n        change [id v] by (18)\n    end\nend\nset [tile v] to (item (id) of [wall v])\nif <<([abs v] of ((x) - (CAMERA X)) ) > [210]> or <((mob y) - (CAMERA Y)) < [-160]>> then\n    switch costume to (big v)\nend\ngo to x: (((x) - ((CAMERA X) * (0.75))) + (30)) y: (((((tile) * (30)) + (y)) - ((CAMERA Y) * (0.75))) + (30))\nif <(y position) > [182]> then\n    set y to (182)\nend\nswitch costume to ((item ((id) + (1)) of [wall v]) + (21))\nif <(length of [boss v]) > [5]> then\n    bright to (((18) * ([sin v] of ((timer) * (200)) )) - (15))\nelse\n    bright to [0]\nend\n\nwhen I receive [game loop - scroll v]\nif <(id) = []> then\n    edit\nelse\n    position\nend\n\ndefine clone\nshow\nset [id v] to [1]\nset [x v] to [-60]\nset [y v] to [151]\nrepeat (9)\n    create clone of (_myself_ v)\n    change [id v] by (2)\n    change [x v] by (60)\nend\nset [id v] to [1]\nset [x v] to [-60]\n\nwhen I receive [setup - background v]\nhide\ngo to [back v] layer\nswitch costume to (sky-4 v)\nset [color v] effect to ((HUE #2) + (15))\nshow\nclone\n\ndefine edit\nif <not <(EDIT) = [1]>> then\n    hide\n    stop [this script v]\nend\nset [x v] to ([x v] of [editor v])\nset [y v] to ([y v] of [editor v])\ngo to x: (((x) - (CAMERA X)) + (30)) y: (((y) - (CAMERA Y)) + (30))\npoint in direction (([brush r v] of [editor v]) * (90))\nswitch costume to ([brush v] of [editor v])\nset [ghost v] effect to (33)\nshow\n\nwhen I start as a clone\nif <(id) = [1]> then\n    delete this clone\nelse\n    change [clones v] by (1)\nend\n\ndefine init\ndelete all of [wall v]\nrepeat (LSX)\n    add (pick random (-1) to (1)) to [wall v]\nend\n\ninit\n\ndefine bright to (val)\nset [nxt v] to ((bright) + ((0.1) * ((val) - (bright))))\nif <not <(round (nxt)) = (bright)>> then\n    set [bright v] to (round (nxt))\n    set [brightness v] effect to (bright)\nend\n\nwhen I receive [start v]\nset [color v] effect to ((HUE #2) + (15))\n\nwhen I receive [edit - remap width v]\nset [color v] effect to ((HUE #2) + (15))\n\ndefine order (this z)\nif <(this z) < (item (1) of [order v])> then\n    set [i1 v] to [2]\n    set [i2 v] to (length of [order v])\n    repeat until <(i1) > (i2)>\n        set [last z v] to ([floor v] of ((i1) + (((i2) - (i1)) / (5))) )\n        if <(this z) > (item (last z) of [order v])> then\n            set [i2 v] to ((last z) - (1))\n        else\n            set [i1 v] to ((last z) + (1))\n        end\n    end\n    insert (this z) at (i1) of [order v] \n    go [forward v] ((i1) - (1)) layers\nelse\n    insert (this z) at (1) of [order v] \nend\n\nwhen I receive [_order v]\norder [-100]\n\nwhen I receive [report order v]\nadd (join [Wallpaper Tiles: ] (costume [name v])) to [debug v]\n\n@Particles\n\nwhen I receive [setup - level v]\nset [type v] to []\ndelete all of [particle v]\nhide\n\nwhen I receive [event - explode v]\nif <(type) = []> then\n    explode\nend\n\ndefine explode\ngo to (player v)\nset [collided v] to []\nset size to (100) %\nswitch costume to (yellow v)\nset [type v] to [yellow]\nset [player sx v] to [0]\nset [player sy v] to [0]\nrepeat (15)\n    spawn particle\nend\nrepeat (3)\n    next costume\n    spawn particle\nend\nset size to (10) %\nswitch costume to (circle v)\nset [type v] to [circle]\nset [dx v] to [0]\nset [dy v] to [0]\nset [x v] to ((PLAYER X) + (dx))\nset [y v] to ((PLAYER Y) + (dy))\nset [frame v] to [0]\ncreate clone of (_myself_ v)\nset [type v] to []\n\nwhen I receive [game loop - particles v]\nif <(type) = []> then\n    if <(length of [particle v]) > [0]> then\n        Check Spawn\n    end\n    stop [this script v]\nend\nif <(type) = [yellow]> then\n    Particle <>\n    stop [this script v]\nend\nif <(type) = [dirt]> then\n    Particle \n    stop [this script v]\nend\nif <(type) = [circle]> then\n    Circle\n    stop [this script v]\nend\nif <(type) = [spring]> then\n    spring\n    stop [this script v]\nend\nif <(type) > []> then\n    Collect\n    stop [this script v]\nend\n\ndefine solid = is solid at (x) (y) dir (dir)\nset [idx v] to (([floor v] of ((x) / (60)) ) + (1))\nchange [idx v] by (([floor v] of ((y) / (60)) ) * (LSX))\nset [tile v] to (item (idx) of [map v])\nset [mask v] to (item (tile) of [mask v])\nif <((x) mod (60)) < [30]> then\n    if <((y) mod (60)) < [30]> then\n        set [mid v] to [1]\n    else\n        set [mid v] to [2]\n    end\nelse\n    if <((y) mod (60)) < [30]> then\n        set [mid v] to [0]\n    else\n        set [mid v] to [3]\n    end\nend\nset [c v] to (letter ((((mid) - (item (idx) of [map r v])) mod (4)) + (1)) of (mask))\nif <(c) > [4]> then\n    if <(dir) > [0]> then\n        if <(dir) = [1]> then\n            set [temp v] to ((x) mod (30))\n        else\n            set [temp v] to ((30) - ((y) mod (30)))\n        end\n    else\n        if <(dir) = [-1]> then\n            set [temp v] to ((30) - ((x) mod (30)))\n        else\n            set [temp v] to ((y) mod (30))\n        end\n    end\n    if <(temp) > (overlap)> then\n        set [overlap v] to (temp)\n        set [solid v] to [1]\n    end\nend\n\ndefine Particle <dirt>\nset [dx v] to ((dx) * (0.95))\nif <dirt> then\n    set [dy v] to (((dy) - (0.9)) * (0.99))\n    if <(dy) < [-30]> then\n        set [dy v] to [-30]\n    end\nelse\n    set [dy v] to (((dy) - (0.7)) * (0.95))\nend\nchange [x v] by (dx)\nif <(collided) = []> then\n    set [overlap v] to []\n    if <(dx) > [0]> then\n        solid = is solid at (x) ((y) - (size)) dir [1]\n        if <(overlap) > []> then\n            change [x v] by ((-0.01) - (overlap))\n            set [dx v] to ((-0.8) * ([abs v] of (dx) ))\n        end\n    else\n        solid = is solid at (x) ((y) - (size)) dir [-1]\n        if <(overlap) > []> then\n            change [x v] by ((0.01) + (overlap))\n            set [dx v] to ([abs v] of (dx) )\n        end\n    end\nend\nchange [y v] by (dy)\nif <(collided) = []> then\n    set [overlap v] to []\n    if <(dy) > [0]> then\n        solid = is solid at (x) ((y) - (size)) dir [0]\n        if <(overlap) > []> then\n            change [y v] by ((-0.01) - (overlap))\n            set [dy v] to ((-0.5) * ([abs v] of (dy) ))\n        end\n    else\n        solid = is solid at (x) ((y) - (size)) dir [2]\n        if <(overlap) > []> then\n            change [y v] by ((0.01) + (overlap))\n            set [dy v] to ((0.5) * ([abs v] of (dy) ))\n            set [dx v] to ((dx) * (0.75))\n            if <(dy) > [1]> then\n                change [dx v] by (([abs v] of (dy) ) * (pick random (-0.5) to (0.5)))\n                if <not <dirt>> then\n                    if <(pick random (1) to (2)) = [1]> then\n                        if <(SFX) > [0]> then\n                            start sound (pick random (1) to (6))\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nPosition\nchange [frame v] by (1)\nif <(frame) > [60]> then\n    change [ghost v] effect by (10)\n    if <(frame) > [70]> then\n        delete clone\n    end\nend\n\ndefine Circle\nchange size by (((130) - (size)) * (0.15))\nchange [ghost v] effect by (7)\nPosition\nchange [frame v] by (1)\nif <(frame) > [15]> then\n    delete clone\nend\n\ndefine Position\nset [solid v] to (costume [number v])\nif <<([abs v] of ((x) - (CAMERA X)) ) > [240]> or <([abs v] of ((y) - (CAMERA Y)) ) > [180]>> then\n    switch costume to (big v)\nend\ngo to x: ((x) - (CAMERA X)) y: ((y) - (CAMERA Y))\nswitch costume to (solid)\n\ndefine spawn particle\nset [color v] effect to (0)\nset [frame v] to (pick random (0) to (20))\nset [dx v] to (pick random (-12.0) to (12.0))\nset [dy v] to (pick random (-4.0) to (20.0))\nset [x v] to ((PLAYER X) + (dx))\nset [y v] to ((PLAYER Y) + (dy))\ncreate clone of (_myself_ v)\n\ndefine Check Spawn\nset size to (100) %\nrepeat until <(length of [particle v]) = [0]>\n    set [color v] effect to (0)\n    point in direction (90)\n    set [frame v] to [0]\n    set [collided v] to []\n    set [temp v] to (item (1) of [particle v])\n    if <<(temp) = [pop1]> or <(temp) = [popn]>> then\n        delete (1) of [particle v]\n        set [type v] to (item (1) of [particle v])\n    else\n        set [type v] to (temp)\n    end\n    set [x v] to (item (2) of [particle v])\n    set [y v] to (item (3) of [particle v])\n    repeat (3)\n        delete (1) of [particle v]\n    end\n    set [size v] to [7]\n    if <(temp) = [pop1]> then\n        switch costume to (type)\n        set [type v] to [yellow]\n        set [frame v] to [45]\n        Position\n        set [dx v] to (pick random (-6.0) to (6.0))\n        set [dy v] to (pick random (5.0) to (9.0))\n    else\n        if <(temp) = [popn]> then\n            switch costume to (type)\n            set [type v] to [yellow]\n            set [frame v] to (item (2) of [particle v])\n            Position\n            repeat ((item (1) of [particle v]) - (1))\n                set [dx v] to ((item (3) of [particle v]) * (pick random (-1.0) to (1.0)))\n                set [dy v] to (pick random (item (4) of [particle v]) to (item (5) of [particle v]))\n                create clone of (_myself_ v)\n            end\n            set [dx v] to ((item (3) of [particle v]) * (pick random (-1.0) to (1.0)))\n            set [dy v] to (pick random (item (4) of [particle v]) to (item (5) of [particle v]))\n            repeat (5)\n                delete (1) of [particle v]\n            end\n        else\n            if <<(type) = [15]> or <(type) = [collect]>> then\n                set [dx v] to [0]\n                set [dy v] to [10]\n                if <(type) = [collect]> then\n                    switch costume to (item (1) of [particle v])\n                    delete (1) of [particle v]\n                else\n                    switch costume to (apple v)\n                end\n                set [type v] to [collect]\n            else\n                if <<(type) = [25]> or <(type) = [burst]>> then\n                    if <(type) = [burst]> then\n                        switch costume to (item (1) of [particle v])\n                        delete (1) of [particle v]\n                    else\n                        switch costume to (checkpoint-4 v)\n                    end\n                    set [type v] to [collect]\n                    set [frame v] to [0]\n                    set [temp v] to (pick random (-10) to (-10))\n                    set [dx v] to ((14) * ([sin v] of ((temp) + (pick random (-10) to (-10))) ))\n                    set [dy v] to ((4) + ((14) * ([cos v] of ((temp) + (pick random (-10) to (10))) )))\n                    repeat (7)\n                        Position\n                        create clone of (_myself_ v)\n                        set [dx v] to ((14) * ([sin v] of ((temp) + (pick random (-10) to (10))) ))\n                        set [dy v] to ((4) + ((14) * ([cos v] of ((temp) + (pick random (-10) to (10))) )))\n                        change [temp v] by (45)\n                    end\n                else\n                    if < (type) contains [pop]?> then\n                        switch costume to (type)\n                        set [type v] to [yellow]\n                        set [frame v] to [45]\n                        Position\n                        set [dx v] to (pick random (-6.0) to (6.0))\n                        set [dy v] to (pick random (5.0) to (9.0))\n                        repeat (3)\n                            create clone of (_myself_ v)\n                            set [dx v] to (pick random (-6.0) to (6.0))\n                            set [dy v] to (pick random (5.0) to (9.0))\n                        end\n                    else\n                        if <(type) = [dots]> then\n                            switch costume to (dots v)\n                            set [type v] to [yellow]\n                            set [frame v] to [45]\n                            Position\n                            set [dx v] to (pick random (-6.0) to (6.0))\n                            set [dy v] to (pick random (5.0) to (9.0))\n                            repeat (3)\n                                create clone of (_myself_ v)\n                                set [dx v] to (pick random (-6.0) to (6.0))\n                                set [dy v] to (pick random (5.0) to (9.0))\n                            end\n                        else\n                            if <(type) = [6]> then\n                                switch costume to (pop orange v)\n                                set [dx v] to (pick random (-6.0) to (6.0))\n                                set [dy v] to (pick random (5) to (9.0))\n                            else\n                                if <(type) = [dirt drop]> then\n                                    switch costume to (dots v)\n                                    switch costume to ((costume [number v]) + (pick random (0) to (1)))\n                                    set [type v] to [dirt]\n                                    set [frame v] to [40]\n                                    set [dx v] to (pick random (-0.2) to (0.2))\n                                    set [dy v] to [0]\n                                else\n                                    if < (type) contains [crumble]?> then\n                                        switch costume to (type)\n                                        set [type v] to [dirt]\n                                        set [frame v] to [55]\n                                        set [dx v] to (pick random (-1.0) to (1.0))\n                                        set [dy v] to (pick random (-1.0) to (0))\n                                        set [collided v] to [9]\n                                    else\n                                        if < (type) contains [cloud]?> then\n                                            switch costume to (type)\n                                            set [type v] to [collect]\n                                            set [frame v] to [0]\n                                            set [dx v] to (pick random (-1.0) to (1.0))\n                                            set [dy v] to (pick random (0) to (1.5))\n                                            set [collided v] to [9]\n                                        else\n                                            if < (type) contains [spring]?> then\n                                                switch costume to (type)\n                                                set [frame v] to [0]\n                                                point in direction ((90) * (item (1) of [particle v]))\n                                                delete (1) of [particle v]\n                                                set [dx v] to ((15) * ([sin v] of ((direction) - (90)) ))\n                                                set [dy v] to ((15) * ([cos v] of ((direction) - (90)) ))\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    Position\n    create clone of (_myself_ v)\nend\nif <(type) > []> then\n    set [type v] to []\n    hide\nend\n\ndefine Collect\nchange [dy v] by (((0.5) - (dy)) * (0.1))\nchange [y v] by (dy)\nchange [dx v] by (((0) - (dx)) * (0.1))\nchange [x v] by (dx)\nchange [frame v] by (1)\nchange [ghost v] effect by (5)\nif <(frame) > [20]> then\n    delete clone\nend\nPosition\n\nwhen I start as a clone\nchange [clones v] by (1)\nset [root x v] to (x)\nset [root y v] to (y)\nshow\n\ndefine spring\nchange [frame v] by (1)\nif <(frame) < [3]> then\n    change [x v] by (dx)\n    change [y v] by (dy)\nelse\n    if <(frame) < [5]> then\n        set [dx v] to [0]\n        set [dy v] to [0]\n    else\n        if <(frame) < [30]> then\n            if <((direction) mod (180)) = [0]> then\n                change [dx v] by ((-0.7) * ([sin v] of ((direction) - (90)) ))\n                change [x v] by (dx)\n                if <([abs v] of ((x) - (root x)) ) < [6]> then\n                    solid = is solid at (root x) (root y) dir [0]\n                    replace item (idx) of [map v] with [42]\n                    delete clone\n                end\n            else\n                change [dy v] by ((-0.5) * ([cos v] of ((direction) - (90)) ))\n                change [y v] by (dy)\n                if <([abs v] of ((y) - (root y)) ) < [6]> then\n                    solid = is solid at (root x) (root y) dir [0]\n                    replace item (idx) of [map v] with [42]\n                    delete clone\n                end\n            end\n        end\n    end\nend\nPosition\n\nwhen flag clicked\ngo to [front v] layer\n\ndefine delete clone\nif <(type) > []> then\n    change [clones v] by (-1)\n    delete this clone\nend\n\ndefine show\nshow\nif <(costume [name v]) = [dots]> then\n    set [size v] to [4]\nelse\n    if <(costume [name v]) = [dots2]> then\n        set [size v] to [3]\n    else\n        if <(costume [name v]) = [cloud]> then\n            go to [back v] layer\n            go [forward v] (11) layers\n        else\n            if <(costume [name v]) = [typ 80]> then\n                go to [front v] layer\n                go [backward v] (GUI SPRITE #) layers\n            else\n                if <(costume [name v]) = [pop red]> then\n                    go to [front v] layer\n                    go [backward v] (GUI SPRITE #) layers\n                else\n                    if <(costume [name v]) = [spring]> then\n                        set [color v] effect to (HUE)\n                    end\n                end\n            end\n        end\n    end\nend\nif <(costume [name v]) = [crumble-single]> then\n    go to [back v] layer\n    go [forward v] (1) layers\nend\n\nwhen I receive [report order v]\nadd (join [Particles ] (costume [name v])) to [debug v]\n\ndefine order (this z)\nif <(this z) < (item (1) of [order v])> then\n    set [i1 v] to [2]\n    set [i2 v] to (length of [order v])\n    repeat until <(i1) > (i2)>\n        set [last z v] to ([floor v] of ((i1) + (((i2) - (i1)) / (5))) )\n        if <(this z) > (item (last z) of [order v])> then\n            set [i2 v] to ((last z) - (1))\n        else\n            set [i1 v] to ((last z) + (1))\n        end\n    end\n    insert (this z) at (i1) of [order v] \n    go [forward v] ((i1) - (1)) layers\nelse\n    insert (this z) at (1) of [order v] \nend\n\nwhen I receive [_order v]\norder [-900]\n\n@Active\n\nwhen I receive [game - loop obj v]\ntick\n\ndefine tick\nset [a# v] to [0]\nrepeat (length of [active idx v])\n    set [idx v] to (item (1) of [active idx v])\n    if <not <[idx v] contains (idx)?>> then\n        if <(EDIT) < [1]> then\n            spawn\n        end\n    end\n    delete (1) of [active idx v]\nend\nset [a# v] to [0]\nrepeat (length of [idx v])\n    change [a# v] by (1)\n    set [idx v] to (item (a#) of [idx v])\n    process\nend\n\nwhen flag clicked\ndelete all of [idx v]\ndelete all of [typ v]\ndelete all of [frame v]\ngo to [front v] layer\n\ndefine spawn\nset [tile v] to (item (idx) of [map v])\nif <(tile) = [34]> then\n    init [crumble] [0.5]\n    if <(SFX) > [0]> then\n        start sound [crumble 2 v]\n    end\nelse\n    if <(tile) = [42]> then\n        init [spring] [0]\n        if <(SFX) > [0]> then\n            start sound [spring v]\n        end\n    else\n        if <(tile) = [46]> then\n            init [crumble2] [0.5]\n            if <(SFX) > [0]> then\n                start sound [crumble 2 v]\n            end\n        else\n            if <(tile) = [72]> then\n                Touching Door [key1]\n            else\n                if <<(tile) = [71]> or <(tile) = [84]>> then\n                    Trigger Action\n                end\n            end\n        end\n    end\nend\n\ndefine process\nset [typ v] to (item (a#) of [typ v])\nset [idx v] to (item (a#) of [idx v])\nset [frame v] to (item (a#) of [frame v])\nset [tile v] to (item (idx) of [map v])\nset [dir v] to (item (idx) of [map r v])\nif <(typ) = [crumble]> then\n    tick crumble [8] [34] [0] [0.5]\nelse\n    if <(typ) = [crumble2]> then\n        tick crumble [4] [46] [25] [0.25]\n    else\n        if <(typ) = [spring]> then\n            tick spring\n        end\n    end\nend\n\ndefine init (typ) (frame)\nadd (idx) to [idx v]\nadd (typ) to [typ v]\nadd (frame) to [frame v]\n\ndefine despawn\ndelete (a#) of [idx v]\ndelete (a#) of [typ v]\ndelete (a#) of [frame v]\nchange [a# v] by (-1)\n\ndefine get nx ny\nset [nx v] to (((((idx) - (1)) mod (LSX)) * (60)) + (30))\nset [ny v] to ((([floor v] of (((idx) - (1)) / (LSX)) ) * (60)) + (30))\n\ndefine particle (typ) (x) (y) (dx) (dy) (dir)\nadd (typ) to [particle v]\nif <(dir) < [2]> then\n    if <(dir) = [0]> then\n        add ((x) - (dy)) to [particle v]\n        add ((y) + (dx)) to [particle v]\n    else\n        add ((x) + (dx)) to [particle v]\n        add ((y) + (dy)) to [particle v]\n    end\nelse\n    if <(dir) = [2]> then\n        add ((x) + (dy)) to [particle v]\n        add ((y) - (dx)) to [particle v]\n    else\n        add ((x) - (dx)) to [particle v]\n        add ((y) - (dy)) to [particle v]\n    end\nend\n\ndefine tick crumble (max) (costume) (offset) (inc)\nchange [frame v] by (inc)\nif <not <(frame) > (max)>> then\n    if <((frame) mod (1)) < (inc)> then\n        if <(frame) < (max)> then\n            replace item (idx) of [map v] with ((costume) + (frame))\n        else\n            replace item (idx) of [map v] with [1]\n        end\n        get nx ny\n        set [td v] to (item (idx) of [map r v])\n        set [icrum v] to (((frame) * (3)) + (offset))\n        set [tx v] to (((item ((icrum) - (1)) of [crumble v]) - (1.5)) * (15))\n        set [ty v] to (((item ((icrum) - (0)) of [crumble v]) - (1.5)) * (15))\n        particle (item ((icrum) - (2)) of [crumble v]) (nx) ((ny) - (7.5)) (tx) (ty) (td)\n    end\nelse\n    change [frame v] by ((0.5) - (inc))\n    if <(frame) > [80]> then\n        if <(frame) = [80.5]> then\n            get nx ny\n            if <([abs v] of ((PLAYER X) - (nx)) ) < [45]> then\n                if <([abs v] of ((PLAYER Y) - (ny)) ) < [45]> then\n                    stop [this script v]\n                end\n            end\n        end\n        if <(frame) > ((80) + (max))> then\n            replace item (idx) of [map v] with (costume)\n            despawn\n            stop [this script v]\n        else\n            if <((frame) mod (1)) = [0]> then\n                replace item (idx) of [map v] with (((costume) + (max)) + ((80) - (frame)))\n            end\n        end\n    end\nend\nreplace item (a#) of [frame v] with (frame)\n\ndefine tick spring\nif <(frame) = [0]> then\n    get nx ny\n    if <((dir) mod (2)) = [1]> then\n        if <([abs v] of ((PLAYER X) - (nx)) ) > [30]> then\n            despawn\n            stop [this script v]\n        end\n    else\n        if <([abs v] of ((PLAYER Y) - (ny)) ) > [30]> then\n            despawn\n            stop [this script v]\n        end\n        set [player no slow v] to [15]\n    end\n    replace item (idx) of [map v] with [43]\n    add [spring] to [particle v]\n    add (nx) to [particle v]\n    add (ny) to [particle v]\n    add (dir) to [particle v]\n    Get UXY (((dir) mod (4)) - (1)) [30]\n    if <(ux) = [0]> then\n        set [player sy v] to (uy)\n    else\n        set [player sx v] to (ux)\n    end\n    set [dx v] to (item # of (join [+] (idx)) in [map data v])\n    if <(dx) > [0]> then\n        parse commands (item ((dx) + (1)) of [map data v])\n        set [dx v] to (item # of [x] in [cmds v])\n        if <(dx) > [0]> then\n            set [player sx v] to (item ((dx) + (1)) of [cmds v])\n            set [player no slow v] to [15]\n            set [ux v] to (PLAYER SX)\n            set [uy v] to [0]\n        end\n        set [dx v] to (item # of [y] in [cmds v])\n        if <(dx) > [0]> then\n            set [player sy v] to (item ((dx) + (1)) of [cmds v])\n        end\n    end\n    set [player state v] to [BOING]\n    if <(uy) = [0]> then\n        set [player dir v] to ((ux) / ([abs v] of (ux) ))\n    end\nend\nchange [frame v] by (1)\nif <(frame) = [25]> then\n    replace item (idx) of [map v] with [42]\n    despawn\n    stop [this script v]\nend\nreplace item (a#) of [frame v] with (frame)\n\ndefine Get UXY (dir) (mul)\nif <(dir) > [0]> then\n    if <(dir) = [1]> then\n        set [ux v] to (mul)\n        set [uy v] to [0]\n    else\n        set [ux v] to [0]\n        set [uy v] to ((0) - (mul))\n    end\nelse\n    if <(dir) = [-1]> then\n        set [ux v] to ((0) - (mul))\n        set [uy v] to [0]\n    else\n        set [ux v] to [0]\n        set [uy v] to (mul)\n    end\nend\n\ndefine Touching Door (typ)\nif <not <[collect v] contains (typ)?>> then\n    stop [this script v]\nend\nif <(SFX) > [0]> then\n    start sound [Door Open v]\nend\nreplace item (idx) of [map v] with [1]\nset [player sx v] to [0]\nadd [collect] to [particle v]\nget nx ny\nadd (nx) to [particle v]\nadd (ny) to [particle v]\nadd [Lock-02] to [particle v]\nadd [burst] to [particle v]\nadd ((nx) - (15)) to [particle v]\nadd (ny) to [particle v]\nadd [key1] to [particle v]\nset [shake v] to [12]\n\ndefine parse commands (txt)\ndelete all of [cmds v]\nset [dx v] to [1]\nset [dy v] to []\nrepeat (length of (txt))\n    set [c v] to (letter (dx) of (txt))\n    if <[digits v] contains (c)?> then\n        set [dy v] to (join (dy) (c))\n    else\n        if <(dy) > []> then\n            add (dy) to [cmds v]\n            set [dy v] to []\n        end\n        add (c) to [cmds v]\n    end\n    change [dx v] by (1)\nend\nif <(dy) > []> then\n    add (dy) to [cmds v]\nend\n\nwhen I receive [setup - level v]\nsetup\n\ndefine setup\ndelete all of [group v]\ndelete all of [active idx v]\ndelete all of [frame v]\ndelete all of [idx v]\ndelete all of [typ v]\nset [idx v] to [0]\nrepeat (length of [map v])\n    change [idx v] by (1)\n    set [typ v] to (item (idx) of [map v])\n    if <<(typ) = [71]> or <(typ) = [84]>> then\n        set [dx v] to (item # of (join [+] (idx)) in [map data v])\n        if <(dx) > [0]> then\n            parse commands (item ((dx) + (1)) of [map data v])\n            set [c v] to (item # of [g] in [cmds v])\n            if <(c) > [0]> then\n                set [c v] to (item ((c) + (1)) of [cmds v])\n                repeat ((c) - (length of [group v]))\n                    add [] to [group v]\n                end\n                replace item (c) of [group v] with [hold]\n            end\n        end\n    end\nend\n\nwhen I receive [edit - load v]\nsetup\n\ndefine Trigger Action\nparse commands (idx)\nset [dx v] to (item # of (join [+] (idx)) in [map data v])\nif <(dx) > [0]> then\n    parse commands (item ((dx) + (1)) of [map data v])\n    set [c v] to (item # of [g] in [cmds v])\n    if <(c) > [0]> then\n        set [c v] to (item ((c) + (1)) of [cmds v])\n        replace item (c) of [group v] with [0]\n    end\nend\n\nwhen I receive [edit - reload v]\nsetup\n\ndefine order (this z)\nif <(this z) < (item (1) of [order v])> then\n    set [i1 v] to [2]\n    set [i2 v] to (length of [order v])\n    repeat until <(i1) > (i2)>\n        set [last z v] to ([floor v] of ((i1) + (((i2) - (i1)) / (5))) )\n        if <(this z) > (item (last z) of [order v])> then\n            set [i2 v] to ((last z) - (1))\n        else\n            set [i1 v] to ((last z) + (1))\n        end\n    end\n    insert (this z) at (i1) of [order v] \n    go [forward v] ((i1) - (1)) layers\nelse\n    insert (this z) at (1) of [order v] \nend\n\nwhen I receive [_order v]\norder [-10000]\n\nwhen I receive [report order v]\nadd (join [Active ] (costume [name v])) to [debug v]\n\n@Boss1\n\nwhen flag clicked\nhide\n\ndefine init\ngo to [front v] layer\ngo [backward v] (GUI SPRITE #) layers\nset [id v] to [0]\nset [root idx v] to (item # of [60] in [map v])\nset [root x v] to (((((root idx) - (1)) mod (LSX)) * (60)) + (30))\nset [root y v] to ((([floor v] of (((root idx) - (1)) / (LSX)) ) * (60)) + (60))\n\nwhen I receive [setup - level v]\ndelete all of [boss v]\nrepeat (1)\n    wait (0) seconds\nend\ninit\n\nwhen I receive [game loop - scroll v]\nif <(root idx) < [1]> then\n    stop [this script v]\nend\nif <(length of [boss v]) = [0]> then\n    if <([abs v] of ((PLAYER X) - (root x)) ) > [300]> then\n        stop [this script v]\n    end\n    if <([abs v] of ((PLAYER Y) - (root y)) ) > [240]> then\n        stop [this script v]\n    end\n    spawn\nend\ntick\n\ndefine walk to (x)\nset [temp v] to ((x) - (mob x))\nif <([abs v] of (temp) ) < [8]> then\n    set [dx v] to ((0.5) * (dx))\n    set [temp v] to ((((frame) - (0.1)) mod (18)) + (0.1))\n    if <(temp) < [17]> then\n        change [frame v] by ((0.35) * ((18) - (temp)))\n    else\n        if <(mode) = [walk]> then\n            set [mode v] to [shoot]\n            set [drop# v] to [0]\n            set [pause v] to [99]\n        else\n            if <(mode) = [walk2]> then\n                change [pause v] by (1)\n                if <(pause) > [40]> then\n                    set [mode v] to [walk]\n                    set [target v] to ((item (6) of [boss v]) + (-175))\n                end\n            end\n        end\n    end\nelse\n    set [temp v] to ((temp) / (6))\n    if <([abs v] of (temp) ) > [9]> then\n        set [temp v] to ((9) * ((temp) / ([abs v] of (temp) )))\n    end\n    change [dx v] by ((0.1) * ((temp) - (dx)))\n    if <(((frame) mod (18)) + ([abs v] of (dx) )) > [17.999]> then\n        \n            set [shake v] to (pick random (1) to (2))\n        end\n    end\n    change [frame v] by ([abs v] of (dx) )\nend\nchange [mob x v] by (dx)\n\ndefine Find Boss Arena\nset [temp v] to (root idx)\nrepeat (20)\n    set [mask v] to (item (item (temp) of [map v]) of [mask v])\n    if <(letter (1) of (mask)) < [1]> then\n        change [temp v] by (-1)\n    end\nend\nadd ((((temp) - (0.5)) mod (LSX)) * (60)) to [boss v]\nset [temp v] to (root idx)\nrepeat (20)\n    set [mask v] to (item (item (temp) of [map v]) of [mask v])\n    if <(letter (1) of (mask)) < [1]> then\n        change [temp v] by (1)\n    end\nend\nadd ((((temp) - (0.5)) mod (LSX)) * (60)) to [boss v]\n\ndefine solid = is solid at (x) (y) dir (dir) solid (schk) <spikeissolid>\nset [idx v] to (([floor v] of ((x) / (60)) ) + (1))\nchange [idx v] by (([floor v] of ((y) / (60)) ) * (LSX))\nset [tile v] to (item (idx) of [map v])\nset [mask v] to (item (tile) of [mask v])\nif <((x) mod (60)) < [30]> then\n    if <((y) mod (60)) < [30]> then\n        set [mid v] to [1]\n    else\n        set [mid v] to [2]\n    end\nelse\n    if <((y) mod (60)) < [30]> then\n        set [mid v] to [0]\n    else\n        set [mid v] to [3]\n    end\nend\nset [c v] to (letter ((((mid) - (item (idx) of [map r v])) mod (4)) + (1)) of (mask))\nif <<spikeissolid> and <(c) = [.]>> then\n    set [c v] to [9]\nend\nif <(c) > (schk)> then\n    if <(dir) > [0]> then\n        if <(dir) = [1]> then\n            set [temp v] to ((x) mod (30))\n        else\n            set [temp v] to ((30) - ((y) mod (30)))\n        end\n    else\n        if <(dir) = [-1]> then\n            set [temp v] to ((30) - ((x) mod (30)))\n        else\n            set [temp v] to ((y) mod (30))\n        end\n    end\n    if <(temp) > (overlap)> then\n        set [overlap v] to (temp)\n        set [solid v] to [1]\n    end\nend\n\ndefine spawn\nswitch costume to (spider eyes closed v)\npoint in direction (90)\nadd [SPIDER] to [boss v]\nadd [] to [boss v]\nadd [] to [boss v]\nadd [] to [boss v]\nFind Boss Arena\nadd [0] to [boss v]\nadd [0] to [boss v]\nset [boss stage v] to [1]\nset [mode v] to [walk2]\nset [count v] to [0]\nset [drop# v] to [0]\nset [target v] to (((item (5) of [boss v]) + (item (6) of [boss v])) / (2))\nset [mob x v] to (root x)\nset [mob y v] to (root y)\nset [dx v] to [0]\nset [frame v] to [0]\nset [pause v] to [0]\nset [costume# v] to [3]\ncreate clone of (_myself_ v)\nset [costume# v] to [4]\ncreate clone of (_myself_ v)\nset [costume# v] to [5]\ncreate clone of (_myself_ v)\nset [costume# v] to [2]\nstop [this script v]\n\ndefine tick head\nchange [avg player sx v] by ((0.3) * ((PLAYER SX) - (avg player sx)))\nif < (mode) contains [walk]?> then\n    walk to (target)\nelse\n    if <(mode) = [stab]> then\n        walk to (target)\n    else\n        if <(mode) = [follow]> then\n            if <(pause) > [0]> then\n                if <((pause) mod (20)) = [0]> then\n                    set [target v] to ((PLAYER X) + (pick random (-60) to (60)))\n                end\n                change [pause v] by (-1)\n                walk to (target)\n            else\n                walk to ((PLAYER X) + ((avg player sx) * (10)))\n                set [temp v] to (((PLAYER X) + ((avg player sx) * (22))) - (mob x))\n                if <([abs v] of (temp) ) < [40]> then\n                    set [mode v] to [stab]\n                    set [pause v] to [0]\n                    set [target v] to (mob x)\n                end\n            end\n        else\n            if <(mode) = [shoot]> then\n                change [pause v] by (1)\n                if <(pause) > ((25) - ((boss stage) * (3)))> then\n                    set [pause v] to [0]\n                    if <(drop#) < ((boss stage) + (2))> then\n                        set [temp v] to [0]\n                        if <(boss stage) > [1]> then\n                            replace item (8) of [boss v] with (((item (8) of [boss v]) + (1)) mod (2))\n                        end\n                        broadcast (boss - pip v)\n                    else\n                        set [pause v] to [0]\n                        if <(item (7) of [boss v]) < ((2) - (count))> then\n                            set [pause v] to [0]\n                            if <(count) = [0]> then\n                                set [mode v] to [walk]\n                                set [target v] to ((item (5) of [boss v]) + (175))\n                                set [count v] to [1]\n                            else\n                                set [mode v] to [follow]\n                                set [count v] to [0]\n                                set [pause v] to ((pick random (2) to (4)) * (20))\n                            end\n                        end\n                    end\n                    change [drop# v] by (1)\n                end\n            else\n                if <(mode) = [ouch]> then\n                    change [pause v] by (1)\n                    set [show costume# v] to [spider squish]\n                    if <(pause) > [60]> then\n                        change [boss stage v] by (1)\n                        if <(boss stage) < [4]> then\n                            set [pause v] to [0]\n                            set [mode v] to [shake it off]\n                        else\n                            set [show costume# v] to [spider dead]\n                            boss death\n                        end\n                    end\n                else\n                    if <(mode) = [shake it off]> then\n                        change [pause v] by (1)\n                        set [show costume# v] to [spider squish]\n                        if <(pause) > [30]> then\n                            begin walk sequence\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\ngo to x: ((mob x) - (CAMERA X)) y: (((mob y) + (38)) - (CAMERA Y))\nset [temp v] to ([sin v] of (((frame) * (20)) - (25)) )\nchange y by ((temp) * (1))\npoint towards (player v)\nif <(mode) = [stab]> then\n    action - stab\nelse\n    if <(mode) = [ouch]> then\n        point in direction (180)\n        move (45) steps\n    else\n        if <(mode) = [shake it off]> then\n            if <(pause) < [10]> then\n                point in direction (180)\n                move ((50) * ([sin v] of ((9) * ((10) - (pause))) )) steps\n            else\n                turn left (180) degrees\n                turn left (((direction) * (((20) - (pause)) / (20))) + (180)) degrees\n                turn right ((45) * ([sin v] of ((45) * ((pause) - (10))) )) degrees\n            end\n        end\n    end\nend\nturn right (-90) degrees\nreplace item (2) of [boss v] with (mob x)\nreplace item (3) of [boss v] with (mob y)\nreplace item (4) of [boss v] with (frame)\n\ndefine tick body and legs\nset [frame v] to (item (4) of [boss v])\ngo to x: ((mob x) - (CAMERA X)) y: ((mob y) - (CAMERA Y))\nif <(costume#) = [5]> then\n    set [mob x v] to (item (2) of [boss v])\n    set [mob y v] to (item (3) of [boss v])\n    set [temp v] to ([sin v] of (((frame) * (20)) + (33)) )\n    change y by (((temp) * (2)) + (36))\n    if <((TICK) mod (20)) < [10]> then\n        change [show costume# v] by (1)\n    end\n    if <([mode v] of [boss1 v]) = [ouch]> then\n        point in direction (90)\n        change y by (-30)\n    end\nelse\n    set [temp v] to ([sin v] of (((frame) * (10)) + ((costume#) * (180))) )\n    if <(temp) > [0]> then\n        change y by ((temp) * (16))\n        change [mob x v] by ((0.5) * ((item (2) of [boss v]) - (mob x)))\n        set [mob y v] to (item (3) of [boss v])\n    end\n    if <([mode v] of [boss1 v]) = [ouch]> then\n        change [show costume# v] by (4)\n    end\nend\n\ndefine action - stab\nchange [pause v] by (1)\nif <(pause) < [6]> then\n    turn left (180) degrees\n    turn left (((direction) * ((pause) / (16))) + (180)) degrees\n    move ((-20) * ([sin v] of ((15) * (pause)) )) steps\nelse\n    if <(pause) < [16]> then\n        turn left (180) degrees\n        turn left (((direction) * ((pause) / (16))) + (180)) degrees\n        move (-20) steps\n    else\n        point in direction (180)\n        if <(pause) < [19]> then\n            move ((-20) + ((70) * ([sin v] of ((30) * ((pause) - (16))) ))) steps\n            if <(pause) = [18]> then\n                set [shake v] to [32]\n            end\n        else\n            if <<(pause) > [85]> or <<(count) < [2]> and <(pause) > [20]>>> then\n                if <(pause) < [95]> then\n                    if <(pause) < [85]> then\n                        set [pause v] to [85]\n                    end\n                    move ((0) + ((50) * ([sin v] of ((9) * ((95) - (pause))) ))) steps\n                else\n                    change [count v] by (1)\n                    if <(count) < [3]> then\n                        set [mode v] to [follow]\n                        set [pause v] to ((pick random (1) to (3)) * (20))\n                    else\n                        begin walk sequence\n                    end\n                end\n            else\n                set [show costume# v] to [spider eyes closed]\n                move ((-20) + (70)) steps\n                if <(pause) > [20]> then\n                    move (pick random (-1) to (2)) steps\n                end\n            end\n        end\n    end\nend\n\ndefine begin walk sequence\nset [target v] to ((item (6) of [boss v]) + (-175))\nset [mode v] to [walk]\nset [count v] to [0]\n\ndefine pop (typ) (ox) (oy)\nadd (typ) to [particle v]\nadd (ox) to [particle v]\nadd (oy) to [particle v]\n\ndefine tick\nif <(length of [boss v]) = [1]> then\n    if <(is clone) > [0]> then\n        change [clones v] by (-1)\n        delete this clone\n    end\n    hide\n    stop [this script v]\nend\nswitch costume to (big v)\nset [show costume# v] to (costume#)\nif <(costume#) = [2]> then\n    tick head\nelse\n    tick body and legs\nend\nswitch costume to (show costume#)\nshow\nif <(costume#) = [2]> then\n    if <<not <<(mode) = [ouch]> or <(mode) = [shake it off]>>> and <touching (player v)?>> then\n        if <not <(mode) = [stab]>> then\n            if <(EDIT) < [1]> then\n                set [player death v] to [explode]\n            end\n        else\n            if <<(pause) > [19]> and <(pause) < [85]>> then\n                if <(PLAYER SY) < [-3]> then\n                    if <(KEY - UP) > [0]> then\n                        set [player sy v] to [18]\n                    else\n                        set [player sy v] to [14]\n                    end\n                    broadcast (bounce on head v)\n                    set [mode v] to [ouch]\n                    set [pause v] to [0]\n                    pop [pop red] (PLAYER X) (PLAYER Y)\n                    pop [pop dot] (PLAYER X) ((PLAYER Y) + (6))\n                    set [shake v] to [18]\n                    stop [this script v]\n                end\n            else\n                set [player death v] to [explode]\n            end\n        end\n    end\nend\n\nwhen I receive [reset after death v]\nif <(is clone) > []> then\n    change [clones v] by (-1)\n    delete this clone\nend\ndelete all of [boss v]\nhide\n\nwhen I start as a clone\nset [is clone v] to [1]\nchange [clones v] by (1)\n\ndefine boss death\npopn [25] typ [pop red] xy (mob x) ((mob y) - (50)) dx [10] dyy [2] [16] frm [-5]\npopn [30] typ [pop red] xy (mob x) ((mob y) - (50)) dx [20] dyy [2] [24] frm [-10]\npopn [25] typ [pop dot] xy (mob x) ((mob y) - (40)) dx [15] dyy [2] [20] frm [0]\nset [shake v] to [45]\ndelete all of [boss v]\nadd [dead] to [boss v]\n\nwhen [8 v] key pressed\nif <(username) = [griffpatch]> then\n    if <(is clone) = []> then\n        set [boss stage v] to [3]\n        set [mode v] to [ouch]\n        set [pause v] to [0]\n    end\nend\n\ndefine popn (count) typ (typ) xy (x) (y) dx (dx) dyy (dy1) (dy2) frm (frame)\nadd [popn] to [particle v]\nadd (typ) to [particle v]\nadd (x) to [particle v]\nadd (y) to [particle v]\nadd (count) to [particle v]\nadd (frame) to [particle v]\nadd (dx) to [particle v]\nadd (dy1) to [particle v]\nadd (dy2) to [particle v]\n\nwhen I receive [edit - reload v]\ndelete all of [boss v]\ninit\n\nwhen I receive [edit - remove clones v]\nif <(is clone) > []> then\n    change [clones v] by (-1)\n    delete this clone\nend\n\ndefine order (this z)\nif <(this z) < (item (1) of [order v])> then\n    set [i1 v] to [2]\n    set [i2 v] to (length of [order v])\n    repeat until <(i1) > (i2)>\n        set [last z v] to ([floor v] of ((i1) + (((i2) - (i1)) / (5))) )\n        if <(this z) > (item (last z) of [order v])> then\n            set [i2 v] to ((last z) - (1))\n        else\n            set [i1 v] to ((last z) + (1))\n        end\n    end\n    insert (this z) at (i1) of [order v] \n    go [forward v] ((i1) - (1)) layers\nelse\n    insert (this z) at (1) of [order v] \nend\n\nwhen I receive [_order v]\norder [-950]\n\nwhen I receive [report order v]\nadd (join [Boss1 ] (costume [name v])) to [debug v]\n\n@Decoration\n\nwhen I receive [game loop - scroll v]\n\n    if <<(PLAYER X) > [430]> or <(dy) > [0]>> then\n        change [dy v] by (1)\n        change [y v] by (dy)\n    end\nend\nif <(GAME STATE) = [menu]> then\n    go to x: (0) y: (110)\n    show\nelse\n    switch costume to (big v)\n    set x to (((CAMERA X) * (-0.88)) + (x))\n    set y to (((CAMERA Y) * (-0.88)) + (y))\n    switch costume to (title v)\nend\n\nwhen I receive [setup - level v]\nset [y v] to ((326) * (0.88))\nset [dy v] to [0]\npoint in direction (90)\ngo to [back v] layer\ngo [forward v] (11) layers\nshow\n\nwhen I receive [start v]\nset [y v] to ((326) * (0.88))\nif <(LEVEL #) < [3]> then\n    show\n    if <(LEVEL #) = [1]> then\n        set [x v] to ((CAMERA X) * (0.88))\n    else\n        set [x v] to ((240) * (0.88))\n    end\nelse\n    hide\nend\n\nwhen I receive [menu - setup v]\nset [x v] to ((CAMERA X) * (0.88))\nset [y v] to (((CAMERA Y) * (0.88)) + (116))\n\ndefine order (this z)\nif <(this z) < (item (1) of [order v])> then\n    set [i1 v] to [2]\n    set [i2 v] to (length of [order v])\n    repeat until <(i1) > (i2)>\n        set [last z v] to ([floor v] of ((i1) + (((i2) - (i1)) / (5))) )\n        if <(this z) > (item (last z) of [order v])> then\n            set [i2 v] to ((last z) - (1))\n        else\n            set [i1 v] to ((last z) + (1))\n        end\n    end\n    insert (this z) at (i1) of [order v] \n    go [forward v] ((i1) - (1)) layers\nelse\n    insert (this z) at (1) of [order v] \nend\n\nwhen I receive [_order v]\norder [-150]\n\nwhen I receive [report order v]\nadd (join [Decoration ] (costume [name v])) to [debug v]\n\n@StatsLives\n\nwhen I receive [start v]\ngo to [front v] layer\nshow\nif <(type) = [pause]> then\n    if <(EDIT) > []> then\n        hide\n    end\nend\n\nwhen I receive [setup - level v]\ngo to x: (0) y: (162)\nchange y by (-2)\nswitch costume to (a0 v)\nset [type v] to [apples]\nset x to (-220)\nset [i v] to [1]\ncreate clone of (_myself_ v)\nchange x by (15)\nchange [i v] by (-1)\ncreate clone of (_myself_ v)\nset [type v] to [max]\nchange x by (24)\nset [i v] to [1]\ncreate clone of (_myself_ v)\nchange x by (15)\nchange [i v] by (1)\ncreate clone of (_myself_ v)\nset [type v] to [time]\nset x to (220)\nset [i v] to [5]\ncreate clone of (_myself_ v)\nchange x by (-24)\nchange [i v] by (-1)\ncreate clone of (_myself_ v)\nchange x by (-15)\nchange [i v] by (-1)\ncreate clone of (_myself_ v)\nchange x by (-24)\nchange [i v] by (-1)\ncreate clone of (_myself_ v)\nchange x by (-15)\nchange [i v] by (-1)\ncreate clone of (_myself_ v)\nset [type v] to [pause]\nswitch costume to (pause v)\nset x to (0)\ncreate clone of (_myself_ v)\nset [type v] to []\nset x to (0)\nchange y by (2)\nswitch costume to (game-base v)\n\nwhen I start as a clone\nchange [clones v] by (1)\nchange [gui sprite # v] by (1)\n\nwhen I receive [game loop - scroll v]\nif <(type) = [max]> then\n    switch costume to (join [a] (letter (i) of ([max apples v] of [float apple v])))\nelse\n    if <(type) = [apples]> then\n        switch costume to (join [a] (letter ((length of (APPLES)) - (i)) of (APPLES)))\n    else\n        if <(type) = [time]> then\n            switch costume to (join [a] (letter (i) of (TIME)))\n        else\n            if <(type) = [pause]> then\n                if <<<(GAME STATE) = [BEGIN]> or <(GAME STATE) = [PLAY]>> and <touching (mouse-pointer v)?>> then\n                    change size by ([ceiling v] of (((120) - (size)) * (0.2)) )\n                else\n                    change size by ([floor v] of (((100) - (size)) * (0.2)) )\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nset [gui sprite # v] to [3]\n\nwhen I receive [menu - setup v]\nhide\n\nwhen this sprite clicked\nif <(type) = [pause]> then\n    if <(IN-GAME MENU) = []> then\n        set [in-game menu v] to [pause button]\n    else\n        set [in-game menu v] to []\n    end\nend\n\nwhen I receive [level - complete v]\nif <(type) = [pause]> then\n    hide\nend\n\nwhen I receive [report order v]\nadd (join [StatsLives ] (costume [name v])) to [debug v]\n\ndefine order (this z)\nif <(this z) < (item (1) of [order v])> then\n    set [i1 v] to [2]\n    set [i2 v] to (length of [order v])\n    repeat until <(i1) > (i2)>\n        set [last z v] to ([floor v] of ((i1) + (((i2) - (i1)) / (5))) )\n        if <(this z) > (item (last z) of [order v])> then\n            set [i2 v] to ((last z) - (1))\n        else\n            set [i1 v] to ((last z) + (1))\n        end\n    end\n    insert (this z) at (i1) of [order v] \n    go [forward v] ((i1) - (1)) layers\nelse\n    insert (this z) at (1) of [order v] \nend\n\nwhen I receive [_order v]\norder [-5000]\n\n@Mob - Eye\n\nwhen flag clicked\nhide\n\nwhen I receive [game - loop obj v]\nif <(typ) = []> then\n    stop [this script v]\nend\nif <(state) = [show]> then\n    show\n    set [state v] to []\n    if <(typ) = [blink]> then\n        set [frame v] to [0]\n        go [forward v] (1) layers\n    end\nend\nif <(typ) = [3]> then\n    tick eye\nend\n\nwhen I receive [game loop - scroll v]\nprocess\n\ndefine init\ngo to [front v] layer\ngo [backward v] (GUI SPRITE #) layers\nswitch costume to (blank v)\nset [color v] effect to (HUE)\nset [root idx v] to [0]\nrepeat (length of [map v])\n    change [root idx v] by (1)\n    set [typ v] to (item (root idx) of [map v])\n    if <(typ) = [3]> then\n        set [root x v] to (((((root idx) - (1)) mod (LSX)) * (60)) + (30))\n        set [root y v] to ((([floor v] of (((root idx) - (1)) / (LSX)) ) * (60)) + (30))\n        spawn [3] \n    end\nend\nset [typ v] to []\nhide\n\nwhen I receive [setup - level v]\ninit\n\ndefine spawn (typ) <clone?>\nset [costume# v] to [Big Eye]\nset [typ v] to [3]\nset [id v] to [1]\nset [mob x v] to (root x)\nset [mob y v] to (root y)\nset [state v] to [show]\nif <clone?> then\n    create clone of (_myself_ v)\nend\n\ndefine tick eye\nset [dx v] to ((PLAYER X) - (root x))\nset [dy v] to ((PLAYER Y) - (root y))\nif <([abs v] of (dx) ) > ([abs v] of (dy) )> then\n    set [temp v] to (([abs v] of (dx) ) / (10))\nelse\n    set [temp v] to (([abs v] of (dy) ) / (10))\nend\nset [mob x v] to ((root x) + ((dx) / (temp)))\nset [mob y v] to ((root y) + ((dy) / (temp)))\nchange [frame v] by (1)\nif <(frame) > [200]> then\n    set [frame v] to [0]\n    if <([abs v] of ((mob x) - (CAMERA X)) ) < [300]> then\n        if <([abs v] of ((mob y) - (CAMERA Y)) ) < [240]> then\n            set [typ v] to [blink]\n            create clone of (_myself_ v)\n            set [typ v] to [3]\n        end\n    end\nend\n\nwhen I start as a clone\nchange [clones v] by (1)\nif <(de-clone) > [0]> then\n    stop [this script v]\nend\nif <(typ) = [blink]> then\n    set [de-clone v] to [1]\n    set [mob x v] to (root x)\n    set [mob y v] to (root y)\n    set [costume# v] to [blink1]\n    set [frame v] to [0]\n    set [state v] to [show]\nend\n\nwhen I receive [reset after death v]\nif <(de-clone) > [0]> then\n    delete clone\nend\nset [mob x v] to (root x)\nset [mob y v] to (root y)\nset [state v] to [show]\nhide\n\ndefine process\nif <(typ) = []> then\n    stop [this script v]\nend\nswitch costume to (big v)\ngo to x: ((mob x) - (CAMERA X)) y: ((mob y) - (CAMERA Y))\nswitch costume to (costume#)\nif <(typ) = [blink]> then\n    if <(frame) < [2]> then\n        switch costume to ((costume [number v]) + (frame))\n    else\n        if <(frame) < [10]> then\n            switch costume to ((costume [number v]) + (2))\n        else\n            if <(frame) < [12]> then\n                switch costume to ((costume [number v]) + ((11) - (frame)))\n            else\n                delete clone\n            end\n        end\n    end\n    change [frame v] by (1)\nend\n\ndefine delete clone\nif <(typ) > []> then\n    change [clones v] by (-1)\n    delete this clone\nend\n\nwhen I receive [edit - remove clones v]\nif <(typ) > []> then\n    delete clone\nend\n\nwhen I receive [edit - reload v]\ninit\n\nwhen I receive [start v]\nadd [>>> 3] to [debug v]\ngo to [front v] layer\ngo [backward v] (GUI SPRITE #) layers\n\nwhen I receive [report order v]\nadd (join [Mob - Eye: ] (costume [name v])) to [debug v]\n\ndefine order (this z)\nif <(this z) < (item (1) of [order v])> then\n    set [i1 v] to [2]\n    set [i2 v] to (length of [order v])\n    repeat until <(i1) > (i2)>\n        set [last z v] to ([floor v] of ((i1) + (((i2) - (i1)) / (5))) )\n        if <(this z) > (item (last z) of [order v])> then\n            set [i2 v] to ((last z) - (1))\n        else\n            set [i1 v] to ((last z) + (1))\n        end\n    end\n    insert (this z) at (i1) of [order v] \n    go [forward v] ((i1) - (1)) layers\nelse\n    insert (this z) at (1) of [order v] \nend\n\nwhen I receive [_order v]\norder [-1200]\n\n@Float Apple\n\nwhen flag clicked\npoint in direction (90)\nhide\n\nwhen I receive [game loop - scroll v]\nif <(typ) = []> then\n    stop [this script v]\nend\nif <(state) = [show]> then\n    first show\nend\nif <([floor v] of (typ) ) = [12]> then\n    tick float\nend\ndraw\n\ndefine init\ngo to [front v] layer\ngo [backward v] (GUI SPRITE #) layers\nswitch costume to (blank v)\nset [max apples v] to [0]\nset [root idx v] to [0]\nrepeat ((LSX) * (LSX))\n    change [root idx v] by (1)\n    set [temp v] to (item (root idx) of [map v])\n    set [typ v] to (item (temp) of [mask v])\n    set [typ v] to (join (letter (5) of (typ)) (letter (6) of (typ)))\n    if <(typ) = [12]> then\n        set [root x v] to (((((root idx) - (1)) mod (LSX)) * (60)) + (30))\n        set [root y v] to ((([floor v] of (((root idx) - (1)) / (LSX)) ) * (60)) + (30))\n        change [max apples v] by (1)\n        spawn (typ) \n    else\n        if <(temp) = [80]> then\n            set [root x v] to (((((root idx) - (1)) mod (LSX)) * (60)) + (30))\n            set [root y v] to ((([floor v] of (((root idx) - (1)) / (LSX)) ) * (60)) + (30))\n            replace item (root idx) of [map v] with [79]\n            change [max apples v] by (1)\n            spawn [12.5] \n        else\n            if <(temp) = [15]> then\n                change [max apples v] by (1)\n            end\n        end\n    end\nend\nset [typ v] to []\nhide\n\nwhen I receive [setup - level v]\ninit\n\ndefine spawn (typ) <clone?>\nset [costume# v] to (join [typ ] (temp))\nset [typ v] to (typ)\nset [id v] to [1]\nset [mob x v] to (root x)\nset [mob y v] to (root y)\nset [state v] to [show]\nset [frame v] to [0]\nif <clone?> then\n    create clone of (_myself_ v)\nend\n\ndefine tick float\nif <(oi) > []> then\n    set [mob x v] to (item ((oi) + (2)) of [obj v])\n    set [mob y v] to ((item ((oi) + (3)) of [obj v]) + (30))\n    change [mob y v] by (item ((oi) + (5)) of [obj v])\nelse\n    set [mob x v] to (root x)\n    set [mob y v] to (root y)\nend\nchange [mob y v] by ((6) * ([sin v] of ((((root x) + (root y)) + (TICK)) * (5)) ))\nif <([abs v] of ((PLAYER X) - (mob x)) ) < [30]> then\n    if <([abs v] of ((PLAYER Y) - (mob y)) ) < [30]> then\n        if <(EDIT) < [1]> then\n            if <(SFX) > [0]> then\n                start sound [coin 2 v]\n                start sound [crunch v]\n            end\n            if <(typ) = [12]> then\n                add [15] to [particle v]\n                add (mob x) to [particle v]\n                add (mob y) to [particle v]\n            else\n                add [collect] to [particle v]\n                add (mob x) to [particle v]\n                add (mob y) to [particle v]\n                add (costume [name v]) to [particle v]\n            end\n            change [apples v] by (1)\n            delete clone\n        end\n    end\nend\n\nwhen I start as a clone\nchange [clones v] by (1)\n\nwhen I receive [reset after death v]\nif <(de-clone) > [0]> then\n    delete clone\nend\n\ndefine draw\nif <(typ) = []> then\n    stop [this script v]\nend\nif <(typ) = [12.5]> then\n    if <not <([player substance v] of [player v]) = [hidden]>> then\n        hide\n        stop [this script v]\n    end\n    show\nend\nif <<([abs v] of ((mob x) - (CAMERA X)) ) > [240]> or <([abs v] of ((mob y) - (CAMERA Y)) ) > [180]>> then\n    switch costume to (big v)\nend\ngo to x: ((mob x) - (CAMERA X)) y: ((mob y) - (CAMERA Y))\nswitch costume to (costume#)\n\ndefine delete clone\nif <(typ) > []> then\n    change [clones v] by (-1)\n    delete this clone\nend\n\nwhen I receive [edit - remove clones v]\nif <(typ) > []> then\n    delete clone\nend\n\nwhen I receive [edit - reload v]\ninit\n\ndefine first show\nshow\nset [state v] to []\nif <(typ) = [12]> then\n    set [oi v] to [0]\n    repeat until <(oi) > (length of [obj v])>\n        if <([abs v] of ((root x) - (item ((oi) + (2)) of [obj v])) ) < ((item ((oi) + (4)) of [obj v]) + (5))> then\n            if <([abs v] of (((root y) - (60)) - (item ((oi) + (3)) of [obj v])) ) < ((item ((oi) + (5)) of [obj v]) + (30))> then\n                stop [this script v]\n            end\n        end\n        change [oi v] by (OBJ*)\n    end\nelse\n    set [ghost v] effect to (90)\n    go to [front v] layer\n    go [backward v] (GUI SPRITE #) layers\nend\nset [oi v] to []\n\nwhen I receive [report order v]\nadd (join [Float Apple: ] (costume [name v])) to [debug v]\n\ndefine order (this z)\nif <(this z) < (item (1) of [order v])> then\n    set [i1 v] to [2]\n    set [i2 v] to (length of [order v])\n    repeat until <(i1) > (i2)>\n        set [last z v] to ([floor v] of ((i1) + (((i2) - (i1)) / (5))) )\n        if <(this z) > (item (last z) of [order v])> then\n            set [i2 v] to ((last z) - (1))\n        else\n            set [i1 v] to ((last z) + (1))\n        end\n    end\n    insert (this z) at (i1) of [order v] \n    go [forward v] ((i1) - (1)) layers\nelse\n    insert (this z) at (1) of [order v] \nend\n\nwhen I receive [_order v]\norder [-1150]\n\n@Collect\n\nwhen flag clicked\nhide\n\nwhen I receive [edit - remove clones v]\nif <(is clone) > []> then\n    change [clones v] by (-1)\n    if <(collected) > [0]> then\n        change [gui sprite # v] by (-1)\n    end\n    delete this clone\nend\n\nwhen I receive [edit - reload v]\ninit\n\nwhen I receive [setup - level v]\ninit\n\ndefine init\ndelete all of [collect v]\nset [collected v] to []\nset [is clone v] to []\nset size to (100) %\ngo to [front v] layer\ngo [backward v] (GUI SPRITE #) layers\nswitch costume to (key1 v)\nshow\nset [id v] to [0]\nlocate [70] [key1]\nlocate [85] [mega apple]\nset [typ v] to []\nhide\n\nwhen I receive [game loop - scroll v]\nif <(typ) = []> then\n    stop [this script v]\nend\nif <(collected) = []> then\n    switch costume to (big v)\n    if <(typ) = [key1]> then\n        go to x: ((mob x) - (CAMERA X)) y: (((mob y) - (CAMERA Y)) + ((6) * ([sin v] of ((((x) + (y)) + (TICK)) * (5)) )))\n    else\n        go to x: ((mob x) - (CAMERA X)) y: (((mob y) - (CAMERA Y)) + ((6) * ([sin v] of ((((x) + (y)) + (TICK)) * (3)) )))\n        set size to ((100) + ((4) * ([sin v] of ((((x) + (y)) + (TICK)) * (25)) ))) %\n    end\n    switch costume to (typ)\n    if <(EDIT) < [1]> then\n        if <([abs v] of ((PLAYER X) - (mob x)) ) < [26]> then\n            if <([abs v] of ((PLAYER Y) - (mob y)) ) < [26]> then\n                collect\n            end\n        end\n    end\n    stop [this script v]\nend\nchange x by (((mob x) - (x position)) / (5))\nchange y by (((mob y) - (y position)) / (5))\nif <(size) > [72]> then\n    change size by (-3)\nend\n\nwhen I start as a clone\nchange [clones v] by (1)\nset [is clone v] to [1]\n\ndefine locate (tile id) (typ)\nset [root idx v] to (item # of (tile id) in [map v])\nif <(root idx) > [0]> then\n    set [typ v] to (typ)\n    set [root x v] to (((((root idx) - (1)) mod (LSX)) * (60)) + (30))\n    set [root y v] to ((([floor v] of (((root idx) - (1)) / (LSX)) ) * (60)) + (30))\n    set [mob x v] to (root x)\n    set [mob y v] to (root y)\n    create clone of (_myself_ v)\nend\n\ndefine get nx ny\nset [nx v] to (((((root idx) - (1)) mod (LSX)) * (60)) + (30))\nset [ny v] to ((([floor v] of (((root idx) - (1)) / (LSX)) ) * (60)) + (30))\n\ndefine collect\nreplace item (root idx) of [map v] with [1]\nset [mob x v] to ((-70) + ((32) * (length of [collect v])))\nset [mob y v] to [160]\nadd (typ) to [collect v]\nset [collected v] to (length of [collect v])\nchange [gui sprite # v] by (1)\ngo to [front v] layer\nif <(typ) = [key1]> then\n    if <(SFX) > [0]> then\n        start sound [Key v]\n    end\nelse\n    if <(SFX) > [0]> then\n        start sound [Key v]\n    end\n    add [burst] to [particle v]\n    get nx ny\n    add (nx) to [particle v]\n    add (ny) to [particle v]\n    add [mega apple] to [particle v]\n    set [shake v] to [12]\nend\n\ndefine order (this z)\nif <(this z) < (item (1) of [order v])> then\n    set [i1 v] to [2]\n    set [i2 v] to (length of [order v])\n    repeat until <(i1) > (i2)>\n        set [last z v] to ([floor v] of ((i1) + (((i2) - (i1)) / (5))) )\n        if <(this z) > (item (last z) of [order v])> then\n            set [i2 v] to ((last z) - (1))\n        else\n            set [i1 v] to ((last z) + (1))\n        end\n    end\n    insert (this z) at (i1) of [order v] \n    go [forward v] ((i1) - (1)) layers\nelse\n    insert (this z) at (1) of [order v] \nend\n\nwhen I receive [_order v]\nif <(collected) = []> then\n    order [-1150]\nelse\n    order [-5000]\nend\n\nwhen I receive [report order v]\nadd (join [Collect ] (costume [name v])) to [debug v]\n\n@Wipe\n\nwhen flag clicked\nset [wipe mode v] to []\nset [clone v] to []\nswitch costume to (level 1 v)\nset size to (100) %\ngo to [back v] layer\nhide\n\nwhen I receive [start v]\nif <(wipe mode) = []> then\n    stop [this script v]\nend\nif <(clone) = [1]> then\n    wait (0.4) seconds\n    repeat (16)\n        change [ghost v] effect by (7)\n    end\n    broadcast (wipe - done v)\n    change [gui sprite # v] by (-1)\n    change [clones v] by (-1)\n    delete this clone\nend\nwait [0]\nrepeat (15)\n    change [ghost v] effect by (8)\n    change size by (-2)\nend\nchange [gui sprite # v] by (-1)\ngo to [front v] layer\ngo [backward v] (GUI SPRITE #) layers\n\ndefine wipe <front>\nhide\nif <(wipe mode) > [0]> then\n    stop [this script v]\nend\nif <(clone) > []> then\n    change [clones v] by (-1)\n    change [gui sprite # v] by (-1)\n    delete this clone\nend\nset size to (100) %\nset [wipe mode v] to [1]\nset [x v] to [-360]\ngo to [front v] layer\nif <not <front>> then\n    go [backward v] (GUI SPRITE #) layers\nend\nchange [gui sprite # v] by (1)\ngo to x: (0) y: (0)\nclear graphic effects\nswitch costume to (strip v)\nset [dy v] to [1]\ncreate clone of (_myself_ v)\nswitch costume to (strip2 v)\nset [dy v] to [-1]\ncreate clone of (_myself_ v)\nwait ((7) / (30)) seconds\nset [ghost v] effect to (100)\nif <<(LEVEL #) = [11]> and <(EDIT) = []>> then\n    set [temp v] to [Custom Level]\nelse\n    set [temp v] to (join [Level ] ((LEVEL #) + (0)))\nend\nswitch costume to (temp)\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (0) seconds\nswitch costume to (apple wipe v)\nset [dy v] to []\ncreate clone of (_myself_ v)\nswitch costume to (temp)\nwait (0.6) seconds\nset [game state v] to [next level]\n\nwhen [l v] key pressed\nif <(username) = [griffpatch]> then\n    wipe <>\nend\n\nwhen I start as a clone\nchange [gui sprite # v] by (1)\nchange [clones v] by (1)\nset [clone v] to [1]\nshow\nif <(dy) = []> then\n    stop [this script v]\nend\nset [brightness v] effect to (100)\ngo to x: (0) y: ((dy) * (x))\nrepeat until <(x) > [-20]>\n    change [x v] by (20)\n    go to x: (0) y: ((dy) * (x))\nend\nwait (0.3) seconds\nchange [clones v] by (-1)\nchange [gui sprite # v] by (-1)\ndelete this clone\n\ndefine wait (frames)\nrepeat (frames)\n    if <key (any v) pressed?> then\n        stop [this script v]\n    end\n    wait (0) seconds\nend\n\nwhen I receive [wipe - done v]\nset [wipe mode v] to []\n\nwhen I receive [level - jump to level v]\nwipe \n\nwhen I receive [back to main menu v]\nif <(wipe mode) = []> then\n    stop [this script v]\nend\nrepeat (16)\n    change [ghost v] effect by (7)\nend\nif <(clone) = [1]> then\n    change [gui sprite # v] by (-1)\n    change [clones v] by (-1)\n    delete this clone\nend\nchange [gui sprite # v] by (-1)\ngo to [front v] layer\ngo [backward v] (GUI SPRITE #) layers\nhide\nset [wipe mode v] to []\n\nwhen I receive [level continue v]\nwipe <>\n\nwhen I receive [report order v]\nadd (join [Wipe ] (costume [name v])) to [debug v]\n\ndefine order (this z)\nif <(this z) < (item (1) of [order v])> then\n    set [i1 v] to [2]\n    set [i2 v] to (length of [order v])\n    repeat until <(i1) > (i2)>\n        set [last z v] to ([floor v] of ((i1) + (((i2) - (i1)) / (5))) )\n        if <(this z) > (item (last z) of [order v])> then\n            set [i2 v] to ((last z) - (1))\n        else\n            set [i1 v] to ((last z) + (1))\n        end\n    end\n    insert (this z) at (i1) of [order v] \n    go [forward v] ((i1) - (1)) layers\nelse\n    insert (this z) at (1) of [order v] \nend\n\nwhen I receive [_order v]\norder [-4000]\n\n@Stencil\n\nwhen I receive [game loop - scroll v]\nif <<(PLAYER DEATH) = []> and <(TICK) > [0]>> then\n    switch costume to (big v)\n    go to (player v)\n    switch costume to ([costume name v] of [player v])\n    point in direction ([direction v] of [player v])\n    show\nelse\n    hide\nend\n\nwhen flag clicked\nset [ghost v] effect to (90)\n\nwhen I receive [start v]\ngo to [front v] layer\ngo [backward v] (GUI SPRITE #) layers\nset rotation style [all around v]\n\nwhen I receive [report order v]\nadd (join [Stencil ] (costume [name v])) to [debug v]\n\ndefine order (this z)\nif <(this z) < (item (1) of [order v])> then\n    set [i1 v] to [2]\n    set [i2 v] to (length of [order v])\n    repeat until <(i1) > (i2)>\n        set [last z v] to ([floor v] of ((i1) + (((i2) - (i1)) / (5))) )\n        if <(this z) > (item (last z) of [order v])> then\n            set [i2 v] to ((last z) - (1))\n        else\n            set [i1 v] to ((last z) + (1))\n        end\n    end\n    insert (this z) at (i1) of [order v] \n    go [forward v] ((i1) - (1)) layers\nelse\n    insert (this z) at (1) of [order v] \nend\n\nwhen I receive [_order v]\norder [-1105]\n\n@Font\n\nwhen flag clicked\nset [i v] to [0]\nset size to (110) %\nhide\n\ndefine write (text)\nshow\nset [ghost v] effect to (100)\nset [i v] to [0]\nrepeat (length of (text))\n    change [i v] by (1)\n    switch costume to (costume1 v)\n    switch costume to (letter (i) of (text))\n    if <(costume [number v]) > [1]> then\n        create clone of (_myself_ v)\n    end\n    change x by ((item (costume [number v]) of [font w v]) + (0))\nend\nset [i v] to [0]\nhide\n\nwhen I receive [menu - show scores v]\nif <(i) > [0]> then\n    change [clones v] by (-1)\n    delete this clone\nend\nif <not <(GAME STATE) = [MENU LEVELS]>> then\n    stop [this script v]\nend\nwait (0) seconds\ngo to [front v] layer\nwrite score [1] y: [-13]\nwrite score [2] y: [-37]\nwrite score [3] y: [-61]\ngo to [back v] layer\ngo [forward v] (12) layers\n\ndefine frame to time (frame)\nset [txt v] to (frame)\nset [temp v] to ([floor v] of (((txt) * (10)) / (30)) )\nset [txt v] to (join [.] ((temp) mod (10)))\nset [temp v] to ([floor v] of ((temp) / (10)) )\nset [txt v] to (join ((temp) mod (10)) (txt))\nset [temp v] to ([floor v] of ((temp) / (10)) )\nset [txt v] to (join [:] (join ((temp) mod (6)) (txt)))\nset [temp v] to ([floor v] of ((temp) / (6)) )\nset [txt v] to (join ((temp) mod (10)) (txt))\nif <(temp) < [10]> then\n\nwhen I start as a clone\nchange [clones v] by (1)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\ndefine write score (id) y: (y)\nif <(item ((id) * (2)) of [level scores v]) > []> then\n    go to x: (47) y: (y)\n    frame to time (item ((id) * (2)) of [level scores v])\n    write (join (txt) (join [ - ] (item (((id) * (2)) - (1)) of [level scores v])))\nend\n\nwhen I receive [edit - remove clones v]\nif <(i) > [0]> then\n    change [clones v] by (-1)\n    delete this clone\nend\n\nwhen I receive [report order v]\nadd (join [font ] (costume [name v])) to [debug v]\n\ndefine order (this z)\nif <(this z) < (item (1) of [order v])> then\n    set [i1 v] to [2]\n    set [i2 v] to (length of [order v])\n    repeat until <(i1) > (i2)>\n        set [last z v] to ([floor v] of ((i1) + (((i2) - (i1)) / (5))) )\n        if <(this z) > (item (last z) of [order v])> then\n            set [i2 v] to ((last z) - (1))\n        else\n            set [i1 v] to ((last z) + (1))\n        end\n    end\n    insert (this z) at (i1) of [order v] \n    go [forward v] ((i1) - (1)) layers\nelse\n    insert (this z) at (1) of [order v] \nend\n\nwhen I receive [_order v]\norder [-4500]\n\n@Cloud Scores\n\ndefine begin decode of (encoded)\nset [encoded v] to (encoded)\nset [letter # v] to [1]\n\ndefine value = cloud # (id)\nset [value v] to []\nif <(id) < [9]> then\n    if <(id) < [5]> then\n        if <(id) < [3]> then\n            if <(id) < [2]> then\n                set [value v] to (☁ CLOUD1)\n            else\n                set [value v] to (☁ CLOUD2)\n            end\n        else\n            if <(id) < [4]> then\n                set [value v] to (☁ CLOUD3)\n            else\n                set [value v] to (☁ CLOUD4)\n            end\n        end\n    else\n        if <(id) < [7]> then\n            if <(id) < [6]> then\n                set [value v] to (☁ CLOUD5)\n            else\n                set [value v] to (☁ CLOUD6)\n            end\n        else\n            if <(id) < [8]> then\n                set [value v] to (☁ CLOUD7)\n            else\n                set [value v] to (☁ CLOUD8)\n            end\n        end\n    end\nelse\n    if <(id) < [10]> then\n        set [value v] to (☁ CLOUD9)\n    end\nend\n\ndefine value = read from encoded\nset [value v] to []\nforever\n    set [idx v] to (join (letter (letter #) of (encoded)) (letter ((letter #) + (1)) of (encoded)))\n    change [letter # v] by (2)\n    if <(idx) < [1]> then\n        stop [this script v]\n    end\n    set [value v] to (join (value) (item (idx) of [code v]))\nend\n\ndefine write (val) to encoded\nset [letter # v] to [1]\nrepeat (length of (val))\n    set [encoded v] to (join (encoded) (item # of (letter (letter #) of (val)) in [code v]))\n    change [letter # v] by (1)\nend\nset [encoded v] to (join (encoded) [00])\n\ndefine set cloud # (id) to (value)\nif <(id) < [9]> then\n    if <(id) < [5]> then\n        if <(id) < [3]> then\n            if <(id) < [2]> then\n                set [☁ cloud1 v] to (value)\n            else\n                set [☁ cloud2 v] to (value)\n            end\n        else\n            if <(id) < [4]> then\n                set [☁ cloud3 v] to (value)\n            else\n                set [☁ cloud4 v] to (value)\n            end\n        end\n    else\n        if <(id) < [7]> then\n            if <(id) < [6]> then\n                set [☁ cloud5 v] to (value)\n            else\n                set [☁ cloud6 v] to (value)\n            end\n        else\n            if <(id) < [8]> then\n                set [☁ cloud7 v] to (value)\n            else\n                set [☁ cloud8 v] to (value)\n            end\n        end\n    end\nelse\n    if <(id) < [10]> then\n        set [☁ cloud9 v] to (value)\n    end\nend\n\ndefine write int (val)\nset [encoded v] to (join (encoded) (length of (val)))\nset [encoded v] to (join (encoded) (val))\n\ndefine value = read int\nset [value v] to []\nrepeat (letter (letter #) of (encoded))\n    change [letter # v] by (1)\n    set [value v] to (join (value) (letter (letter #) of (encoded)))\nend\nchange [letter # v] by (1)\n\nwhen I receive [cloud - load level scores v]\nLoad Scores\n\ndefine Load Scores\ndelete all of [level scores v]\nvalue = cloud # ((LEVEL #) - (1))\nbegin decode of (value)\nvalue = read from encoded\nrepeat until <(value) = []>\n    add (value) to [level scores v]\n    value = read int\n    add (value) to [level scores v]\n    value = read from encoded\nend\n\nwhen I receive [cloud - save v]\nLoad Scores\nset [save v] to []\nrecord score if faster [1] (username) score ([time v] of [player v])\nif <(APPLES) = ([max apples v] of [float apple v])> then\n    record score if faster [2] (username) score ([time v] of [player v])\n    if <(item # of [85] in [map v]) = [0]> then\n        record score if faster [3] (username) score ([time v] of [player v])\n    end\nend\nsave scores\nif <(save) > [0]> then\n    broadcast (New Record v)\nend\nLoad Scores\n\ndefine record score if faster (id) (name) score (score)\nset [value v] to (item ((id) * (2)) of [level scores v])\nif <<(value) < [1]> or <(score) < (value)>> then\n    replace item ((id) * (2)) of [level scores v] with (score)\n    replace item (((id) * (2)) - (1)) of [level scores v] with (username)\n    set [save v] to [1]\nend\nsave scores\n\ndefine save scores\nbegin decode of []\nset [id v] to [1]\nrepeat ((length of [level scores v]) / (2))\n    write (item (id) of [level scores v]) to encoded\n    write int (item ((id) + (1)) of [level scores v])\n    change [id v] by (2)\nend\nset cloud # ((LEVEL #) - (1)) to (encoded)\n\nwhen I receive [new record v]\ngo to [front v] layer\nchange [gui sprite # v] by (1)\ngo to x: (0) y: (0)\nshow\nwait (5) seconds\nhide\ngo to [front v] layer\nchange [gui sprite # v] by (-1)\n\nwhen flag clicked\nhide\n\nwhen flag clicked\nsave scores\nLoad Scores\n\nset [☁ cloud6 v] to []\n\ndefine order (this z)\nif <(this z) < (item (1) of [order v])> then\n    set [i1 v] to [2]\n    set [i2 v] to (length of [order v])\n    repeat until <(i1) > (i2)>\n        set [last z v] to ([floor v] of ((i1) + (((i2) - (i1)) / (5))) )\n        if <(this z) > (item (last z) of [order v])> then\n            set [i2 v] to ((last z) - (1))\n        else\n            set [i1 v] to ((last z) + (1))\n        end\n    end\n    insert (this z) at (i1) of [order v] \n    go [forward v] ((i1) - (1)) layers\nelse\n    insert (this z) at (1) of [order v] \nend\n\nwhen I receive [_order v]\norder [-5000]\n\nwhen I receive [report order v]\nadd (join [cloud scores ] (costume [name v])) to [debug v]\n\n@menu\n\nset [production v] to [1]\n\nwhen flag clicked\nset [master ask v] to []\nset [sfx v] to [2]\nset [game state v] to [MENU]\ndelete all of [debug v]\nif <(PRODUCTION) > [0]> then\n    set [level # v] to [1]\nend\nset [clones v] to [0]\nbroadcast (EDIT - Load v) and wait\nGet Spawn\nbroadcast (setup - level v) and wait\nbroadcast (order v) and wait\ndelete all of [order v]\nbroadcast (_order v) and wait\nbroadcast (setup - background v) and wait\nif <(PRODUCTION) < [1]> then\n    broadcast (start v)\n    stop [this script v]\nend\nchange [gui sprite # v] by (1)\nSetup Main Menu []\n\ndefine Menu (level)\nset [tick v] to [0]\nset [menu camera x v] to [0]\nbroadcast (Menu - setup v)\ngo to x: (0) y: (0)\ngo to [front v] layer\nwait (0) seconds\nif <(level) > []> then\n    set [game state v] to [MENU LEVELS]\n    set [level # v] to (level)\n    broadcast (CLOUD - Load Level Scores v) and wait\n    broadcast (Menu - Show Scores v)\nend\nset [mx v] to [0]\nset [my v] to [0]\nrepeat until <(GAME STATE) = [MENU OFF]>\n    change [tick v] by (1)\n    if <(GAME STATE) = [MENU]> then\n        change [menu camera x v] by (((0) - (menu camera x)) * (0.25))\n    else\n        if <(GAME STATE) = [MENU LEVELS]> then\n            change [menu camera x v] by (((540) - (menu camera x)) * (0.25))\n        end\n    end\n    if <(GAME STATE) = [MENU]> then\n        change [mx v] by (((mouse x) - (mx)) * (0.05))\n        change [my v] by (((mouse y) - (my)) * (0.05))\n    else\n        change [mx v] by (((0) - (mx)) * (0.05))\n        change [my v] by (((0) - (my)) * (0.05))\n    end\n    set [camera x v] to (((PLAYER X) + (100)) + (menu camera x))\n    set [camera y v] to ((PLAYER Y) + (30))\n    change [camera x v] by (() + ((mx) * (0.25)))\n    change [camera y v] by (() + ((my) * (0.25)))\n    broadcast (game - loop obj v)\n    broadcast (game loop - particles v)\n    broadcast (Menu Tick v)\n    broadcast (game loop - scroll v)\n    broadcast (CLOUD - Load Level Scores v)\nend\nwait (0.03) seconds\nbroadcast (Menu - Off v)\nchange [level # v] by (-1)\nbroadcast (Level - Jump to Level v) and wait\nchange [level # v] by (1)\nset [game state v] to [MENU EXIT]\nwait (0.06) seconds\nbroadcast (EDIT - Remove Clones v) and wait\nwait (0.03) seconds\nbroadcast (EDIT - Load v) and wait\nwait (0.03) seconds\nbroadcast (EDIT - Reload v) and wait\nbroadcast (start v)\nstop [this script v]\n\nwhen I start as a clone\nchange [clones v] by (1)\nchange [gui sprite # v] by (1)\nset [over v] to [0]\nshow\nrepeat until <(GAME STATE) = [MENU EXIT]>\n    if <(id) = [White]> then\n        set [ghost v] effect to ((100) - ((([menu camera x v] of [menu v]) - (240)) / (3.5)))\n    else\n        if <<(id) = [Labels]> or < (id) contains [Text ]?>> then\n            position x ((pos x) - ([menu camera x v] of [menu v]))\n            set [ghost v] effect to ((100) - (([menu camera x v] of [menu v]) - (240)))\n            \n                change size by ([ceiling v] of (((52) - (size)) * (0.2)) )\n            end\n        else\n            tick\n        end\n    end\nend\nchange [gui sprite # v] by (-1)\nchange [clones v] by (-1)\ndelete this clone\n\nwhen this sprite clicked\nif <(MASTER ASK) > []> then\n    stop [this script v]\nend\nif < (id) contains [AUDIO]?> then\n    if <(id) = [AUDIO ON]> then\n        set [id v] to [AUDIO SFX]\n        set [sfx v] to [1]\n    else\n        if <(id) = [AUDIO SFX]> then\n            set [id v] to [AUDIO OFF]\n            set [sfx v] to []\n        else\n            set [id v] to [AUDIO ON]\n            set [sfx v] to [2]\n        end\n    end\n    broadcast (Audio Toggle v)\nend\nif <(SFX) > [0]> then\n    start sound [coin 2 v]\nend\nif <(id) = [old PLAY]> then\n    set [level # v] to [2]\n    set [game state v] to [MENU OFF]\nend\nif <<(id) = [LEVELS]> or <(id) = [PLAY]>> then\n    set [game state v] to [MENU LEVELS]\n    wait (0.25) seconds\n    broadcast (CLOUD - Load Level Scores v) and wait\n    broadcast (Menu - Show Scores v)\nend\nif << (id) contains [Level ]?> or <(id) = [SELECT]>> then\n    set [game state v] to [MENU OFF]\nend\nif <(id) = [BACK]> then\n    set [game state v] to [MENU]\n    broadcast (Menu - Show Scores v)\nend\nleft\nright\nif <(id) = [EDITOR]> then\n    set [level # v] to [12]\n    set [game state v] to [MENU OFF]\n    set [edit v] to [0]\nend\nif <(id) = [LOAD]> then\n    broadcast (EDIT - Load Ask v) and wait\n    if <(LEVEL #) = [12]> then\n        set [game state v] to [MENU OFF]\n    end\nend\n\nwhen I receive [menu - off v]\nif <(pos x) < [20]> then\n    repeat (30)\n        change [tick v] by (1)\n        change [camera x v] by (0)\n        broadcast (game loop - scroll v)\n    end\nend\n\ndefine position x (x)\nset x to (round (x))\nif <(round (x)) = (x position)> then\n    show\nelse\n    hide\nend\n\ndefine tick\nswitch costume to (id)\nif <touching (mouse-pointer v)?> then\n    change size by ([ceiling v] of ((((size) * (1.12)) - (size)) * (0.2)) )\n    if < (id) contains [level ]?> then\n    if <(over) = [0]> then\n        set [over v] to [1]\n        if <(SFX) > [0]> then\n            start sound [click v]\n        end\n    end\nelse\n    if <(size) < (size)> then\n        change size by ([ceiling v] of (((size) - (size)) * (0.2)) )\n    else\n        change size by ([floor v] of (((size) - (size)) * (0.2)) )\n    end\n    set [over v] to [0]\nend\nposition x ((pos x) - ([menu camera x v] of [menu v]))\n\nwhen I receive [menu - show scores v]\nif < (id) contains [Level ]?> then\n    set [id v] to (join [Level ] ((LEVEL #) - (1)))\n    set size to ([ceiling v] of ((size) * (1.1)) ) %\nend\nif < (id) contains [Text ]?> then\n    set [id v] to (join [Text ] ((LEVEL #) - (1)))\n    switch costume to (id)\nend\n\nwhen [left arrow v] key pressed\nleft\n\ndefine left\nif <(id) = [LEFT]> then\n    if <(GAME STATE) = [MENU LEVELS]> then\n        start sound [coin 2 v]\n        if <(LEVEL #) > [2]> then\n            set size to (150) %\n            change [level # v] by (-1)\n            broadcast (CLOUD - Load Level Scores v)\n            broadcast (Menu - Show Scores v)\n        end\n    end\nend\n\nwhen [right arrow v] key pressed\nright\n\ndefine right\nif <(id) = [RIGHT]> then\n    if <(GAME STATE) = [MENU LEVELS]> then\n        start sound [coin 2 v]\n        if <(LEVEL #) < [10]> then\n            set size to (150) %\n            change [level # v] by (1)\n            broadcast (CLOUD - Load Level Scores v)\n            broadcast (Menu - Show Scores v)\n        end\n    end\nend\n\ndefine Setup Main Menu (level)\ndelete all of [debug v]\ngo to [front v] layer\nswitch costume to (white v)\nset size to (100) %\nset [id v] to (costume [name v])\ngo to x: (0) y: (0)\ncreate clone of (_myself_ v)\nset [pos x v] to [540]\nswitch costume to (labels v)\nset size to (100) %\nset [id v] to (costume [name v])\ngo to x: (0) y: (0)\ncreate clone of (_myself_ v)\nswitch costume to (text 1 v)\nset size to (52) %\nset [id v] to (costume [name v])\nchange [pos x v] by (91)\ngo to x: (91) y: (30)\ncreate clone of (_myself_ v)\nset size to (10) %\nhide\nset [level # v] to [2]\nset [size v] to [100]\nset [pos x v] to [0]\nset [id v] to [PLAY]\nset y to (-5)\ncreate clone of (_myself_ v)\nset [id v] to [EDITOR]\nchange y by (-54)\ncreate clone of (_myself_ v)\nif <(SFX) > [0]> then\n    if <(SFX) > [1]> then\n        set [id v] to [AUDIO ON]\n    else\n        set [id v] to [AUDIO SFX]\n    end\nelse\n    set [id v] to [AUDIO OFF]\nend\nchange y by (-54)\ncreate clone of (_myself_ v)\nset [size v] to [35]\nset [id v] to [Level 1]\nset y to (-5)\nset [pos x v] to ((540) + (-134))\ncreate clone of (_myself_ v)\nset [size v] to [100]\nset [id v] to [BACK]\nset y to (128)\nset [pos x v] to ((540) + (-140))\ncreate clone of (_myself_ v)\nset [id v] to [LOAD]\nset [pos x v] to ((540) + (140))\ncreate clone of (_myself_ v)\nset [id v] to [LEFT]\nset y to (-134)\nset [pos x v] to ((540) + (-140))\ncreate clone of (_myself_ v)\nset [id v] to [RIGHT]\nset [pos x v] to ((540) + (140))\ncreate clone of (_myself_ v)\nset [id v] to [SELECT]\nset [pos x v] to ((540) + (0))\ncreate clone of (_myself_ v)\nset [id v] to []\nMenu (level)\nset size to (100) %\n\nwhen I receive [back to main menu v]\nif <(GAME STATE) = [back to level select]> then\n    Back to Menu (LEVEL #)\nelse\n    Back to Menu []\nend\n\ndefine Get Spawn\nset [spawn idx v] to (item # of [76] in [map v])\nset [player x v] to (((((SPAWN IDX) - (1)) mod (LSX)) * (60)) + (30))\nset [player y v] to ((([floor v] of (((SPAWN IDX) - (1)) / (LSX)) ) * (60)) + (17))\nset [camera x v] to ((PLAYER X) + (100))\nset [camera y v] to ((PLAYER Y) + (30))\nchange [player x v] by (-14)\nset [player inv v] to [0]\n\nwhen I receive [back to level select v]\nif <(id) = []> then\n    set [game state v] to [back to level select]\n    broadcast (BACK TO MAIN MENU v)\nend\n\ndefine Back to Menu (level)\nset [game state v] to [MENU]\nwait (0.1) seconds\nset [edit v] to []\nbroadcast (EDIT - Remove Clones v) and wait\nwait (0.03) seconds\nset [level # v] to [1]\nbroadcast (EDIT - Load v) and wait\nwait (0.03) seconds\nbroadcast (EDIT - Reload v) and wait\nwait (0.03) seconds\nbroadcast (EDIT - remap width v) and wait\nGet Spawn\nSetup Main Menu (level)\n\nif <(level) = []> then\n\ndefine order (this z)\nif <(this z) < (item (1) of [order v])> then\n    set [i1 v] to [2]\n    set [i2 v] to (length of [order v])\n    repeat until <(i1) > (i2)>\n        set [last z v] to ([floor v] of ((i1) + (((i2) - (i1)) / (5))) )\n        if <(this z) > (item (last z) of [order v])> then\n            set [i2 v] to ((last z) - (1))\n        else\n            set [i1 v] to ((last z) + (1))\n        end\n    end\n    insert (this z) at (i1) of [order v] \n    go [forward v] ((i1) - (1)) layers\nelse\n    insert (this z) at (1) of [order v] \nend\n\nwhen I receive [_order v]\norder [-4300]\n\nwhen I receive [report order v]\nadd (join [menu ] (costume [name v])) to [debug v]\n\n@in-game menu\n\nwhen flag clicked\nhide\nshow list [level code v]\ngo to x: (0) y: (159)\nset [vis v] to [0]\nset [in-game menu v] to []\nset [id v] to []\nswitch costume to (edit menu v)\nset size to (50) %\n\nwhen I receive [game loop - scroll v]\nif <(id) = [fake]> then\n    stop [this script v]\nend\nif <<(EDIT) > []> or <<(IN-GAME MENU) > []> and <(id) > []>>> then\n    if <(vis) < [1]> then\n        set [vis v] to [1]\n        show\n    end\n    if <(id) = [pause back]> then\n        stop [this script v]\n    end\n    if <(id) = [editor help]> then\n        stop [this script v]\n    end\n    set [over v] to []\n    if <([drawing v] of [editor v]) < [1]> then\n        if <([abs v] of ((y position) - (mouse y)) ) < [15]> then\n            if <([abs v] of ((x position) - (mouse x)) ) < [68]> then\n                set [over v] to [1]\n                if <(was over) = []> then\n                    if <(SFX) > [0]> then\n                        start sound [click v]\n                    end\n                end\n                if <mouse down?> then\n                    if <(vis) = [1]> then\n                        set [vis v] to [2]\n                        show menu\n                    end\n                else\n                    set [vis v] to [1]\n                end\n            end\n        end\n    end\n    if <(over) > [0]> then\n        change size by ([ceiling v] of (((110) - (size)) * (0.2)) )\n        if <(id) > []> then\n            switch costume to (id)\n            next costume\n        end\n    else\n        if <[100] > (size)> then\n            change size by ([ceiling v] of (((110) - (size)) * (0.2)) )\n        else\n            change size by ([floor v] of (((100) - (size)) * (0.2)) )\n        end\n        if <(id) > []> then\n            switch costume to (id)\n        else\n            if <<(EDIT) = [1]> = <(costume [name v]) = [edit]>> then\n                if <(EDIT) = [1]> then\n                    switch costume to (edit menu v)\n                else\n                    switch costume to (edit v)\n                end\n            end\n        end\n    end\nelse\n    if <(vis) > [0]> then\n        set [vis v] to [0]\n        hide\n    end\n    if <(id) > []> then\n        change [gui sprite # v] by (-1)\n        change [clones v] by (-1)\n        delete this clone\n    end\nend\nset [was over v] to (over)\n\ndefine show menu\nif <(MASTER ASK) > []> then\n    stop [this script v]\nend\nif <(id) = []> then\n    if <(IN-GAME MENU) > []> then\n        set [in-game menu v] to []\n        set size to (130) %\n        broadcast (EDITOR - close menu v) and wait\n    else\n        if <(EDIT) > [0]> then\n            clone editor menu\n        else\n            broadcast (EDIT - toggle play v) and wait\n        end\n    end\n    stop [this script v]\nend\nif < (id) contains [AUDIO]?> then\n    if <(id) = [AUDIO ON]> then\n        set [id v] to [AUDIO SFX]\n        set [sfx v] to [1]\n    else\n        if <(id) = [AUDIO SFX]> then\n            set [id v] to [AUDIO OFF]\n            set [sfx v] to []\n        else\n            set [id v] to [AUDIO ON]\n            set [sfx v] to [2]\n        end\n    end\n    broadcast (Audio Toggle v)\nend\nif <(SFX) > [0]> then\n    start sound [coin 2 v]\nend\nif <(id) = [Continue]> then\n    set [in-game menu v] to []\n    stop [this script v]\nend\nif <(id) = [EDIT - CLOSE]> then\n    set [in-game menu v] to []\n    broadcast (EDITOR - close menu v) and wait\n    stop [this script v]\nend\nif <(id) = [EDIT - PLAY]> then\n    set [in-game menu v] to []\n    broadcast (EDIT - toggle play v) and wait\n    broadcast (EDITOR - close menu v) and wait\n    stop [this script v]\nend\nif <(id) = [EDIT - NEW]> then\n    broadcast (hide help v)\n    set [id v] to [fake]\n    create clone of (_myself_ v)\n    hide\n    ask [Clear level and start again? \[Y/N\]] and wait\n    if <(letter (1) of (answer)) = [y]> then\n        broadcast (EDIT - New Level v) and wait\n    else\n        set [in-game menu v] to []\n        broadcast (EDITOR - close menu v) and wait\n    end\n    stop [this script v]\nend\nif <(id) = [EDIT - MAIN MENU]> then\n    set [in-game menu v] to []\n    broadcast (BACK TO MAIN MENU v)\n    stop [this script v]\nend\nif <(id) = [Restart]> then\n    set [player death v] to [reset]\n    set [in-game menu v] to []\n    broadcast (EDITOR - close menu v) and wait\n    stop [this script v]\nend\nif <(id) = [EDIT - SAVE]> then\n    save menu\nend\nif <(id) = [EDIT - LOAD]> then\n    broadcast (hide help v)\n    create clone of (_myself_ v)\n    Load Menu \n    set [in-game menu v] to []\n    broadcast (EDITOR - close menu v) and wait\n    stop [this script v]\nend\nif <(id) = [Continue3]> then\n    set [in-game menu v] to []\n    broadcast (Level Continue v)\n    broadcast (EDITOR - close menu v) and wait\n    stop [this script v]\nend\nif <(id) = [Try Again]> then\n    set [replay idx v] to []\n    change [level # v] by (-1)\n    set [in-game menu v] to []\n    broadcast (Level Continue v)\n    broadcast (EDITOR - close menu v) and wait\n    stop [this script v]\nend\nif <(id) = [Replay]> then\n    change [level # v] by (-1)\n    set [replay idx v] to [9999999]\n    set [in-game menu v] to []\n    broadcast (Level Continue v)\n    broadcast (EDITOR - close menu v) and wait\n    stop [this script v]\nend\nif <(id) = [Next Level]> then\n    set [replay idx v] to []\n    set [in-game menu v] to []\n    broadcast (Level Continue v)\n    broadcast (EDITOR - close menu v) and wait\n    stop [this script v]\nend\nif <(id) = [Save Replay]> then\n    save replay menu\nend\nif <(id) = [Level Select]> then\n    set [in-game menu v] to []\n    broadcast (BACK TO LEVEL SELECT v)\n    stop [this script v]\nend\n\nwhen I receive [editor - close menu v]\nif <(id) > []> then\n    change [gui sprite # v] by (-1)\n    change [clones v] by (-1)\n    delete this clone\nend\n\nwhen I start as a clone\nswitch costume to (id)\nchange [gui sprite # v] by (1)\nchange [clones v] by (1)\n\nwhen I receive [start v]\nif <(EDIT) > []> then\n    go to x: (0) y: (159)\n    go to [front v] layer\n    show\n    broadcast (EDIT - toggle play v)\nelse\n    hide\nend\n\ndefine clone editor menu\nset [in-game menu v] to [1]\nset size to (50) %\ngo to x: (-100) y: (110)\nset [id v] to [EDIT - PLAY]\ncreate clone of (_myself_ v)\nchange y by (-48)\nset [id v] to [EDIT - MAIN MENU]\ncreate clone of (_myself_ v)\nchange y by (-48)\nset [id v] to [EDIT - CLOSE]\ncreate clone of (_myself_ v)\ngo to x: (100) y: (110)\nset [id v] to [EDIT - SAVE]\ncreate clone of (_myself_ v)\nchange y by (-48)\nset [id v] to [EDIT - LOAD]\ncreate clone of (_myself_ v)\nchange y by (-48)\nset [id v] to [EDIT - NEW]\ncreate clone of (_myself_ v)\nset size to (100) %\ngo to x: (0) y: (0)\nset [id v] to [editor help]\ncreate clone of (_myself_ v)\ngo to x: (0) y: (159)\nset [id v] to []\nset size to (130) %\n\ndefine reload\nset [in-game menu v] to []\nbroadcast (EDITOR - close menu v) and wait\nset [spawn idx v] to (([floor v] of ((PLAYER Y) / (60)) ) * (LSX))\nchange [spawn idx v] by (([floor v] of ((PLAYER X) / (60)) ) + (1))\nset [player inv v] to [45]\nwait (0) seconds\nbroadcast (EDIT - Reload v) and wait\nwait (0) seconds\nbroadcast (EDIT - remap width v) and wait\n\nwhen I receive [back to main menu v]\nif <(id) > []> then\n    change [gui sprite # v] by (-1)\n    change [clones v] by (-1)\n    delete this clone\nend\nhide\n\ndefine val = replace (a) with (b) from (txt)\nset [val v] to []\nrepeat (length of (txt))\n    set [c v] to (letter ((length of (val)) + (1)) of (txt))\n    if <(c) = (a)> then\n        set [val v] to (join (val) (b))\n    else\n        set [val v] to (join (val) (c))\n    end\nend\n\ndefine save menu\nset [in-game menu v] to []\nbroadcast (EDIT - Save v) and wait\nval = replace [ ] with [Z] from (item (1) of [level code v])\nval = replace [+] with [B] from (val)\nval = replace [-] with [C] from (val)\nset [val v] to (join ((length of (val)) + (1234567)) (val))\nreplace item (1) of [level code v] with (val)\ninsert [Select the entire code below by double clicking it] at (1) of [level code v] \ninsert [] at (2) of [level code v] \ninsert [] at (4) of [level code v] \ninsert [Then right click it and choose "Copy"] at (5) of [level code v] \ninsert [This is your level code - save it somewhere safe!] at (6) of [level code v] \nhide list [level code v]\nforever\n    repeat until <not <mouse down?>>\n        wait (0) seconds\n    end\n    repeat until <<mouse down?> or <key (space v) pressed?>>\n        wait (0) seconds\n    end\n    set [val v] to []\n    if <([abs v] of (mouse x) ) > [184]> then\n        set [val v] to [1]\n    end\n    if <([abs v] of ((mouse y) - (44)) ) > [96]> then\n        set [val v] to [1]\n    end\n    if <key (space v) pressed?> then\n        set [val v] to [1]\n    end\n    if <(val) > [0]> then\n        show list [level code v]\n        repeat until <not <mouse down?>>\n            wait (0) seconds\n        end\n        broadcast (EDITOR - close menu v) and wait\n        stop [this script v]\n    end\nend\n\ndefine Load Menu <in editor>\nhide\nset [master ask v] to [LOAD]\nask [Enter your "Level Code" here:] and wait\nset [master ask v] to []\nforever\n    if <(answer) = []> then\n        if <(IN-GAME MENU) > [0]> then\n            show\n        end\n        stop [this script v]\n    end\n    read number (answer) [7]\n    read until end (answer) from [8]\n    if <((num) - (1234567)) = (length of (val))> then\n        set [level # v] to [12]\n        val = replace [Z] with [ ] from (val)\n        val = replace [B] with [+] from (val)\n        val = replace [C] with [-] from (val)\n        delete all of [level code v]\n        add (val) to [level code v]\n        broadcast (EDIT - Import Level v) and wait\n        if <in editor> then\n            broadcast (EDIT - Import Level 2 v) and wait\n        end\n        stop [this script v]\n    end\n    read number (answer) [8]\n    read until end (answer) from [9]\n    if <((num) - (12345678)) = (length of (val))> then\n        load replay []\n        stop [this script v]\n    end\n    ask [Your code was invalid, please try again:] and wait\nend\n\ndefine read number (text) (len)\nset [num v] to []\nrepeat (len)\n    set [num v] to (join (num) (letter ((length of (num)) + (1)) of (text)))\nend\n\ndefine read until end (txt) from (idx)\nset [val v] to []\nset [i v] to (idx)\nforever\n    set [c v] to (letter (i) of (txt))\n    if <<(c) = []> or <(c) = [ ]>> then\n        stop [this script v]\n    end\n    set [val v] to (join (val) (c))\n    change [i v] by (1)\nend\n\nwhen I receive [edit - new level v]\nif <(id) = []> then\n    wait (0.1) seconds\n    reload\n    reset camera\nend\n\nwhen I receive [edit - import level 2 v]\nif <(id) = []> then\n    wait (0.1) seconds\n    broadcast (EDIT - Load v) and wait\n    set [in-game menu v] to []\n    broadcast (EDITOR - close menu v) and wait\n    set [player inv v] to [45]\n    wait (0) seconds\n    broadcast (EDIT - Reload v) and wait\n    wait (0) seconds\n    broadcast (EDIT - remap width v) and wait\n    reset camera\nend\n\ndefine reset camera\nset [spawn idx v] to (item # of [76] in [map v])\nif <(SPAWN IDX) < [1]> then\n    set [spawn idx v] to (((4) * (LSX)) + (3))\nend\nif <(SPAWN IDX) > [0]> then\n    set [player x v] to (((((SPAWN IDX) - (1)) mod (LSX)) * (60)) + (30))\n    set [player y v] to ((([floor v] of (((SPAWN IDX) - (1)) / (LSX)) ) * (60)) + (17))\nelse\n    set [player x v] to [128]\n    set [player y v] to [280]\nend\n\nwhen I receive [hide help v]\nif <(id) = [editor help]> then\n    hide\nend\n\nwhen I receive [edit - load ask v]\nLoad Menu <>\n\nwhen I receive [pause menu v]\nif <<(EDIT) > [0]> or <(id) > []>> then\n    stop [this script v]\nend\npuase menu\n\ndefine puase menu\nset [in-game menu v] to [1]\nset size to (100) %\ngo to x: (0) y: (0)\nswitch costume to (pause back v)\nset [id v] to [pause back]\ncreate clone of (_myself_ v)\nset size to (50) %\ngo to x: (0) y: (35)\nif <(REPLAY IDX) = []> then\n    set [id v] to [Restart]\n    create clone of (_myself_ v)\n    change y by (-65)\n    if <(SFX) > [0]> then\n        if <(SFX) > [1]> then\n            set [id v] to [AUDIO ON]\n        else\n            set [id v] to [AUDIO SFX]\n        end\n    else\n        set [id v] to [AUDIO OFF]\n    end\n    create clone of (_myself_ v)\n    change y by (-48)\n    set [id v] to [EDIT - MAIN MENU]\n    set [id v] to [Level Select]\n    create clone of (_myself_ v)\nelse\n    set [id v] to [Save Replay]\n    create clone of (_myself_ v)\n    change y by (-65)\n    set x to (0)\n    set [id v] to [Try Again]\n    create clone of (_myself_ v)\n    change y by (-48)\n    set x to (0)\n    set [id v] to [Next Level]\n    create clone of (_myself_ v)\n    change y by (-48)\n    set x to (0)\n    set [id v] to [Level Select]\n    create clone of (_myself_ v)\nend\nset [id v] to []\nset [c v] to [2]\nrepeat until <<(c) = [1]> or <(IN-GAME MENU) = []>>\n    if <key (p v) pressed?> then\n        change [c v] by (1)\n    else\n        set [c v] to [0]\n    end\n    broadcast (game loop - scroll v) and wait\nend\nrepeat until <not <key (p v) pressed?>>\n    wait (0) seconds\nend\nset [in-game menu v] to []\n\ndefine clone level complete menu\nset [replay idx v] to []\nset [in-game menu v] to [1]\nset size to (100) %\ngo to x: (0) y: (0)\nswitch costume to (pause back v)\nset [id v] to [pause back]\ncreate clone of (_myself_ v)\nset size to (50) %\ngo to x: (-90) y: (0)\nset [id v] to [Continue3]\ncreate clone of (_myself_ v)\nchange y by (-48)\nset [id v] to [Try Again]\ncreate clone of (_myself_ v)\nchange y by (-70)\nset [id v] to [Level Select]\ncreate clone of (_myself_ v)\nset x to (90)\nset [id v] to [Replay]\ncreate clone of (_myself_ v)\ngo to x: (0) y: (159)\nset [id v] to []\nset size to (130) %\nhide\n\nwhen I receive [level - complete v]\nclone level complete menu\n\ndefine save replay menu\nset [master ask v] to [SAVE REPLAY]\nval = replace [ ] with [Ǉ] from (BLACK BOX)\ndelete all of [level code v]\nadd (join ((length of (val)) + (12345678)) (val)) to [level code v]\ninsert [Select the entire REPLAY code by double clicking it] at (1) of [level code v] \ninsert [] at (2) of [level code v] \ninsert [] at (4) of [level code v] \ninsert [Then right click it and choose "Copy"] at (5) of [level code v] \ninsert [This is your replay code - save it somewhere safe!] at (6) of [level code v] \nhide list [level code v]\nforever\n    repeat until <not <mouse down?>>\n        wait (0) seconds\n    end\n    repeat until <<mouse down?> or <key (space v) pressed?>>\n        wait (0) seconds\n    end\n    set [val v] to []\n    if <([abs v] of (mouse x) ) > [184]> then\n        set [val v] to [1]\n    end\n    if <([abs v] of ((mouse y) - (44)) ) > [96]> then\n        set [val v] to [1]\n    end\n    if <key (space v) pressed?> then\n        set [val v] to [1]\n    end\n    if <(val) > [0]> then\n        show list [level code v]\n        repeat until <not <mouse down?>>\n            wait (0) seconds\n        end\n        set [master ask v] to []\n        stop [this script v]\n    end\nend\n\nbroadcast (game loop - scroll v)\n\ndefine load replay (txt)\ndelete all of [black box v]\nset [i v] to []\nset [i2 v] to [0]\nrepeat (length of (val))\n    change [i2 v] by (1)\n    set [c v] to (letter (i2) of (val))\n    if <(c) = [Ǉ]> then\n        add (i) to [black box v]\n        set [i v] to []\n    else\n        set [i v] to (join (i) (c))\n    end\nend\nadd (i) to [black box v]\nset [level # v] to (item (3) of [black box v])\nset [game state v] to [MENU OFF]\nset [replay idx v] to [999999]\n\nwhen this sprite clicked\nif <(id) = [pause back]> then\n    if <<(IN-GAME MENU) > [0]> and <not <(GAME STATE) = [WIN]>>> then\n        set [in-game menu v] to []\n    end\nend\n\ndefine order (this z)\nif <(this z) < (item (1) of [order v])> then\n    set [i1 v] to [2]\n    set [i2 v] to (length of [order v])\n    repeat until <(i1) > (i2)>\n        set [last z v] to ([floor v] of ((i1) + (((i2) - (i1)) / (5))) )\n        if <(this z) > (item (last z) of [order v])> then\n            set [i2 v] to ((last z) - (1))\n        else\n            set [i1 v] to ((last z) + (1))\n        end\n    end\n    insert (this z) at (i1) of [order v] \n    go [forward v] ((i1) - (1)) layers\nelse\n    insert (this z) at (1) of [order v] \nend\n\nwhen I receive [_order v]\norder [-4200]\n\nwhen I receive [report order v]\nadd (join [in-game menu: ] (id)) to [debug v]\n\n@Music\n\nwhen flag clicked\ngo to [back v] layer\nset volume to (30) %\nforever\n    play sound [8 Bit Street! Funky City Chiptune Game Music by HeatleyBros v] until done\nend\n\nwhen I receive [start v]\nrepeat until <(volume) > [29]>\n    change volume by (1)\nend\n\nwhen I receive [level - complete v]\nrepeat until <(volume) < [13]>\n    change volume by (-1)\nend\n\nwhen I receive [audio toggle v]\nstop [other scripts in sprite v]\nif <(SFX) > [1]> then\n    forever\n        play sound [8 Bit Street! Funky City Chiptune Game Music by HeatleyBros v] until done\n    end\nelse\n    stop all sounds\nend\n\n
This is much better - \nhttps://scratch.mit.edu/projects/497576842\n\nTo defeat Steve: Avoid his attacks then jump on his head when he is weak\n\nThis is a sequel to the other volcanic games I have made. Thanks for all the support as they have got much more famous than I could have dreamed. Unfortunately, this will be the final one in the series. Don't worry though, I have many other scrolling platformers you can access from my profile:\n#1 https://scratch.mit.edu/projects/397484781/\n#2 https://scratch.mit.edu/projects/468647664/\n#3  https://scratch.mit.edu/projects/470686157/\n\nHelp appel find his way out of the volcanic lands in this new remix  by @poliakoff. Read original project for more instructions. This took about 5 days to make as 2 or 3 were spent decoding. There is some other type of save code which you use for making levels. This was at first very confusing. Remember, even though the code may look confusing, if you look at it properly it will all make sense\n\n\n@Griffpatch for the original. Without him I don't know what scratch would be.This project would certainly have never existed without him.\nAppel Character - Thanks to @legobouwer9\nMusic - www.youtube.com/channel/UCsLlqLIE-TqDq3lh5kU2PeA\nSFX - https://freesound.org/\n\n(most credits copied from original)\n\n\n\n\n\n\n#games #all #art #appel #poliakoff #games #all #art #appel #poliakoff #games #all #art #appel #poliakoff #games #all #art #appel #poliakoff #games #all #art #appel #poliakoff #games #all #art #appel #poliakoff #games #all #art #appel #poliakoff #games #all #art #appel #poliakoff #games #all #art #appel #poliakoff #games #all #art #appel #poliakoff #games #all #art #appel #poliakoff #games #all #art #appel #poliakoff #games #all #art #appel #poliakoff #games #all #art #appel #poliakoff #games #all #art #appel #poliakoff #games #all #art #appel #poliakoff #games #all #art #appel #poliakoff #games #all #art #appel #poliakoff #games #all #art #appel #poliakoff #games #all #art #appel #poliakoff #games #all #art #appel #poliakoff 