Swing [Game + Level Editor] V1.3
@Stage\n\nwhen flag clicked\nset [gameended v] to [false]\nset [playing v] to [false]\nswitch backdrop to (backdrop1 v)\ndelete (all) of [landpositiony v]\ndelete (all) of [landpositionx v]\ndelete (all) of [obstaclepositionx v]\ndelete (all) of [obstaclepositiony v]\ndelete (all) of [slimepositionx v]\ndelete (all) of [slimepositiony v]\nset [gridscale v] to [35]\nset [stage v] to [0]\nforever\n    wait (1) seconds\n    change [timer v] by (1)\nend\n\nwhen I receive [nextstage v]\nswitch backdrop to (backdrop3 v)\nchange [stage v] by (1)\ndelete (all) of [landpositiony v]\ndelete (all) of [landpositionx v]\ndelete (all) of [obstaclepositionx v]\ndelete (all) of [obstaclepositiony v]\nset [spawnx v] to [null]\nset [spawny v] to [null]\nif <(Stage) = [1]> then\n    add [20] to [landpositionx v]\n    add [-100] to [landpositiony v]\n    set [portalx v] to [-100]\n    set [portaly v] to [-80]\n    set [grappleability v] to [false]\nend\nif <(Stage) = [2]> then\n    add [160] to [landpositionx v]\n    add [-120] to [landpositiony v]\n    set [portalx v] to [-160]\n    set [portaly v] to [-120]\n    set [grappleability v] to [true]\nend\nif <(Stage) = [3]> then\n    add [125] to [landpositionx v]\n    add [-120] to [landpositiony v]\n    add [0] to [obstaclepositionx v]\n    add [-100] to [obstaclepositiony v]\n    set [portalx v] to [-125]\n    set [portaly v] to [-120]\n    set [grappleability v] to [true]\nend\nif <(Stage) = [4]> then\n    add [125] to [landpositionx v]\n    add [0] to [landpositiony v]\n    add [0] to [obstaclepositionx v]\n    add [0] to [obstaclepositiony v]\n    set [portalx v] to [-125]\n    set [portaly v] to [-120]\n    set [grappleability v] to [true]\nend\nif <(Stage) = [5]> then\n    add [-150] to [landpositionx v]\n    add [80] to [landpositiony v]\n    add [-50] to [obstaclepositionx v]\n    add [80] to [obstaclepositiony v]\n    add [-50] to [obstaclepositionx v]\n    add [50] to [obstaclepositiony v]\n    add [-50] to [obstaclepositionx v]\n    add [20] to [obstaclepositiony v]\n    add [-50] to [obstaclepositionx v]\n    add [-10] to [obstaclepositiony v]\n    add [-50] to [obstaclepositionx v]\n    add [-40] to [obstaclepositiony v]\n    add [-50] to [obstaclepositionx v]\n    add [-70] to [obstaclepositiony v]\n    add [-50] to [obstaclepositionx v]\n    add [-100] to [obstaclepositiony v]\n    add [-50] to [obstaclepositionx v]\n    add [-130] to [obstaclepositiony v]\n    set [portalx v] to [100]\n    set [portaly v] to [-120]\n    set [grappleability v] to [true]\nend\nif <(Stage) = [6]> then\n    add [0] to [landpositionx v]\n    add [75] to [landpositiony v]\n    add [0] to [landpositionx v]\n    add [0] to [landpositiony v]\n    add [-30] to [landpositionx v]\n    add [0] to [landpositiony v]\n    add [30] to [landpositionx v]\n    add [0] to [landpositiony v]\n    add [-60] to [landpositionx v]\n    add [0] to [landpositiony v]\n    add [60] to [landpositionx v]\n    add [0] to [landpositiony v]\n    add [-90] to [landpositionx v]\n    add [0] to [landpositiony v]\n    add [90] to [landpositionx v]\n    add [0] to [landpositiony v]\n    add [-120] to [landpositionx v]\n    add [0] to [landpositiony v]\n    add [120] to [landpositionx v]\n    add [0] to [landpositiony v]\n    set [portalx v] to [0]\n    set [portaly v] to [-75]\n    set [grappleability v] to [true]\nend\nif <(Stage) = [7]> then\n    generateLevel [0, 105, 0, 35, 0, -35, | 0, 70, 0, 0, | | 0, 140, | 0, -70, | > >]\nend\nif <(Stage) = [8]> then\n    generateLevel [-105, 70, | | 0, -35, | -105, 105, | 105, 70, | > >]\nend\nif <(Stage) = [9]> then\n    generateLevel [-105, 35, | 0, 70, 0, 105, | -35, -70, 0, -70, 0, -35, 105, 35, | -105, 70, | 140, 35, | > >]\nend\nif <(Stage) = [10]> then\n    generateLevel [0, 70, | -35, 105, -35, 140, | -70, -35, | 0, 105, | -175, 35, | < >]\nend\nif <(Stage) = [11]> then\n    generateLevel [-105, 70, | 0, 105, 0, 70, | 105, -35, | -105, 105, | 210, 35, | < >]\nend\nif <(Stage) = [12]> then\n    generateLevel [-70, 70, 35, -70, | -35, 35, 0, 0, 35, -35, | | -70, 105, | 35, -105, | > >]\nend\nif <(Stage) = [13]> then\n    generateLevel [-105, 35, | 0, 70, 0, 105, 70, 0, | 0, -35, 140, -140, | -105, 70, | 210, 35, | > >]\nend\nif <(Stage) = [14]> then\n    generateLevel [-105, 35, 70, -35, 105, -70, | 0, 70, 70, 0, 105, 0, | 0, -35, 140, -140, | -105, 70, | 105, -35, | < >]\nend\nif <(Stage) = [15]> then\n    generateLevel [-70, 70, 35, 0, | 35, 35, 70, 0, | | -70, 105, | 70, -35, | > >]\nend\nif <(Stage) = [16]> then\n    generateLevel [-105, 0, 70, 70, 70, 105, | 35, -35, 0, -35, -35, -35, -70, -35, -140, 35, -140, 70, 70, 35, 70, 0, -140, 105, -140, 140, -105, 175, | | -105, 35, | -140, -35, | < >]\nend\nif <(Stage) = [17]> then\n    generateLevel [-105, 70, | -140, 105, -105, 140, -35, 105, -35, 70, -35, 35, -70, 0, -105, 0, -175, 35, -175, 70, -175, 0, -70, 140, | -140, -140, | -105, 105, | 35, -70, | < >]\nend\nif <(Stage) = [18]> then\n    generateLevel [| | | 0, -140, | 0, 105, | > <]\nend\nif <(Stage) = [19]> then\n    generateLevel [-70, -70, | | 0, 105, | -70, -35, | 105, 70, | > <]\nend\nif <(Stage) = [20]> then\n    generateLevel [-70, -35, | -35, 140, 35, 140, 70, 70, 140, 70, | 0, 140, 105, 70, | -70, 0, | 140, 105, | > <]\nend\nif <(Stage) = [21]> then\n    generateLevel [| | | -70, -105, | 105, 0, | < <]\nend\nif <(Stage) = [22]> then\n    generateLevel [-105, -70, | 35, -35, | -35, 70, | -105, -35, | 105, -35, | < <]\nend\nif <(Stage) = [23]> then\n    switch backdrop to (backdrop4 v)\n    set [gameended v] to [true]\n    set [grappled v] to [false]\n    broadcast (endGame v)\n    erase all\nend\nif <<(spawnX) = [null]> and <(spawnY) = [null]>> then\n    set [spawnx v] to (item (1) of [landpositionx v])\n    set [spawny v] to ((item (1) of [landpositiony v]) + ((gridScale) * (1)))\nend\nif <(gameEnded) = [false]> then\n    broadcast (initiateLevel v)\n    wait (0.1) seconds\n    set [grappled v] to [false]\nend\n\nwhen I receive [stoptest v]\nset [playing v] to [false]\n\nwhen I receive [initiatelevel v]\nset [playing v] to [true]\n\nwhen I receive [askforsave v]\nask [Input save code] and wait\ngenerateLevel (answer)\n\nadd (save) to [debug v]\n\nif <(playType) = [regular]> then\n    if <(loadType) = [land]> then\n        add (item (1) of [debug v]) to [landpositionx v]\n        add (item (2) of [debug v]) to [landpositiony v]\n    end\n    if <(loadType) = [obstacle]> then\n        add (item (1) of [debug v]) to [obstaclepositionx v]\n        add (item (2) of [debug v]) to [obstaclepositiony v]\n    end\n    if <(loadType) = [portal]> then\n        set [portalx v] to (item (1) of [debug v])\n        set [portaly v] to (item (2) of [debug v])\n    end\n    if <(loadType) = [spawner]> then\n        set [spawnx v] to (item (1) of [debug v])\n        set [spawny v] to (item (2) of [debug v])\n    end\nelse\nend\n\ndefine generateLevel []\nif <not <(save) = []>> then\n    broadcast (loading v)\n    broadcast (clearStage v)\n    set [loadtype v] to [land]\n    set [o v] to [1]\n    repeat until <<(letter (o) of (save)) = [<]> or <(letter (o) of (save)) = [>]>>\n        if <not <(letter (o) of (save)) = [ ]>> then\n            if <not <(letter (o) of (save)) = [,]>> then\n                if <(letter (o) of (save)) = [|]> then\n                    if <(loadType) = [spawner]> then\n                        set [loadtype v] to [portal]\n                    end\n                    if <(loadType) = [slime]> then\n                        set [loadtype v] to [spawner]\n                    end\n                    if <(loadType) = [obstacle]> then\n                        set [loadtype v] to [slime]\n                    end\n                    if <(loadType) = [land]> then\n                        set [loadtype v] to [obstacle]\n                    end\n                else\n                    add (letter (o) of (save)) to [numberfactory v]\n                end\n            else\n                add (numberFactory) to [debug v]\n                delete (all) of [numberfactory v]\n                if <(length of [debug v]) = [2]> then\n                    set [buildtype v] to (loadType)\n                    broadcast (createBlock v)\n                end\n            end\n        end\n        change [o v] by (1)\n    end\n    if <(letter (o) of (save)) = [<]> then\n        set [grappleability v] to [true]\n    else\n        set [grappleability v] to [false]\n    end\n    change [o v] by (2)\n    if <(letter (o) of (save)) = [<]> then\n        set [reversegravity v] to [true]\n    else\n        set [reversegravity v] to [false]\n    end\nend\n\nwhen I receive [leveleditor v]\nswitch backdrop to (backdrop2 v)\n\nif <(Stage) = [9]> then\n    generateLevel [-105, -35, 0, 0, 105, 35, 0, 70, | 35, 0, 140, 35, -35, 70, | -105, 0, | -105, 105, | >]\nend\n\nwhen I receive [startgame v]\nset [playing v] to [true]\n\nstop [all v]\n\n@Sprite1\n\nwhen flag clicked\nset [grappleability v] to [false]\nset rotation style [all around v]\npoint in direction (90)\nset size to (100) %\nstartVariables\nshow\nwait (0.1) seconds\npen up\nstartAnimation\n\ndefine doGrapple\nset [grappled v] to [true]\nset [grapplex v] to (mouse x)\nset [grappley v] to (mouse y)\nset [grapplelength v] to (distance to [mouse-pointer v])\nif <(y position) < (grappleY)> then\n    set [xvelocity v] to ((xVelocity) * (-1))\nend\nbroadcast (grapple v)\n\nwhen I start as a clone\nrepeat (5)\n\ndefine move\nif <(reverseGravity) = [true]> then\n    set [yvelocity v] to ((yVelocity) * (-1))\nend\nif <(grappled) = [true]> then\n    set rotation style [all around v]\n    point towards (grapplemarker v)\n    turn left (90) degrees\n    move ((xVelocity) * (1)) steps\nelse\n    change x by (xVelocity)\n    change y by (yVelocity)\n    if <<touching color (#00cc44)?> or <touching color (#995900)?>> then\n        change y by ([abs v] of (yVelocity) )\n        set [yvelocity v] to [0]\n        set [touchedgreen v] to [true]\n    end\n    if <touching color (#995900)?> then\n        change y by (-1)\n        change y by ((yVelocity) * (-1))\n        change x by ((xVelocity) * (-1))\n        set [xvelocity v] to [0]\n        set [yvelocity v] to [0]\n    end\n    set rotation style [left-right v]\n    if <(xVelocity) > [0]> then\n        point in direction (90)\n    else\n        point in direction (-90)\n    end\nend\nif <(reverseGravity) = [true]> then\n    set [yvelocity v] to ((yVelocity) * (-1))\nend\nif <<touching (_edge_ v)?> or <touching color (#cc0000)?>> then\n    broadcast (initiatelevel v)\nend\n\nwhen I receive [stoptest v]\nhide\nset [xvelocity v] to [0]\nset [yvelocity v] to [0]\nset [grappled v] to [false]\n\nwhen I receive [loading v]\nhide\nset [xvelocity v] to [0]\nset [yvelocity v] to [0]\nset [playing v] to [false]\nset [grappled v] to [false]\n\ndefine stageEndCheck\nif <<touching color (#d135ff)?> or <touching color (#7320ff)?>> then\n    if <(playType) = [regular]> then\n        broadcast (loading v)\n        hide\n        broadcast (nextstage v)\n        erase all\n    else\n        if <(playType) = [levelEditor]> then\n            broadcast (stoptest v)\n        else\n            switch backdrop to (backdrop1 v)\n            set [playing v] to [false]\n            broadcast (communitylevels v)\n            startAnimation\n        end\n    end\nend\n\ndefine grappleCheck\nif <mouse down?> then\n    if <(grappled) = [false]> then\n        doGrapple\n        set [grappletimer v] to (timer)\n    end\nelse\n    if <(grappled) = [true]> then\n        set [grappled v] to [false]\n        set [xvelocity v] to ((xVelocity) * (-1))\n        set [yvelocity v] to [1]\n    end\nend\n\ndefine updateVelocity\nif <(grappled) = [false]> then\n    if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n        if <(touchedGreen) = [true]> then\n            if <not <touching color (#814901)?>> then\n                change y by (0)\n                change [yvelocity v] by (8)\n                set [touchedgreen v] to [false]\n            end\n        end\n    end\n    if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n        if <([abs v] of (xVelocity) ) < (maxXVelocity)> then\n            change [xvelocity v] by (1)\n        end\n    end\n    if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n        if <([abs v] of (xVelocity) ) < (maxXVelocity)> then\n            change [xvelocity v] by (-1)\n        end\n    end\n    if <not <key (any v) pressed?>> then\n        if <(xVelocity) > [0]> then\n            change [xvelocity v] by (-0.25)\n        end\n        if <(xVelocity) < [0]> then\n            change [xvelocity v] by (0.25)\n        end\n    end\n    if <touching color (#99ffbb)?> then\n        if <(reverseGravity) = [true]> then\n            change y by (yVelocity)\n            set [yvelocity v] to ((yVelocity) * (-1))\n        else\n            set [yvelocity v] to ([abs v] of (yVelocity) )\n        end\n    end\n    if <touching color (#b8ffc5)?> then\n        if <(xVelocity) > [0]> then\n            set [xvelocity v] to (([abs v] of (xVelocity) ) * (-1))\n        else\n            set [xvelocity v] to ([abs v] of (xVelocity) )\n        end\n    end\n    if <touching color (#814901)?> then\n        change y by (([abs v] of (yVelocity) ) * (-1))\n        set [yvelocity v] to [-.25]\n    end\n    if <touching color (#92f3b0)?> then\n        if <(reverseGravity) = [false]> then\n            change y by (-1)\n            set [yvelocity v] to (([abs v] of (yVelocity) ) * (-1))\n        else\n            change y by (1)\n            set [yvelocity v] to ([abs v] of (yVelocity) )\n        end\n    end\n    if <not <touching color (#99ffbb)?>> then\n        change [yvelocity v] by (-0.5)\n    end\nelse\n    if <(reverseGravity) = [false]> then\n        if <(x position) > (([x position v] of [grapplemarker v]) - (0))> then\n            change [xvelocity v] by (([abs v] of ((y position) - ([y position v] of [grapplemarker v])) ) / (350))\n        else\n            change [xvelocity v] by ((([abs v] of ((y position) - ([y position v] of [grapplemarker v])) ) / (350)) * (-1))\n        end\n    else\n        if <(x position) > (([x position v] of [grapplemarker v]) - (0))> then\n            change [xvelocity v] by ((([abs v] of ((y position) - ([y position v] of [grapplemarker v])) ) / (350)) * (-1))\n        else\n            change [xvelocity v] by (([abs v] of ((y position) - ([y position v] of [grapplemarker v])) ) / (350))\n        end\n    end\n    if  then\n        set [xvelocity v] to [0]\n        set [yvelocity v] to [0]\n        set [grappled v] to [false]\n    end\n    if <touching color (#b8ffc5)?> then\n        move ((xVelocity) * (-1)) steps\n        set [xvelocity v] to ((xVelocity) * (-1))\n    end\nend\n\nwhen I receive [initiatelevel v]\nset [xvelocity v] to [0]\nset [yvelocity v] to [0]\nset [grappled v] to [false]\nset [playing v] to [true]\ngo to x: (spawnX) y: (spawnY)\nwait (0.1) seconds\nshow\nrepeat until <(playing) = [false]>\n    updateVelocity\n    if <(grappleAbility) = [true]> then\n        grappleCheck\n    end\n    stageEndCheck\n    move\nend\n\ndelete this clone\n\ndefine startVariables\nset [reversegravity v] to [false]\nset [xvelocity v] to [0]\nset [yvelocity v] to [0]\nset [maxxvelocity v] to [3]\nset [grapplecooldown v] to [0]\nset [grappletimer v] to [2]\nset [grapplelength v] to [0]\nset [grappled v] to [false]\ndelete (all) of [debug v]\n\nwhen I receive [endgame v]\nhide\ndelete this clone\n\ndefine startAnimation\nset rotation style [all around v]\ngo to x: (40) y: (-40)\nset [grapplex v] to [0]\nset [grappley v] to [0]\nset [grappled v] to [0]\nbroadcast (grapple v)\nset [animxv v] to [0]\nrepeat until <(playing) = [true]>\n    point towards (grapplemarker v)\n    turn left (90) degrees\n    move ((animXV) * (1)) steps\n    if <(x position) > (([x position v] of [grapplemarker v]) - (0))> then\n        change [animxv v] by (([abs v] of ((y position) - ([y position v] of [grapplemarker v])) ) / (500))\n    else\n        change [animxv v] by ((([abs v] of ((y position) - ([y position v] of [grapplemarker v])) ) / (500)) * (-1))\n    end\nend\n\nwhen I receive [leveleditor v]\nhide\nstartVariables\n\nchange x by ((xVelocity) * (-1))\nset [xvelocity v] to [0]\n\nif <touching color (#b8ffc5)?> then\n    change x by ((xVelocity) * (-1))\nend\n\n@Sprite2\n\nwhen flag clicked\nset size to (500) %\nshow\nhide\n\nwhen I receive [initiatelevel v]\nif <(Stage) < [6]> then\n    if <(playType) = [regular]> then\n        wait (0.01) seconds\n        set [i v] to [1]\n        repeat (length of [landpositionx v])\n            go to x: (item (i) of [landpositionx v]) y: (item (i) of [landpositiony v])\n            create clone of (_myself_ v)\n            change [i v] by (1)\n        end\n    end\nend\n\nwhen I start as a clone\nshow\n\nwhen I receive [initiatelevel v]\ndelete this clone\n\nwhen I receive [stoptest v]\ndelete this clone\n\n@grapple\n\nwhen flag clicked\nset pen size to (2)\nhide\npen up\nerase all\nset pen color to (#666666)\n\nforever\nend\n\nwhen I receive [grapple v]\ngo to (sprite1 v)\npen down\nrepeat until <(grappled) = [false]>\n    erase all\n    go to (sprite1 v)\n    pen down\n    go to (grapplemarker v)\n    pen up\nend\nerase all\n\ngo to x: (10) y: (([y position v] of [sprite1 v]) + (-5))\n\nwhen I receive [leveleditor v]\nhide\n\n@grappleMarker\n\nwhen flag clicked\nset size to (200) %\nhide\nshow\n\nwhen I receive [grapple v]\nshow\ngo to x: (grappleX) y: (grappleY)\nwait until <(grappled) = [false]>\nhide\n\nwhen I receive [endgame v]\nhide\ndelete this clone\n\n@Portal\n\nwhen flag clicked\nhide\nset size to (500) %\n\nwhen I receive [startgame v]\nbroadcast (nextStage v)\n\nwhen I receive [stoptest v]\nhide\n\nwhen I receive [initiatelevel v]\nif <(playType) = [regular]> then\n    wait (0.1) seconds\n    show\n    go to x: (portalX) y: (portalY)\nend\n\nforever\n    if <touching (sprite1 v)?> then\n        if <(playType) = [regular]> then\n            broadcast (nextStage v)\n            hide\n        else\n            broadcast (stopTest v)\n        end\n    end\nend\n\nwhen I receive [endgame v]\nhide\ndelete this clone\n\n@Sprite4\n\nwhen flag clicked\nset size to (500) %\nhide\n\nwhen I start as a clone\nshow\n\nwhen I receive [initiatelevel v]\ndelete this clone\n\nshow\n\nwhen I receive [initiatelevel v]\nif <(Stage) < [6]> then\n    if <(playType) = [regular]> then\n        wait (0.01) seconds\n        set [i v] to [1]\n        repeat (length of [obstaclepositionx v])\n            go to x: (item (i) of [obstaclepositionx v]) y: (item (i) of [obstaclepositiony v])\n            create clone of (_myself_ v)\n            change [i v] by (1)\n        end\n    end\nend\n\n@Sprite3\n\nwhen flag clicked\ngo to [front v] layer\nwait (0.1) seconds\ngo to x: (0) y: (10)\nset size to (200) %\nshow\nrepeat until <(playing) = [true]>\n    if <touching (mouse-pointer v)?> then\n        set size to (300) %\n    else\n        set size to (200) %\n    end\nend\n\nwhen I receive [leveleditor v]\nhide\n\nwhen this sprite clicked\nhide\nset [playtype v] to [regular]\nbroadcast (startGame v)\n\nwhen I receive [communitylevels v]\nhide\n\n@Sprite6\n\nwhen I receive [leveleditor v]\nif <(clone) = [true]> then\n    show\nend\n\nwhen I start as a clone\nset [clone v] to [true]\n\nwhen this sprite clicked\nif <(role) = [spawner]> then\n    if <(placeAnotherSpawner) = [true]> then\n        set [placeanotherspawner v] to [false]\n        set [buildtype v] to (role)\n        broadcast (startBuild v)\n        set [placestyle v] to [regular]\n        create clone of (buildtemplate v)\n    end\nelse\n    if <(role) = [portal]> then\n        if <(placeAnotherPortal) = [true]> then\n            set [placeanotherportal v] to [false]\n            set [buildtype v] to (role)\n            broadcast (startBuild v)\n            set [placestyle v] to [regular]\n            create clone of (buildtemplate v)\n        end\n    else\n        set [buildtype v] to (role)\n        broadcast (startBuild v)\n        set [placestyle v] to [regular]\n        create clone of (buildtemplate v)\n    end\nend\n\nwhen I receive [startbuild v]\nhide\n\nwhen I receive [donebuilding v]\nif <(clone) = [true]> then\n    show\nend\n\nwhen flag clicked\nhide\ngo to x: (200) y: (130)\nset size to (500) %\nset [spacing v] to [-40]\nset [clone v] to [false]\nset [role v] to [land]\ncreate clone of (_myself_ v)\nchange y by (spacing)\nset [role v] to [obstacle]\ncreate clone of (_myself_ v)\nchange y by (spacing)\nset [role v] to [portal]\ncreate clone of (_myself_ v)\nchange y by (spacing)\nset [role v] to [spawner]\ncreate clone of (_myself_ v)\nchange y by (spacing)\nset [role v] to [slime]\ncreate clone of (_myself_ v)\nchange y by (spacing)\nset [role v] to [eraser]\ncreate clone of (_myself_ v)\nset [role v] to [null]\n\nwhen I start as a clone\nset [placeanotherportal v] to [true]\nset [placeanotherspawner v] to [true]\nset [clone v] to [true]\nswitch costume to (role)\nif <(role) = [spawner]> then\n    set [help v] to [Player Spawn]\nend\nif <(role) = [portal]> then\n    set [help v] to [Portal]\nend\nif <(role) = [land]> then\n    set [help v] to [Dirt Block]\nend\nif <(role) = [obstacle]> then\n    set [help v] to [Obstacle]\nend\nif <(role) = [eraser]> then\n    set [help v] to [Erase]\nend\nif <(role) = [slime]> then\n    set [help v] to [Slime Block]\nend\nrepeat until <not <(Stage) = [0]>>\n    if <(distance to [mouse-pointer v]) < [30]> then\n        say (help) for (0.1) seconds\n    end\nend\n\nwhen I receive [initiatelevel v]\nif <(clone) = [true]> then\n    hide\nend\n\nwhen I receive [stoptest v]\nif <(clone) = [true]> then\n    show\nend\n\n@buildTemplate\n\nwhen flag clicked\nhide\nset size to (500) %\nset [clone v] to [false]\n\nwhen I receive [initiatelevel v]\nhide\n\nwhen I start as a clone\nif <(placeStyle) = [regular]> then\n    set [clone v] to [true]\n    set [role v] to (buildType)\n    wait (0.1) seconds\n    switch costume to (role)\n    show\n    repeat (10)\n        set x to ((round ((mouse x) / (gridScale))) * (gridScale))\n        set y to ((round ((mouse y) / (gridScale))) * (gridScale))\n    end\n    repeat until <mouse down?>\n        set x to ((round ((mouse x) / (gridScale))) * (gridScale))\n        set y to ((round ((mouse y) / (gridScale))) * (gridScale))\n    end\n    buildChecks\n    broadcast (doneBuilding v)\nelse\n    hide\n    set [clone v] to [true]\n    set [role v] to (buildType)\n    switch costume to (role)\n    align\n    buildChecks\n    hide\nend\n\ndefine buildChecks\nif <(role) = [spawner]> then\n    set [spawnx v] to (x position)\n    set [spawny v] to (y position)\nend\nif <(role) = [portal]> then\n    set [portalx v] to (x position)\n    set [portaly v] to (y position)\nend\nif <(role) = [land]> then\n    add (x position) to [landpositionx v]\n    add (y position) to [landpositiony v]\nend\nif <(role) = [obstacle]> then\n    add (x position) to [obstaclepositionx v]\n    add (y position) to [obstaclepositiony v]\nend\nif <(role) = [slime]> then\n    add (x position) to [slimepositionx v]\n    add (y position) to [slimepositiony v]\nend\nif <(role) = [eraser]> then\n    switch costume to (replace v)\n    stamp\n    switch costume to (item v)\n    broadcast (removeTile v)\n    broadcast (doneBuilding v)\n    delete this clone\nend\n\nwhen I receive [removetile v]\nalign\nset [i v] to [0]\nif <<(x position) = ((round ((mouse x) / (gridScale))) * (gridScale))> and <(y position) = ((round ((mouse y) / (gridScale))) * (gridScale))>> then\n    if <(role) = [spawner]> then\n        set [spawnx v] to [null]\n        set [spawny v] to [null]\n        set [placeanotherspawner v] to [true]\n        delete this clone\n    end\n    if <(role) = [portal]> then\n        set [portalx v] to [null]\n        set [portaly v] to [null]\n        set [placeanotherportal v] to [true]\n        delete this clone\n    end\n    if <(role) = [land]> then\n        repeat until <<(item (i) of [landpositionx v]) = (x position)> and <(item (i) of [landpositiony v]) = (y position)>>\n            change [i v] by (1)\n        end\n        delete (i) of [landpositionx v]\n        delete (i) of [landpositiony v]\n        delete this clone\n    end\n    if <(role) = [obstacle]> then\n        repeat until <<(item (i) of [obstaclepositionx v]) = (x position)> and <(item (i) of [obstaclepositiony v]) = (y position)>>\n            change [i v] by (1)\n        end\n        delete (i) of [obstaclepositionx v]\n        delete (i) of [obstaclepositiony v]\n    end\n    delete this clone\nelse\nend\n\nwhen I receive [createblock v]\nif <(clone) = [false]> then\n    go to x: (item (1) of [debug v]) y: (item (2) of [debug v])\n    delete (all) of [debug v]\n    set [placestyle v] to [preSelected]\n    create clone of (_myself_ v)\nend\n\nwhen I receive [clearstage v]\ndelete this clone\n\nwhen I receive [initiatelevel v]\nif <<(clone) = [true]> and <not <(role) = [spawner]>>> then\n    show\nend\n\nwhen I receive [renderlevel v]\nif <(clone) = [true]> then\n    show\nend\n\nwhen I receive [nextstage v]\ndelete this clone\n\ndefine align\nset x to ((round ((x position) / (gridScale))) * (gridScale))\nset y to ((round ((y position) / (gridScale))) * (gridScale))\n\nwhen I receive [endgame v]\nhide\ndelete this clone\n\nwhen I receive [stoptest v]\nif <(clone) = [true]> then\n    align\n    show\nend\n\nwhen I receive [communitylevels v]\ndelete this clone\n\n@level editor test\n\nwhen flag clicked\nhide\nset [playtype v] to [regular]\ngo to x: (-214) y: (-130)\nset size to (300) %\nswitch costume to (play v)\n\nif  then\nend\n\nwhen this sprite clicked\nif <(costume [number v]) = [1]> then\n    playChecks\nelse\n    broadcast (stopTest v)\n    next costume\nend\n\nwhen I receive [stoptest v]\nswitch costume to (play v)\n\nwhen I receive [startgame v]\nhide\n\ndefine playChecks\nif <not <(spawnX) = [null]>> then\n    if <not <(portalX) = [null]>> then\n        set [stage v] to [null]\n        broadcast (initiateLevel v)\n        next costume\n    end\nend\n\nwhen I receive [leveleditor v]\nshow\n\n@Sprite8\n\nwhen I receive [leveleditor v]\nshow\n\nwhen I receive [startgame v]\nhide\n\nwhen I receive [initiatelevel v]\nhide\n\nwhen I receive [stoptest v]\nshow\n\nwhen flag clicked\ndelete (all) of [savecodefinal v]\nshow list [savecodefinal v]\nset [savecode v] to [null]\nset size to (400) %\ngo to x: (-120) y: (-130)\nhide\n\nwhen this sprite clicked\ndelete (all) of [savecodefinal v]\nif <not <(spawnX) = [null]>> then\n    if <not <(portalX) = [null]>> then\n        delete (all) of [savecode v]\n        set [i v] to [1]\n        repeat (length of [landpositionx v])\n            add (join (item (i) of [landpositionx v]) [,]) to [savecode v]\n            add (join (item (i) of [landpositiony v]) [,]) to [savecode v]\n            change [i v] by (1)\n        end\n        add [|] to [savecode v]\n        set [i v] to [1]\n        repeat (length of [obstaclepositionx v])\n            add (join (item (i) of [obstaclepositionx v]) [,]) to [savecode v]\n            add (join (item (i) of [obstaclepositiony v]) [,]) to [savecode v]\n            change [i v] by (1)\n        end\n        add [|] to [savecode v]\n        set [i v] to [1]\n        repeat (length of [slimepositionx v])\n            add (join (item (i) of [slimepositionx v]) [,]) to [savecode v]\n            add (join (item (i) of [slimepositiony v]) [,]) to [savecode v]\n            change [i v] by (1)\n        end\n        add [|] to [savecode v]\n        add (join (spawnX) [,]) to [savecode v]\n        add (join (spawnY) [,]) to [savecode v]\n        add [|] to [savecode v]\n        add (join (portalX) [,]) to [savecode v]\n        add (join (portalY) [,]) to [savecode v]\n        add [|] to [savecode v]\n        if <(grappleAbility) = [true]> then\n            add [<] to [savecode v]\n        else\n            add [>] to [savecode v]\n        end\n        if <(reverseGravity) = [true]> then\n            add [<] to [savecode v]\n        else\n            add [>] to [savecode v]\n        end\n        add (saveCode) to [savecodefinal v]\n        hide list [savecodefinal v]\n        wait until <key (space v) pressed?>\n        show list [savecodefinal v]\n    end\nend\n\n@Sprite9\n\nwhen I receive [leveleditor v]\nshow\n\nwhen I receive [startgame v]\nhide\n\nwhen I receive [initiatelevel v]\nhide\n\nwhen I receive [stoptest v]\nshow\n\nwhen flag clicked\ndelete (all) of [debug v]\ndelete (all) of [numberfactory v]\nset size to (400) %\ngo to x: (-60) y: (-130)\nhide\n\nbroadcast (askForSave v)\n\nif <(letter (o) of (save)) = [<]> then\n    set [grappleability v] to [true]\nelse\n    set [grappleability v] to [false]\nend\n\nwhen this sprite clicked\nask [Input save code] and wait\nif <not <(answer) = []>> then\n    broadcast (clearStage v)\n    set [loadtype v] to [land]\n    set [x v] to [1]\n    repeat until <<(letter (x) of (answer)) = [<]> or <(letter (x) of (answer)) = [>]>>\n        if <not <(letter (x) of (answer)) = [ ]>> then\n            if <not <(letter (x) of (answer)) = [,]>> then\n                if <(letter (x) of (answer)) = [|]> then\n                    if <(loadType) = [spawner]> then\n                        set [loadtype v] to [portal]\n                    end\n                    if <(loadType) = [slime]> then\n                        set [loadtype v] to [spawner]\n                    end\n                    if <(loadType) = [obstacle]> then\n                        set [loadtype v] to [slime]\n                    end\n                    if <(loadType) = [land]> then\n                        set [loadtype v] to [obstacle]\n                    end\n                else\n                    add (letter (x) of (answer)) to [numberfactory v]\n                end\n            else\n                add (numberFactory) to [debug v]\n                delete (all) of [numberfactory v]\n                if <(length of [debug v]) = [2]> then\n                    set [buildtype v] to (loadType)\n                    broadcast (createBlock v)\n                end\n            end\n        end\n        change [x v] by (1)\n    end\n    if <(letter (x) of (answer)) = [<]> then\n        set [grappleability v] to [true]\n    else\n        set [grappleability v] to [false]\n    end\n    change [x v] by (2)\n    if <(letter (x) of (answer)) = [<]> then\n        set [reversegravity v] to [true]\n    else\n        set [reversegravity v] to [false]\n    end\n    broadcast (renderLevel v)\nend\n\n@Sprite10\n\nwhen I receive [initiatelevel v]\nswitch costume to (reverseGravity)\nshow\n\nwhen flag clicked\ngo to x: (-206) y: (100)\nset size to (400) %\nhide\n\nwhen I receive [leveleditor v]\nswitch costume to (reverseGravity)\nshow\n\nwhen this sprite clicked\nif <not <(playType) = [regular]>> then\n    next costume\n    if <(costume [number v]) = [1]> then\n        set [reversegravity v] to [true]\n    else\n        set [reversegravity v] to [false]\n    end\nend\n\nwhen I receive [createblock v]\nshow\nwait (0.5) seconds\nswitch costume to (reverseGravity)\n\nwhen I receive [renderlevel v]\nwait (1) seconds\nswitch costume to (reverseGravity)\n\nwhen I receive [endgame v]\nhide\ndelete this clone\n\nwhen I receive [communitylevels v]\nhide\ndelete this clone\n\n@Sprite11\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\n\nwhen I receive [loading v]\ngo to [front v] layer\nshow\n\nwhen I receive [initiatelevel v]\nhide\n\nwhen I receive [endgame v]\nhide\n\n@Sprite12\n\nwhen I receive [initiatelevel v]\nswitch costume to (grappleAbility)\nshow\n\nwhen flag clicked\ngo to x: (-206) y: (140)\nset size to (500) %\nhide\n\nwhen I receive [leveleditor v]\nswitch costume to (grappleAbility)\nshow\n\nwhen this sprite clicked\nif <not <(playType) = [regular]>> then\n    next costume\n    if <(costume [number v]) = [1]> then\n        set [grappleability v] to [true]\n    else\n        set [grappleability v] to [false]\n    end\nend\n\nif <(playType) = [levelEditor]> then\n    next costume\nend\n\nwhen I receive [createblock v]\nshow\nwait (0.5) seconds\nswitch costume to (grappleAbility)\n\nwhen I receive [endgame v]\nhide\ndelete this clone\n\nwhen I receive [communitylevels v]\nhide\ndelete this clone\n\n@Sprite13\n\nwhen flag clicked\nshow\nwait (0.1) seconds\ngo to x: (0) y: (113)\nset size to (100) %\nrepeat until <(playing) = [true]>\n    point in direction ((([direction v] of [sprite1 v]) * (-0.2)) + (70))\nend\nhide\n\nwhen I receive [leveleditor v]\nset [playing v] to [true]\nwait (1) seconds\nset [playing v] to [false]\n\nwhen I receive [communitylevels v]\nhide\n\n@Sprite14\n\nwhen flag clicked\nhide\n\nwhen I receive [endgame v]\nshow\nset [ghost v] effect to (100)\nforever\n    set x to ((mouse x) / (10))\n    set y to ((mouse y) / (10))\n    change [ghost v] effect by (-1)\nend\n\n@Sprite15\n\nwhen flag clicked\ngo [backward v] (5) layers\nhide\nset [ghost v] effect to (0)\n\nwhen I receive [endgame v]\nrepeat (3)\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nshow\ngo to x: (pick random (-240) to (240)) y: (pick random (-180) to (180))\nset [speed v] to (pick random (0.5) to (1))\nswitch costume to (pick random (1) to (3))\nset size to (pick random (50) to (110)) %\nforever\n    repeat until <(x position) > [239]>\n        change x by (speed)\n        erase all\n    end\n    go to x: (pick random (-210) to (-200)) y: (pick random (-160) to (160))\n    set [speed v] to (pick random (0.5) to (1))\n    switch costume to (pick random (1) to (3))\n    set size to (pick random (50) to (150)) %\nend\n\n@Sprite7\n\nwhen this sprite clicked\nhide\nbroadcast (communityLevels v)\nset [playtype v] to [levelEditor]\nset [spawnx v] to [null]\nset [portalx v] to [null]\n\nwhen flag clicked\ngo to [front v] layer\nset [playtype v] to [regular]\nwait (0.1) seconds\ngo to x: (-110) y: (10)\nset size to (200) %\nshow\nrepeat until <(playing) = [true]>\n    if <touching (mouse-pointer v)?> then\n        set size to (300) %\n    else\n        set size to (200) %\n    end\nend\n\nwhen I receive [leveleditor v]\nhide\n\nwhen I receive [startgame v]\nhide\n\n@Sprite5\n\nwhen this sprite clicked\nhide\nbroadcast (levelEditor v)\nset [playtype v] to [levelEditor]\nset [spawnx v] to [null]\nset [portalx v] to [null]\n\nwhen I receive [startgame v]\nhide\n\nwhen flag clicked\ngo to [front v] layer\nset [playtype v] to [regular]\nwait (0.1) seconds\ngo to x: (110) y: (10)\nset size to (200) %\nshow\nrepeat until <(playing) = [true]>\n    if <touching (mouse-pointer v)?> then\n        set size to (300) %\n    else\n        set size to (200) %\n    end\nend\n\nwhen I receive [communitylevels v]\nhide\n\n@Sprite16\n\nwhen flag clicked\ngo to x: (0) y: (-130)\nhide\n\nwhen I receive [communitylevels v]\nshow\n\nwhen I receive [initiatelevel v]\nhide\n\n@Sprite17\n\nwhen flag clicked\nset [buttonoffset v] to [30]\ngo to x: (buttonOffset) y: (150)\nhide\n\nwhen this sprite clicked\ngenerateLevel [-210, -70, -175, -70, -140, -70, -105, 35, -105, 70, -105, 105, -105, 140, | -105, -70, -105, -70, -70, -70, -35, -70, 0, -70, 35, -70, 70, 70, 105, 35, 140, 0, | 70, -70, | -210, -35, | 140, -105, | < >]\n\ndefine generateLevel (save)\nif <not <(save) = []>> then\n    broadcast (loading v)\n    broadcast (clearstage v)\n    set [loadtype v] to [land]\n    set [x v] to [1]\n    repeat until <<(letter (x) of (save)) = [<]> or <(letter (x) of (save)) = [>]>>\n        if <not <(letter (x) of (save)) = [ ]>> then\n            if <not <(letter (x) of (save)) = [,]>> then\n                if <(letter (x) of (save)) = [|]> then\n                    if <(loadType) = [spawner]> then\n                        set [loadtype v] to [portal]\n                    end\n                    if <(loadType) = [slime]> then\n                        set [loadtype v] to [spawner]\n                    end\n                    if <(loadType) = [obstacle]> then\n                        set [loadtype v] to [slime]\n                    end\n                    if <(loadType) = [land]> then\n                        set [loadtype v] to [obstacle]\n                    end\n                else\n                    add (letter (x) of (save)) to [numberfactory v]\n                end\n            else\n                add (numberFactory) to [debug v]\n                delete (all) of [numberfactory v]\n                if <(length of [debug v]) = [2]> then\n                    set [buildtype v] to (loadType)\n                    broadcast (createblock v)\n                end\n            end\n        end\n        change [x v] by (1)\n    end\n    if <(letter (x) of (save)) = [<]> then\n        set [grappleability v] to [true]\n    else\n        set [grappleability v] to [false]\n    end\n    change [x v] by (2)\n    if <(letter (x) of (save)) = [<]> then\n        set [reversegravity v] to [true]\n    else\n        set [reversegravity v] to [false]\n    end\n    switch backdrop to (backdrop3 v)\n    set [playtype v] to [communityLevel]\n    broadcast (initiatelevel v)\nend\n\nwhen I receive [communitylevels v]\nshow\nrepeat until <(playing) = [true]>\n    if <touching (mouse-pointer v)?> then\n        set size to (150) %\n    else\n        set size to (100) %\n    end\nend\n\nwhen I receive [initiatelevel v]\nhide\n\n@Sprite18\n\nwhen flag clicked\ngo to x: (buttonOffset) y: (120)\nhide\n\nwhen this sprite clicked\ngenerateLevel [140, 35, 105, 105, | -105, 35, 70, -70, | -35, -35, | -140, 70, | 175, 0, | < >]\n\ndefine generateLevel []\nif <not <(save) = []>> then\n    broadcast (loading v)\n    broadcast (clearStage v)\n    set [loadtype v] to [land]\n    set [x v] to [1]\n    repeat until <<(letter (x) of (save)) = [<]> or <(letter (x) of (save)) = [>]>>\n        if <not <(letter (x) of (save)) = [ ]>> then\n            if <not <(letter (x) of (save)) = [,]>> then\n                if <(letter (x) of (save)) = [|]> then\n                    if <(loadType) = [spawner]> then\n                        set [loadtype v] to [portal]\n                    end\n                    if <(loadType) = [slime]> then\n                        set [loadtype v] to [spawner]\n                    end\n                    if <(loadType) = [obstacle]> then\n                        set [loadtype v] to [slime]\n                    end\n                    if <(loadType) = [land]> then\n                        set [loadtype v] to [obstacle]\n                    end\n                else\n                    add (letter (x) of (save)) to [numberfactory v]\n                end\n            else\n                add (numberFactory) to [debug v]\n                delete (all) of [numberfactory v]\n                if <(length of [debug v]) = [2]> then\n                    set [buildtype v] to (loadType)\n                    broadcast (createBlock v)\n                end\n            end\n        end\n        change [x v] by (1)\n    end\n    if <(letter (x) of (save)) = [<]> then\n        set [grappleability v] to [true]\n    else\n        set [grappleability v] to [false]\n    end\n    change [x v] by (2)\n    if <(letter (x) of (save)) = [<]> then\n        set [reversegravity v] to [true]\n    else\n        set [reversegravity v] to [false]\n    end\n    switch backdrop to (backdrop3 v)\n    set [playtype v] to [communityLevel]\n    broadcast (initiateLevel v)\nend\n\nwhen I receive [communitylevels v]\nshow\nrepeat until <(playing) = [true]>\n    if <touching (mouse-pointer v)?> then\n        set size to (150) %\n    else\n        set size to (100) %\n    end\nend\n\nwhen I receive [initiatelevel v]\nhide\n\n@Sprite19\n\nwhen flag clicked\ngo to x: (buttonOffset) y: (90)\nhide\n\nwhen this sprite clicked\ngenerateLevel [175, -105, 140, -105, 35, 105, 0, 105, -35, 105, 70, -35, 70, 35, -70, -70, -140, 0, -210, 70, -210, 105, -105, -70, -175, 105, 70, 175, 35, 175, -175, 175, | 35, -105, 35, -70, 35, -35, 35, 0, 35, 35, -105, -35, -175, 35, | 105, -105, 35, 70, | 175, -70, | -240, 175, | < >]\n\ndefine generateLevel []\nif <not <(save) = []>> then\n    broadcast (loading v)\n    broadcast (clearStage v)\n    set [loadtype v] to [land]\n    set [x v] to [1]\n    repeat until <<(letter (x) of (save)) = [<]> or <(letter (x) of (save)) = [>]>>\n        if <not <(letter (x) of (save)) = [ ]>> then\n            if <not <(letter (x) of (save)) = [,]>> then\n                if <(letter (x) of (save)) = [|]> then\n                    if <(loadType) = [spawner]> then\n                        set [loadtype v] to [portal]\n                    end\n                    if <(loadType) = [slime]> then\n                        set [loadtype v] to [spawner]\n                    end\n                    if <(loadType) = [obstacle]> then\n                        set [loadtype v] to [slime]\n                    end\n                    if <(loadType) = [land]> then\n                        set [loadtype v] to [obstacle]\n                    end\n                else\n                    add (letter (x) of (save)) to [numberfactory v]\n                end\n            else\n                add (numberFactory) to [debug v]\n                delete (all) of [numberfactory v]\n                if <(length of [debug v]) = [2]> then\n                    set [buildtype v] to (loadType)\n                    broadcast (createBlock v)\n                end\n            end\n        end\n        change [x v] by (1)\n    end\n    if <(letter (x) of (save)) = [<]> then\n        set [grappleability v] to [true]\n    else\n        set [grappleability v] to [false]\n    end\n    change [x v] by (2)\n    if <(letter (x) of (save)) = [<]> then\n        set [reversegravity v] to [true]\n    else\n        set [reversegravity v] to [false]\n    end\n    switch backdrop to (backdrop3 v)\n    set [playtype v] to [communityLevel]\n    broadcast (initiateLevel v)\nend\n\nwhen I receive [communitylevels v]\nshow\nrepeat until <(playing) = [true]>\n    if <touching (mouse-pointer v)?> then\n        set size to (150) %\n    else\n        set size to (100) %\n    end\nend\n\nwhen I receive [initiatelevel v]\nhide\n\n@Sprite20\n\nwhen flag clicked\ngo to x: (buttonOffset) y: (60)\nhide\n\nwhen this sprite clicked\ngenerateLevel [-105, 0, | -70, 0, -35, 140, -35, 35, 0, -35, 0, 105, -35, -35, -70, 140, | 35, 0, 35, 35, 35, 70, | -105, 35, | -35, 0, | < >]\n\ndefine generateLevel []\nif <not <(save) = []>> then\n    broadcast (loading v)\n    broadcast (clearStage v)\n    set [loadtype v] to [land]\n    set [x v] to [1]\n    repeat until <<(letter (x) of (save)) = [<]> or <(letter (x) of (save)) = [>]>>\n        if <not <(letter (x) of (save)) = [ ]>> then\n            if <not <(letter (x) of (save)) = [,]>> then\n                if <(letter (x) of (save)) = [|]> then\n                    if <(loadType) = [spawner]> then\n                        set [loadtype v] to [portal]\n                    end\n                    if <(loadType) = [slime]> then\n                        set [loadtype v] to [spawner]\n                    end\n                    if <(loadType) = [obstacle]> then\n                        set [loadtype v] to [slime]\n                    end\n                    if <(loadType) = [land]> then\n                        set [loadtype v] to [obstacle]\n                    end\n                else\n                    add (letter (x) of (save)) to [numberfactory v]\n                end\n            else\n                add (numberFactory) to [debug v]\n                delete (all) of [numberfactory v]\n                if <(length of [debug v]) = [2]> then\n                    set [buildtype v] to (loadType)\n                    broadcast (createBlock v)\n                end\n            end\n        end\n        change [x v] by (1)\n    end\n    if <(letter (x) of (save)) = [<]> then\n        set [grappleability v] to [true]\n    else\n        set [grappleability v] to [false]\n    end\n    change [x v] by (2)\n    if <(letter (x) of (save)) = [<]> then\n        set [reversegravity v] to [true]\n    else\n        set [reversegravity v] to [false]\n    end\n    switch backdrop to (backdrop3 v)\n    set [playtype v] to [communityLevel]\n    broadcast (initiateLevel v)\nend\n\nwhen I receive [communitylevels v]\nshow\nrepeat until <(playing) = [true]>\n    if <touching (mouse-pointer v)?> then\n        set size to (150) %\n    else\n        set size to (100) %\n    end\nend\n\nwhen I receive [initiatelevel v]\nhide\n\n@Sprite21\n\nwhen flag clicked\ngo to x: (buttonOffset) y: (30)\nhide\n\nwhen this sprite clicked\ngenerateLevel [| 70, 105, 70, 140, 70, 175, 140, 175, 140, 140, 140, 105, 70, 70, 70, 35, 140, 70, 140, 35, | 105, -105, -175, -70, -70, 0, 70, 70, 35, 70, -175, -70, | -175, -105, | 105, 140, | > <]\n\ndefine generateLevel []\nif <not <(save) = []>> then\n    broadcast (loading v)\n    broadcast (clearStage v)\n    set [loadtype v] to [land]\n    set [x v] to [1]\n    repeat until <<(letter (x) of (save)) = [<]> or <(letter (x) of (save)) = [>]>>\n        if <not <(letter (x) of (save)) = [ ]>> then\n            if <not <(letter (x) of (save)) = [,]>> then\n                if <(letter (x) of (save)) = [|]> then\n                    if <(loadType) = [spawner]> then\n                        set [loadtype v] to [portal]\n                    end\n                    if <(loadType) = [slime]> then\n                        set [loadtype v] to [spawner]\n                    end\n                    if <(loadType) = [obstacle]> then\n                        set [loadtype v] to [slime]\n                    end\n                    if <(loadType) = [land]> then\n                        set [loadtype v] to [obstacle]\n                    end\n                else\n                    add (letter (x) of (save)) to [numberfactory v]\n                end\n            else\n                add (numberFactory) to [debug v]\n                delete (all) of [numberfactory v]\n                if <(length of [debug v]) = [2]> then\n                    set [buildtype v] to (loadType)\n                    broadcast (createBlock v)\n                end\n            end\n        end\n        change [x v] by (1)\n    end\n    if <(letter (x) of (save)) = [<]> then\n        set [grappleability v] to [true]\n    else\n        set [grappleability v] to [false]\n    end\n    change [x v] by (2)\n    if <(letter (x) of (save)) = [<]> then\n        set [reversegravity v] to [true]\n    else\n        set [reversegravity v] to [false]\n    end\n    switch backdrop to (backdrop3 v)\n    set [playtype v] to [communityLevel]\n    broadcast (initiateLevel v)\nend\n\nwhen I receive [communitylevels v]\nshow\nrepeat until <(playing) = [true]>\n    if <touching (mouse-pointer v)?> then\n        set size to (150) %\n    else\n        set size to (100) %\n    end\nend\n\nwhen I receive [initiatelevel v]\nhide\n\n@Sprite22\n\nwhen flag clicked\ngo to x: (buttonOffset) y: (0)\nhide\n\nwhen this sprite clicked\ngenerateLevel [-210, 140, -175, 140, -140, 140, -70, 105, -70, -70, -105, -70, -105, 140, 140, 0, 105, 0, -70, 70, 70, 0, 35, 0, 0, 0, | 70, 70, 35, 70, 0, 70, -70, 70, -140, -70, -140, 70, -175, -70, -210, -70, -140, 105, -140, 35, -105, 105, -70, -35, -70, -70, -35, 70, -70, 70, -105, 70, -35, -35, 0, -35, 35, -35, 70, -35, 105, -35, 140, -35, 175, -35, | 35, -35, -105, -70, | -210, 175, | -210, -35, | < >]\n\ndefine generateLevel []\nif <not <(save) = []>> then\n    broadcast (loading v)\n    broadcast (clearStage v)\n    set [loadtype v] to [land]\n    set [x v] to [1]\n    repeat until <<(letter (x) of (save)) = [<]> or <(letter (x) of (save)) = [>]>>\n        if <not <(letter (x) of (save)) = [ ]>> then\n            if <not <(letter (x) of (save)) = [,]>> then\n                if <(letter (x) of (save)) = [|]> then\n                    if <(loadType) = [spawner]> then\n                        set [loadtype v] to [portal]\n                    end\n                    if <(loadType) = [slime]> then\n                        set [loadtype v] to [spawner]\n                    end\n                    if <(loadType) = [obstacle]> then\n                        set [loadtype v] to [slime]\n                    end\n                    if <(loadType) = [land]> then\n                        set [loadtype v] to [obstacle]\n                    end\n                else\n                    add (letter (x) of (save)) to [numberfactory v]\n                end\n            else\n                add (numberFactory) to [debug v]\n                delete (all) of [numberfactory v]\n                if <(length of [debug v]) = [2]> then\n                    set [buildtype v] to (loadType)\n                    broadcast (createBlock v)\n                end\n            end\n        end\n        change [x v] by (1)\n    end\n    if <(letter (x) of (save)) = [<]> then\n        set [grappleability v] to [true]\n    else\n        set [grappleability v] to [false]\n    end\n    change [x v] by (2)\n    if <(letter (x) of (save)) = [<]> then\n        set [reversegravity v] to [true]\n    else\n        set [reversegravity v] to [false]\n    end\n    switch backdrop to (backdrop3 v)\n    set [playtype v] to [communityLevel]\n    broadcast (initiateLevel v)\nend\n\nwhen I receive [communitylevels v]\nshow\nrepeat until <(playing) = [true]>\n    if <touching (mouse-pointer v)?> then\n        set size to (150) %\n    else\n        set size to (100) %\n    end\nend\n\nwhen I receive [initiatelevel v]\nhide\n\n@Sprite23\n\nwhen flag clicked\ngo to x: (buttonOffset) y: (-30)\nhide\n\nwhen this sprite clicked\ngenerateLevel [105, -70, -70, -70, -35, -105, 0, -105, 35, -70, 70, -105, 105, -105, 175, -140, 210, -140, 35, -105, -140, -70, -70, -105, -175, -70, -105, -105, | -175, -35, -140, -35, -105, 0, -105, 35, -140, 70, -175, 70, -210, 35, -210, 0, -175, 35, -175, 0, -140, 35, -140, 0, 175, -70, 210, -70, | 35, -35, 105, -70, -35, -70, 0, -70, 35, 0, | -70, -35, | 210, -105, | > >]\n\ndefine generateLevel []\nif <not <(save) = []>> then\n    broadcast (loading v)\n    broadcast (clearStage v)\n    set [loadtype v] to [land]\n    set [x v] to [1]\n    repeat until <<(letter (x) of (save)) = [<]> or <(letter (x) of (save)) = [>]>>\n        if <not <(letter (x) of (save)) = [ ]>> then\n            if <not <(letter (x) of (save)) = [,]>> then\n                if <(letter (x) of (save)) = [|]> then\n                    if <(loadType) = [spawner]> then\n                        set [loadtype v] to [portal]\n                    end\n                    if <(loadType) = [slime]> then\n                        set [loadtype v] to [spawner]\n                    end\n                    if <(loadType) = [obstacle]> then\n                        set [loadtype v] to [slime]\n                    end\n                    if <(loadType) = [land]> then\n                        set [loadtype v] to [obstacle]\n                    end\n                else\n                    add (letter (x) of (save)) to [numberfactory v]\n                end\n            else\n                add (numberFactory) to [debug v]\n                delete (all) of [numberfactory v]\n                if <(length of [debug v]) = [2]> then\n                    set [buildtype v] to (loadType)\n                    broadcast (createBlock v)\n                end\n            end\n        end\n        change [x v] by (1)\n    end\n    if <(letter (x) of (save)) = [<]> then\n        set [grappleability v] to [true]\n    else\n        set [grappleability v] to [false]\n    end\n    change [x v] by (2)\n    if <(letter (x) of (save)) = [<]> then\n        set [reversegravity v] to [true]\n    else\n        set [reversegravity v] to [false]\n    end\n    switch backdrop to (backdrop3 v)\n    set [playtype v] to [communityLevel]\n    broadcast (initiateLevel v)\nend\n\nwhen I receive [communitylevels v]\nshow\nrepeat until <(playing) = [true]>\n    if <touching (mouse-pointer v)?> then\n        set size to (150) %\n    else\n        set size to (100) %\n    end\nend\n\nwhen I receive [initiatelevel v]\nhide\n\n@Sprite24\n\nwhen flag clicked\ngo to x: (buttonOffset) y: (-60)\nhide\n\nwhen this sprite clicked\ngenerateLevel [-70, -105, -35, -105, -70, -70, -105, -35, -105, 140, 105, -105, -35, -35, 0, -105, | 0, 105, 35, 70, 70, 35, 105, 0, 105, 0, 210, 70, 140, 70, | 175, -105, 140, -105, 210, -35, 105, 0, -175, 35, | -35, -70, | 175, 140, | < <]\n\ndefine generateLevel []\nif <not <(save) = []>> then\n    broadcast (loading v)\n    broadcast (clearStage v)\n    set [loadtype v] to [land]\n    set [x v] to [1]\n    repeat until <<(letter (x) of (save)) = [<]> or <(letter (x) of (save)) = [>]>>\n        if <not <(letter (x) of (save)) = [ ]>> then\n            if <not <(letter (x) of (save)) = [,]>> then\n                if <(letter (x) of (save)) = [|]> then\n                    if <(loadType) = [spawner]> then\n                        set [loadtype v] to [portal]\n                    end\n                    if <(loadType) = [slime]> then\n                        set [loadtype v] to [spawner]\n                    end\n                    if <(loadType) = [obstacle]> then\n                        set [loadtype v] to [slime]\n                    end\n                    if <(loadType) = [land]> then\n                        set [loadtype v] to [obstacle]\n                    end\n                else\n                    add (letter (x) of (save)) to [numberfactory v]\n                end\n            else\n                add (numberFactory) to [debug v]\n                delete (all) of [numberfactory v]\n                if <(length of [debug v]) = [2]> then\n                    set [buildtype v] to (loadType)\n                    broadcast (createBlock v)\n                end\n            end\n        end\n        change [x v] by (1)\n    end\n    if <(letter (x) of (save)) = [<]> then\n        set [grappleability v] to [true]\n    else\n        set [grappleability v] to [false]\n    end\n    change [x v] by (2)\n    if <(letter (x) of (save)) = [<]> then\n        set [reversegravity v] to [true]\n    else\n        set [reversegravity v] to [false]\n    end\n    switch backdrop to (backdrop3 v)\n    set [playtype v] to [communityLevel]\n    broadcast (initiateLevel v)\nend\n\nwhen I receive [communitylevels v]\nshow\nrepeat until <(playing) = [true]>\n    if <touching (mouse-pointer v)?> then\n        set size to (150) %\n    else\n        set size to (100) %\n    end\nend\n\nwhen I receive [initiatelevel v]\nhide\n\n@Sprite25\n\nwhen flag clicked\ngo to x: (buttonOffset) y: (-90)\nhide\n\nwhen this sprite clicked\ngenerateLevel [70, 35, 35, 70, 175, 140, 245, 105, -105, -105, -35, -105, 35, -105, 140, -105, 210, -35, 175, -70, 105, 0, 175, 35, | 35, 35, 35, 0, 175, 140, 245, 140, 175, 175, 210, 175, 245, 175, 175, 35, | 105, -35, 0, -35, 210, 70, 70, 70, | -105, -70, | 210, 140, | < >]\n\ndefine generateLevel []\nif <not <(save) = []>> then\n    broadcast (loading v)\n    broadcast (clearStage v)\n    set [loadtype v] to [land]\n    set [x v] to [1]\n    repeat until <<(letter (x) of (save)) = [<]> or <(letter (x) of (save)) = [>]>>\n        if <not <(letter (x) of (save)) = [ ]>> then\n            if <not <(letter (x) of (save)) = [,]>> then\n                if <(letter (x) of (save)) = [|]> then\n                    if <(loadType) = [spawner]> then\n                        set [loadtype v] to [portal]\n                    end\n                    if <(loadType) = [slime]> then\n                        set [loadtype v] to [spawner]\n                    end\n                    if <(loadType) = [obstacle]> then\n                        set [loadtype v] to [slime]\n                    end\n                    if <(loadType) = [land]> then\n                        set [loadtype v] to [obstacle]\n                    end\n                else\n                    add (letter (x) of (save)) to [numberfactory v]\n                end\n            else\n                add (numberFactory) to [debug v]\n                delete (all) of [numberfactory v]\n                if <(length of [debug v]) = [2]> then\n                    set [buildtype v] to (loadType)\n                    broadcast (createBlock v)\n                end\n            end\n        end\n        change [x v] by (1)\n    end\n    if <(letter (x) of (save)) = [<]> then\n        set [grappleability v] to [true]\n    else\n        set [grappleability v] to [false]\n    end\n    change [x v] by (2)\n    if <(letter (x) of (save)) = [<]> then\n        set [reversegravity v] to [true]\n    else\n        set [reversegravity v] to [false]\n    end\n    switch backdrop to (backdrop3 v)\n    set [playtype v] to [communityLevel]\n    broadcast (initiateLevel v)\nend\n\nwhen I receive [communitylevels v]\nshow\nrepeat until <(playing) = [true]>\n    if <touching (mouse-pointer v)?> then\n        set size to (150) %\n    else\n        set size to (100) %\n    end\nend\n\nwhen I receive [initiatelevel v]\nhide\n\n@Sprite26\n\nwhen flag clicked\ngo to x: (buttonOffset) y: (-120)\nhide\n\nwhen this sprite clicked\ngenerateLevel [-140, -70, -105, -70, -70, -70, -35, -70, 0, -70, -70, 105, 35, -70, -105, 105, -140, 105, -140, 70, -140, 35, -140, 0, -140, -35, 70, 0, 105, 0, 175, 0, 105, 140, 70, 140, 35, 140, 0, 140, -35, 140, 175, 35, 175, 70, 175, 105, 140, 140, 175, 140, 70, 35, 70, -35, 35, 35, | 0, -35, 35, -35, | -35, -35, | -105, -35, | 70, -70, | < >]\n\ndefine generateLevel (save)\nif <not <(save) = []>> then\n    broadcast (loading v)\n    broadcast (clearstage v)\n    set [loadtype v] to [land]\n    set [x v] to [1]\n    repeat until <<(letter (x) of (save)) = [<]> or <(letter (x) of (save)) = [>]>>\n        if <not <(letter (x) of (save)) = [ ]>> then\n            if <not <(letter (x) of (save)) = [,]>> then\n                if <(letter (x) of (save)) = [|]> then\n                    if <(loadType) = [spawner]> then\n                        set [loadtype v] to [portal]\n                    end\n                    if <(loadType) = [slime]> then\n                        set [loadtype v] to [spawner]\n                    end\n                    if <(loadType) = [obstacle]> then\n                        set [loadtype v] to [slime]\n                    end\n                    if <(loadType) = [land]> then\n                        set [loadtype v] to [obstacle]\n                    end\n                else\n                    add (letter (x) of (save)) to [numberfactory v]\n                end\n            else\n                add (numberFactory) to [debug v]\n                delete (all) of [numberfactory v]\n                if <(length of [debug v]) = [2]> then\n                    set [buildtype v] to (loadType)\n                    broadcast (createblock v)\n                end\n            end\n        end\n        change [x v] by (1)\n    end\n    if <(letter (x) of (save)) = [<]> then\n        set [grappleability v] to [true]\n    else\n        set [grappleability v] to [false]\n    end\n    change [x v] by (2)\n    if <(letter (x) of (save)) = [<]> then\n        set [reversegravity v] to [true]\n    else\n        set [reversegravity v] to [false]\n    end\n    switch backdrop to (backdrop3 v)\n    set [playtype v] to [communityLevel]\n    broadcast (initiatelevel v)\nend\n\nwhen I receive [communitylevels v]\nshow\nrepeat until <(playing) = [true]>\n    if <touching (mouse-pointer v)?> then\n        set size to (150) %\n    else\n        set size to (100) %\n    end\nend\n\nwhen I receive [initiatelevel v]\nhide\n\n@Sprite27\n\nwhen flag clicked\ngo to x: ((buttonOffset) - (175)) y: (150)\nhide\n\nwhen this sprite clicked\ngenerateLevel [-35, 140, 0, 175, -70, 105, -105, 70, -105, -70, 35, -70, 70, -35, 140, 35, -35, 140, 0, 175, -70, 105, -105, 70, -105, -70, 35, -70, 70, -35, 140, 35, 70, 35, 70, 35, 0, 35, | -35, 70, 0, 0, -70, 0, -35, 35, -35, 70, 0, 0, -70, 0, -35, 35, -70, -175, 0, -175, 70, 140, 105, 140, 105, -35, -140, -70, 0, 140, -210, 0, 105, 70, 70, 105, 35, 140, | 70, 35, 140, 35, 175, -35, 175, 35, 105, 0, -175, -35, -35, -105, -35, -140, -35, 0, 70, 35, 140, 35, 175, -35, 175, 35, 105, 0, -175, -35, -35, -105, -35, -140, -35, 0, -35, -140, | -35, 175, | -35, 105, | > >]\n\ndefine generateLevel (save)\nif <not <(save) = []>> then\n    broadcast (loading v)\n    broadcast (clearstage v)\n    set [loadtype v] to [land]\n    set [x v] to [1]\n    repeat until <<(letter (x) of (save)) = [<]> or <(letter (x) of (save)) = [>]>>\n        if <not <(letter (x) of (save)) = [ ]>> then\n            if <not <(letter (x) of (save)) = [,]>> then\n                if <(letter (x) of (save)) = [|]> then\n                    if <(loadType) = [spawner]> then\n                        set [loadtype v] to [portal]\n                    end\n                    if <(loadType) = [slime]> then\n                        set [loadtype v] to [spawner]\n                    end\n                    if <(loadType) = [obstacle]> then\n                        set [loadtype v] to [slime]\n                    end\n                    if <(loadType) = [land]> then\n                        set [loadtype v] to [obstacle]\n                    end\n                else\n                    add (letter (x) of (save)) to [numberfactory v]\n                end\n            else\n                add (numberFactory) to [debug v]\n                delete (all) of [numberfactory v]\n                if <(length of [debug v]) = [2]> then\n                    set [buildtype v] to (loadType)\n                    broadcast (createblock v)\n                end\n            end\n        end\n        change [x v] by (1)\n    end\n    if <(letter (x) of (save)) = [<]> then\n        set [grappleability v] to [true]\n    else\n        set [grappleability v] to [false]\n    end\n    change [x v] by (2)\n    if <(letter (x) of (save)) = [<]> then\n        set [reversegravity v] to [true]\n    else\n        set [reversegravity v] to [false]\n    end\n    switch backdrop to (backdrop3 v)\n    set [playtype v] to [communityLevel]\n    broadcast (initiatelevel v)\nend\n\nwhen I receive [communitylevels v]\nshow\nrepeat until <(playing) = [true]>\n    if <touching (mouse-pointer v)?> then\n        set size to (150) %\n    else\n        set size to (100) %\n    end\nend\n\nwhen I receive [initiatelevel v]\nhide\n\n@Sprite28\n\nwhen flag clicked\ngo to x: ((buttonOffset) - (175)) y: (120)\nhide\n\nwhen this sprite clicked\ngenerateLevel [-35, 70, 70, -35, | 0, 70, 0, 105, 0, 140, 0, 175, 35, -35, 0, -35, -35, -35, -70, -35, -105, -35, -140, -35, -210, -35, -175, -35, -240, -35, 175, 35, 175, -35, 175, 0, | 140, -35, 70, -35, 105, -35, | -35, 105, | -140, -105, | < >]\n\ndefine generateLevel (save)\nif <not <(save) = []>> then\n    broadcast (loading v)\n    broadcast (clearstage v)\n    set [loadtype v] to [land]\n    set [x v] to [1]\n    repeat until <<(letter (x) of (save)) = [<]> or <(letter (x) of (save)) = [>]>>\n        if <not <(letter (x) of (save)) = [ ]>> then\n            if <not <(letter (x) of (save)) = [,]>> then\n                if <(letter (x) of (save)) = [|]> then\n                    if <(loadType) = [spawner]> then\n                        set [loadtype v] to [portal]\n                    end\n                    if <(loadType) = [slime]> then\n                        set [loadtype v] to [spawner]\n                    end\n                    if <(loadType) = [obstacle]> then\n                        set [loadtype v] to [slime]\n                    end\n                    if <(loadType) = [land]> then\n                        set [loadtype v] to [obstacle]\n                    end\n                else\n                    add (letter (x) of (save)) to [numberfactory v]\n                end\n            else\n                add (numberFactory) to [debug v]\n                delete (all) of [numberfactory v]\n                if <(length of [debug v]) = [2]> then\n                    set [buildtype v] to (loadType)\n                    broadcast (createblock v)\n                end\n            end\n        end\n        change [x v] by (1)\n    end\n    if <(letter (x) of (save)) = [<]> then\n        set [grappleability v] to [true]\n    else\n        set [grappleability v] to [false]\n    end\n    change [x v] by (2)\n    if <(letter (x) of (save)) = [<]> then\n        set [reversegravity v] to [true]\n    else\n        set [reversegravity v] to [false]\n    end\n    switch backdrop to (backdrop3 v)\n    set [playtype v] to [communityLevel]\n    broadcast (initiatelevel v)\nend\n\nwhen I receive [communitylevels v]\nshow\nrepeat until <(playing) = [true]>\n    if <touching (mouse-pointer v)?> then\n        set size to (150) %\n    else\n        set size to (100) %\n    end\nend\n\nwhen I receive [initiatelevel v]\nhide\n\n@Sprite29\n\nwhen flag clicked\ngo to x: ((buttonOffset) - (175)) y: (90)\nhide\n\nwhen this sprite clicked\ngenerateLevel [-140, 105, | 70, -105, 105, -70, 105, -105, 105, -35, | -105, 105, 35, -105, | -140, 140, | 140, -105, | > >]\n\ndefine generateLevel (save)\nif <not <(save) = []>> then\n    broadcast (loading v)\n    broadcast (clearstage v)\n    set [loadtype v] to [land]\n    set [x v] to [1]\n    repeat until <<(letter (x) of (save)) = [<]> or <(letter (x) of (save)) = [>]>>\n        if <not <(letter (x) of (save)) = [ ]>> then\n            if <not <(letter (x) of (save)) = [,]>> then\n                if <(letter (x) of (save)) = [|]> then\n                    if <(loadType) = [spawner]> then\n                        set [loadtype v] to [portal]\n                    end\n                    if <(loadType) = [slime]> then\n                        set [loadtype v] to [spawner]\n                    end\n                    if <(loadType) = [obstacle]> then\n                        set [loadtype v] to [slime]\n                    end\n                    if <(loadType) = [land]> then\n                        set [loadtype v] to [obstacle]\n                    end\n                else\n                    add (letter (x) of (save)) to [numberfactory v]\n                end\n            else\n                add (numberFactory) to [debug v]\n                delete (all) of [numberfactory v]\n                if <(length of [debug v]) = [2]> then\n                    set [buildtype v] to (loadType)\n                    broadcast (createblock v)\n                end\n            end\n        end\n        change [x v] by (1)\n    end\n    if <(letter (x) of (save)) = [<]> then\n        set [grappleability v] to [true]\n    else\n        set [grappleability v] to [false]\n    end\n    change [x v] by (2)\n    if <(letter (x) of (save)) = [<]> then\n        set [reversegravity v] to [true]\n    else\n        set [reversegravity v] to [false]\n    end\n    switch backdrop to (backdrop3 v)\n    set [playtype v] to [communityLevel]\n    broadcast (initiatelevel v)\nend\n\nwhen I receive [communitylevels v]\nshow\nrepeat until <(playing) = [true]>\n    if <touching (mouse-pointer v)?> then\n        set size to (150) %\n    else\n        set size to (100) %\n    end\nend\n\nwhen I receive [initiatelevel v]\nhide\n\n
Welcome to Swing!\n\nInstructions:\n-A/Left Arrow and D/Right Arrow will move you left and right\n-Hold your mouse down to initiate a grapple\n-Lift your mouse up to release the grapple\n\nSymbols in the top left:\n-Tells you whether grappling is enabled or disabled on this stage\n-Direction of gravity\n\nBlocks:\n-Land: no effect, but you can wall ride on its sides\n-Obstacle (Red block): sends you back to the start of the level\n-Slime block: bounces you back up (or down if the gravity is reversed) at the velocity that you hit it at\n\nLevel Editor:\n-The buttons on the right will let you place blocks in your level\n-The buttons on the top left will let you change grapple ability and gravity direction\n-The play symbol on the bottom left lets you test the level (You cannot test a level without a portal and/or a spawner)\n-The save button will give you a code. Highlight the text and copy it with CTRL + C (Press space to close this menu)\n-The import button will ask for a save code when you click it. Paste one that you have previously made, or paste one from the comments\n\nThanks for checking out my project.