Trapped | A 100% Pen Scrolling Platformer


@Stage\n\nwhen flag clicked\nset [|part| v] to [home]\n\nwhen I receive [home v]\nset [|part| v] to [home]\n\nwhen I receive [level select v]\nset [|part| v] to (join [level select ] (level))\n\nwhen I receive [settings v]\nset [|part| v] to [settings]\n\nwhen I receive [start game v]\nset [|part| v] to (join [game ] (level))\n\nwhen I receive [arrow l v]\nset [|part| v] to (join [level select ] (level))\n\nwhen I receive [arrow r v]\nset [|part| v] to (join [level select ] (level))\n\nwhen flag clicked\nstop [other scripts in sprite v]\nstop all sounds\nforever\n    play sound [Repetitive Game Music v] until done\nend\n\n@lag\n\n@THUMB\n\nwhen flag clicked\nset [ghost v] effect to (100)\ngo to [front v] layer\n\n@PEN\n\ndefine delete all platform data\ndelete all of [level heights v]\ndelete all of [level input length v]\ndelete all of [level types v]\ndelete all of [level widths v]\ndelete all of [level xs v]\ndelete all of [level ys v]\n\nwhen I receive [start game v]\nset [start time v] to [0]\nstop [other scripts in sprite v]\nbroadcast (check up v)\nbroadcast (setup v) and wait\nRESET GAME\nsetup springs (level)\nforever\n    erase all\n    render grid (SCROLL X) (SCROLL Y)\n    if <(level) = [6]> then\n        if <(SCROLL Y) = [0]> then\n            broadcast (Animation v) and wait\n            set [spawn y v] to [-1]\n        end\n        change [scroll y v] by (-15)\n        if <(SCROLL Y) < [-800]> then\n            set [scroll y v] to [-800]\n            change [y pos v] by (15)\n        end\n        render player [1]\n        level 6 movement\n        if <[300] < (y pos)> then\n            broadcast (Win v)\n            stop [this script v]\n        end\n    else\n        CHECKPOINTS\n        create level\n        render level\n        render player [1]\n        update collisions\n        movements physics\n        springs\n        render borders\n        STAGES\n        broadcast (TICK v)\n        if <[] < (end)> then\n            if <(end) = [:\)]> then\n                replace item (level) of [levels completed v] with [done!]\n                record!? (level)\n                broadcast (home v)\n                stop [this script v]\n            else\n                RESET GAME\n            end\n        end\n    end\nend\n\ndefine RESET GAME\ngo to x: (0) y: (0)\nset [x pos v] to [0]\nset [y pos v] to [0]\nset [xv v] to [0]\nset [yv v] to [0]\nset [scroll x v] to (SPAWN X)\nset [scroll y v] to (SPAWN Y)\nset [level pen size v] to [10]\nset [player pen size v] to [10]\nset [player size v] to [20]\nset [level distance v] to [8]\nset [player - level distance v] to [2]\nset [mode v] to [game]\nset [editing speed v] to [8]\nset [end v] to []\nhide variable [editing speed v]\nset [on ground? v] to [0]\nset [fall off v] to [0]\nspecial level\n\ndefine movements physics\nupdate collisions\nif <(mobile mode?) = [0]> then\n    change [xv v] by ((<<key (right arrow v) pressed?> or <key (d v) pressed?>> - <<key (left arrow v) pressed?> or <key (a v) pressed?>>) * (0.9))\n    if <(start time) = [0]> then\n        if <key (any v) pressed?> then\n            set [start time v] to [1]\n        end\n    end\nelse\n    change [xv v] by ((<<mouse down?> and <[10] < (mouse x)>> - <<mouse down?> and <(mouse x) < [10]>>) * (0.9))\n    if <(start time) = [0]> then\n        if <mouse down?> then\n            set [start time v] to [1]\n        end\n    end\nend\nset [xv v] to ((Xv) * (0.9))\nchange [x pos v] by (Xv)\nupdate collisions\nset [slope v] to [0]\nrepeat until <<(slope) = [8]> or <not <[collisions v] contains [1]?>>>\n    change [slope v] by (1)\n    change [y pos v] by (1)\n    update collisions\n    if <(slope) = [7]> then\n        change [x pos v] by ((Xv) * (-1))\n        set [xv v] to [0]\n    end\nend\nchange [y pos v] by (() - (slope))\nupdate collisions\nchange [yv v] by (-1)\nif <(Yv) < [-17]> then\n    set [yv v] to [-17]\nend\nchange [y pos v] by (Yv)\nupdate collisions\nif <[collisions v] contains [1]?> then\n    repeat until <not <[collisions v] contains [1]?>>\n        if <[0] < (Yv)> then\n            change [y pos v] by (-1)\n        else\n            change [y pos v] by (1)\n        end\n        update collisions\n    end\n    if <(Yv) < [0]> then\n        set [on ground? v] to [6]\n    end\n    set [yv v] to [0]\nend\nupdate collisions\nchange [y pos v] by (-1)\nupdate collisions\nif <[0] < (on ground?)> then\n    if <(key up?) = [1]> then\n        set [yv v] to [9]\n        change [on ground? v] by (-1)\n    else\n        set [on ground? v] to [0]\n    end\nend\nif <(on ground?) = [0]> then\n    set [key up? v] to [0]\nend\nExtra\ncalculate scroll values\n\ndefine position (x) (y)\ngo to x: ((x) + (SCROLL X)) y: ((y) + (SCROLL Y))\n\ndefine create level\ndelete all platform data\nif <(level) = [1]> then\n    add rectangle [-90] [-200] [200] [100] [1] x / y / x size / y size / type\n    if <(item (1) of [stages v]) = [1]> then\n        add rectangle [120] [-200] [150] [100] [1] x / y / x size / y size / type\n    end\n    add rectangle [280] [-200] [200] [100] [1] x / y / x size / y size / type\n    if <(item (2) of [stages v]) = [1]> then\n        add rectangle [500] [-300] [150] [100] [2] x / y / x size / y size / type\n    end\n    add rectangle [670] [-300] [100] [100] [2] x / y / x size / y size / type\n    add rectangle [380] [-500] [100] [300] [2] x / y / x size / y size / type\n    if <(item (3) of [stages v]) = [1]> then\n        add rectangle [670] [-200] [100] [100] [1] x / y / x size / y size / type\n    end\n    add rectangle [490] [-500] [280] [100] [1] x / y / x size / y size / type\n    add rectangle [780] [-500] [300] [100] [1] x / y / x size / y size / type\n    if <(item (4) of [stages v]) = [1]> then\n        add rectangle [900] [-400] [60] [40] [2] x / y / x size / y size / type\n    else\n        add rectangle [900] [-360] [60] [90] [2] x / y / x size / y size / type\n    end\n    add rectangle [1090] [-500] [300] [100] [1] x / y / x size / y size / type\n    add rectangle [1200] [-400] [60] [40] [2] x / y / x size / y size / type\n    add rectangle [1400] [-500] [150] [100] [1] x / y / x size / y size / type\n    add rectangle [1560] [-500] [100] [150] [1] x / y / x size / y size / type\n    add rectangle [1670] [-500] [100] [200] [1] x / y / x size / y size / type\n    add rectangle [1780] [-500] [100] [250] [1] x / y / x size / y size / type\n    add rectangle [1890] [-350] [100] [100] [1] x / y / x size / y size / type\n    if <(item (5) of [stages v]) = [1]> then\n        add rectangle [2000] [-350] [100] [100] [1] x / y / x size / y size / type\n    end\n    add rectangle [2110] [-350] [100] [100] [1] x / y / x size / y size / type\n    add rectangle [2220] [-350] [100] [100] [1] x / y / x size / y size / type\n    if <(item (6) of [stages v]) = [1]> then\n        add rectangle [2330] [-350] [100] [100] [1] x / y / x size / y size / type\n    end\n    add rectangle [2440] [-550] [100] [300] [1] x / y / x size / y size / type\n    add rectangle [2550] [-300] [100] [50] [3] x / y / x size / y size / type\n    add rectangle [2660] [-150] [100] [50] [3] x / y / x size / y size / type\n    add rectangle [2770] [0] [100] [50] [3] x / y / x size / y size / type\n    add rectangle [2880] [150] [100] [50] [3] x / y / x size / y size / type\n    add rectangle [2990] [150] [100] [50] [2] x / y / x size / y size / type\n    if <(item (7) of [stages v]) = [1]> then\n        add rectangle [2770] [300] [100] [50] [1] x / y / x size / y size / type\n    end\n    if <(item (8) of [stages v]) = [1]> then\n        add rectangle [3100] [150] [100] [50] [1] x / y / x size / y size / type\n    end\n    add rectangle [2550] [300] [100] [50] [1] x / y / x size / y size / type\nelse\n    if <(level) = [2]> then\n        add rectangle [-50] [-100] [120] [50] [1] x / y / x size / y size / type\n        if <(item (2) of [stages v]) = [0]> then\n            add rectangle [-170] [-100] [120] [50] [3] x / y / x size / y size / type\n        end\n        add rectangle [70] [-100] [120] [50] [3] x / y / x size / y size / type\n        add rectangle [-50] [80] [120] [50] [1] x / y / x size / y size / type\n        add rectangle [190] [80] [120] [70] [1] x / y / x size / y size / type\n        add rectangle [430] [100] [120] [50] [1] x / y / x size / y size / type\n        add rectangle [660] [100] [120] [70] [1] x / y / x size / y size / type\n        add rectangle [890] [120] [120] [50] [1] x / y / x size / y size / type\n        if <(item (1) of [stages v]) = [1]> then\n            add rectangle [1010] [120] [150] [50] [2] x / y / x size / y size / type\n        end\n        add rectangle [1160] [120] [100] [50] [3] x / y / x size / y size / type\n        add rectangle [1400] [200] [100] [50] [1] x / y / x size / y size / type\n        add rectangle [1510] [200] [100] [50] [3] x / y / x size / y size / type\n        add rectangle [1620] [380] [100] [50] [1] x / y / x size / y size / type\n        add rectangle [1900] [380] [100] [50] [1] x / y / x size / y size / type\n        add rectangle [2010] [380] [100] [50] [2] x / y / x size / y size / type\n        add rectangle [2120] [380] [100] [50] [3] x / y / x size / y size / type\n        add rectangle [2010] [560] [100] [50] [1] x / y / x size / y size / type\n        add rectangle [1900] [560] [100] [100] [3] x / y / x size / y size / type\n        add rectangle [1790] [740] [100] [100] [1] x / y / x size / y size / type\n    else\n        if <(level) = [3]> then\n            add rectangle [-50] [-100] [120] [50] [1] x / y / x size / y size / type\n            add rectangle [70] [-150] [120] [50] [1] x / y / x size / y size / type\n            add rectangle [190] [-200] [120] [50] [1] x / y / x size / y size / type\n            add rectangle [310] [-250] [120] [50] [1] x / y / x size / y size / type\n            add rectangle [430] [-300] [120] [50] [3] x / y / x size / y size / type\n            add rectangle [700] [-200] [120] [50] [1] x / y / x size / y size / type\n            add rectangle [820] [-200] [150] [50] [2] x / y / x size / y size / type\n            if <(item (1) of [stages v]) = [0]> then\n                add rectangle [970] [-200] [120] [50] [1] x / y / x size / y size / type\n            end\n            if <(item (2) of [stages v]) = [0]> then\n                add rectangle [-170] [-100] [120] [50] [1] x / y / x size / y size / type\n            end\n            add rectangle [-450] [-100] [120] [50] [1] x / y / x size / y size / type\n            add rectangle [-570] [-100] [120] [50] [3] x / y / x size / y size / type\n            add rectangle [-810] [70] [120] [50] [1] x / y / x size / y size / type\n            add rectangle [-930] [70] [120] [50] [2] x / y / x size / y size / type\n            add rectangle [-1050] [70] [120] [50] [1] x / y / x size / y size / type\n            add rectangle [-1320] [70] [120] [50] [3] x / y / x size / y size / type\n            add rectangle [-1320] [250] [120] [50] [1] x / y / x size / y size / type\n            add rectangle [-1080] [300] [120] [50] [1] x / y / x size / y size / type\n            add rectangle [-1080] [400] [120] [25] [2] x / y / x size / y size / type\n            add rectangle [-840] [350] [120] [50] [1] x / y / x size / y size / type\n            add rectangle [-1080] [425] [120] [25] [1] x / y / x size / y size / type\n            add rectangle [-1200] [425] [25] [25] [1] x / y / x size / y size / type\n            add rectangle [-1300] [425] [25] [25] [1] x / y / x size / y size / type\n            add rectangle [-1400] [450] [25] [25] [1] x / y / x size / y size / type\n            add rectangle [-1600] [450] [25] [25] [1] x / y / x size / y size / type\n            add rectangle [-1750] [450] [50] [50] [1] x / y / x size / y size / type\n            add rectangle [-1800] [450] [50] [50] [2] x / y / x size / y size / type\n            add rectangle [-1850] [450] [50] [50] [2] x / y / x size / y size / type\n            add rectangle [-1900] [450] [50] [50] [3] x / y / x size / y size / type\n            if <(item (3) of [stages v]) = [0]> then\n                add rectangle [-1900] [620] [50] [50] [3] x / y / x size / y size / type\n            end\n            if <(item (4) of [stages v]) = [0]> then\n                add rectangle [-1900] [790] [50] [50] [1] x / y / x size / y size / type\n            end\n            add rectangle [-2100] [790] [100] [100] [1] x / y / x size / y size / type\n        else\n            if <(level) = [4]> then\n                add rectangle [50] [-100] [100] [20] [1] x / y / x size / y size / type\n                add rectangle [150] [-100] [100] [30] [4] x / y / x size / y size / type\n                add rectangle [250] [-100] [100] [20] [1] x / y / x size / y size / type\n                if <(item (1) of [stages v]) = [0]> then\n                    add rectangle [150] [-50] [100] [100] [1] x / y / x size / y size / type\n                end\n                add rectangle [150] [-500] [100] [20] [1] x / y / x size / y size / type\n                add rectangle [250] [-500] [100] [20] [2] x / y / x size / y size / type\n                add rectangle [250] [-400] [100] [20] [1] x / y / x size / y size / type\n                add rectangle [350] [-500] [100] [20] [1] x / y / x size / y size / type\n                add rectangle [350] [-400] [100] [20] [2] x / y / x size / y size / type\n                add rectangle [500] [-450] [100] [20] [1] x / y / x size / y size / type\n                add rectangle [600] [-600] [100] [346] [4] x / y / x size / y size / type\n                add rectangle [700] [-500] [100] [20] [1] x / y / x size / y size / type\n                add rectangle ((([sin v] of ((TIME) * (80)) ) * (150)) + (950)) [-500] [100] [20] [1] x / y / x size / y size / type\n                add rectangle [1200] ((([sin v] of (((TIME) + (16)) * (80)) ) * (100)) + (-400)) [100] [20] [1] x / y / x size / y size / type\n                add rectangle [1300] [-300] [200] [20] [1] x / y / x size / y size / type\n                add rectangle [1500] [-230] [100] [20] [1] x / y / x size / y size / type\n            else\n                add rectangle [-50] ((([sin v] of (((TIME) + (0)) * (80)) ) * (100)) + (-50)) [100] [20] [1] x / y / x size / y size / type\n                add rectangle [50] ((([sin v] of (((TIME) + (20)) * (80)) ) * (100)) + (150)) [100] [20] [1] x / y / x size / y size / type\n                add rectangle [150] ((([sin v] of (((TIME) + (0)) * (80)) ) * (100)) + (350)) [100] [20] [1] x / y / x size / y size / type\n                add rectangle ((([sin v] of (((TIME) + (6)) * (80)) ) * (100)) + (250)) [450] [100] [20] [1] x / y / x size / y size / type\n                add rectangle ((([sin v] of (((TIME) + (13)) * (80)) ) * (100)) + (550)) [450] [100] [20] [1] x / y / x size / y size / type\n                add rectangle ((([sin v] of (((TIME) + (6)) * (80)) ) * (100)) + (850)) [450] [100] [20] [1] x / y / x size / y size / type\n                add rectangle [1050] [450] [200] [20] [1] x / y / x size / y size / type\n                add rectangle [1200] ((([sin v] of (((TIME) + (0)) * (200)) ) * (30)) + (500)) [50] [100] [2] x / y / x size / y size / type\n                add rectangle ((([sin v] of (((TIME) + (8)) * (200)) ) * (50)) + (1300)) [450] [50] [20] [3] x / y / x size / y size / type\n                add rectangle [1200] ((([sin v] of (((TIME) + (0)) * (200)) ) * (30)) + (600)) [50] [20] [3] x / y / x size / y size / type\n                add rectangle ((([sin v] of (((TIME) + (5)) * (100)) ) * (100)) + (1400)) [700] [50] [20] [1] x / y / x size / y size / type\n                add rectangle [1500] [700] [100] [20] [1] x / y / x size / y size / type\n                add rectangle [1700] [750] [50] [20] [1] x / y / x size / y size / type\n                add rectangle [1750] [760] [50] [20] [1] x / y / x size / y size / type\n                add rectangle [1900] [760] [100] [40] [1] x / y / x size / y size / type\n            end\n        end\n    end\nend\n\ndefine add rectangle (x) (y) (width) (height) (type) x / y / x size / y size / type\nadd (x) to [level xs v]\nadd (y) to [level ys v]\nadd (width) to [level widths v]\nadd (height) to [level heights v]\nadd (type) to [level types v]\nadd (pick random (x) to (y)) to [level input length v]\n\ndefine render level\npen up\nset pen (transparency v) to (15)\nset pen size to (level pen size)\nset [i v] to [1]\nrepeat (length of [level input length v])\n    position ((item (i) of [level xs v]) + (level distance)) ((item (i) of [level ys v]) + (level distance))\n    get color (item (i) of [level types v])\n    pen down\n    set pen (transparency v) to (15)\n    position ((item (i) of [level xs v]) + (level distance)) (((item (i) of [level ys v]) + (item (i) of [level heights v])) - (level distance))\n    position (((item (i) of [level xs v]) + (item (i) of [level widths v])) - (level distance)) (((item (i) of [level ys v]) + (item (i) of [level heights v])) - (level distance))\n    position (((item (i) of [level xs v]) + (item (i) of [level widths v])) - (level distance)) ((item (i) of [level ys v]) + (level distance))\n    position ((item (i) of [level xs v]) + (level distance)) ((item (i) of [level ys v]) + (level distance))\n    pen up\n    change [i v] by (1)\nend\nset pen (transparency v) to (0)\n\ndefine render player (norm?)\nif <(norm?) = [1]> then\n    pen up\n    set pen size to (player pen size)\n    get color [player]\n    go to x: (x pos) y: ((y pos) + (player - level distance))\n    set pen (transparency v) to (0)\n    pen down\n    go to x: (x pos) y: (((y pos) + (player size)) + (player - level distance))\n    go to x: ((x pos) + (player size)) y: (((y pos) + (player size)) + (player - level distance))\n    go to x: ((x pos) + (player size)) y: ((y pos) + (player - level distance))\n    go to x: (x pos) y: ((y pos) + (player - level distance))\n    pen up\nelse\n    pen up\n    set pen size to (player pen size)\n    get color [player]\n    go to x: (((mouse x) - (-700)) / (-3)) y: (((mouse y) - (-110)) / (-3))\n    set pen (transparency v) to (0)\n    pen down\n    go to x: (((mouse x) - (-650)) / (-3)) y: (((mouse y) - (-110)) / (-3))\n    go to x: (((mouse x) - (-650)) / (-3)) y: (((mouse y) - (-60)) / (-3))\n    go to x: (((mouse x) - (-700)) / (-3)) y: (((mouse y) - (-60)) / (-3))\n    go to x: (((mouse x) - (-700)) / (-3)) y: (((mouse y) - (-110)) / (-3))\n    pen up\nend\n\ndefine get color (type)\nif <(type) = [player]> then\n    set pen color to (#3a75dc)\nend\nif <(type) = [1]> then\n    set pen color to (#000000)\nend\nif <(type) = [2]> then\n    set pen color to (#ff1010)\nend\nif <(type) = [3]> then\n    set pen color to (#ffb310)\nend\nif <(type) = [4]> then\n    set pen color to (#ff1010)\nend\n\ndefine update collisions\ndelete all of [collisions v]\nset [i v] to [1]\nrepeat (length of [level input length v])\n    if <(x pos) < (((item (i) of [level xs v]) + (SCROLL X)) + (item (i) of [level widths v]))> then\n        if <((x pos) + (player size)) > ((item (i) of [level xs v]) + (SCROLL X))> then\n            if <(y pos) < (((item (i) of [level ys v]) + (SCROLL Y)) + (item (i) of [level heights v]))> then\n                if <((y pos) + (player size)) > ((item (i) of [level ys v]) + (SCROLL Y))> then\n                    if <not <[collisions v] contains (item (i) of [level types v])?>> then\n                        add (item (i) of [level types v]) to [collisions v]\n                    end\n                end\n            end\n        end\n    end\n    change [i v] by (1)\nend\n\ndefine render borders\npen up\nset pen color to (#191919)\nset pen size to (10)\ngo to x: (-235) y: (175)\npen down\ngo to x: (235) y: (175)\ngo to x: (235) y: (-175)\ngo to x: (-235) y: (-175)\ngo to x: (-235) y: (175)\npen up\n\ndefine render grid (x) (y)\npen up\nset pen color to (#f3f3f3)\nset pen size to (20)\ngo to x: ((((x) * (0.2)) mod (40)) - (240)) y: (-180)\nrepeat (13)\n    pen down\n    set y to (180)\n    pen up\n    change x by (40)\n    set y to (-180)\nend\ngo to x: (-240) y: ((((y) * (0.2)) mod (40)) - (180))\nrepeat (10)\n    pen down\n    set x to (240)\n    pen up\n    change y by (40)\n    set x to (-240)\nend\npen up\n\ndefine calculate scroll values\nchange [scroll x v] by (() - (round ((x pos) / (7))))\nchange [x pos v] by (() - (round ((x pos) / (7))))\nchange [scroll y v] by (() - (round ((y pos) / (7))))\nchange [y pos v] by (() - (round ((y pos) / (7))))\nif <(() - (SCROLL Y)) < [-600]> then\n    set [scroll y v] to (() - (SCROLL Y))\n    change [fall off v] by (1)\nend\n\nwhen flag clicked\ndelete all of [levels completed v]\nrepeat (5)\n    add [not completed :\(] to [levels completed v]\nend\nbroadcast (home v)\n\ndefine STAGES\nif <(level) = [1]> then\n    if <<(SCROLL X) < [-110]> and <[-250] < (SCROLL X)>> then\n        replace item (1) of [stages v] with [0]\n    else\n        replace item (1) of [stages v] with [1]\n    end\n    if <<<(SCROLL X) < [-450]> and <[-650] < (SCROLL X)>> and <<[130] < (SCROLL Y)> and <(SCROLL Y) < [370]>>> then\n        replace item (2) of [stages v] with [0]\n    else\n        replace item (2) of [stages v] with [1]\n    end\n    if <<<(SCROLL X) < [-600]> and <[-750] < (SCROLL X)>> and <(SCROLL Y) < [280]>> then\n        replace item (3) of [stages v] with [0]\n    else\n        replace item (3) of [stages v] with [1]\n    end\n    if <<<(SCROLL X) < [-850]> and <[-980] < (SCROLL X)>> and <[300] < (SCROLL Y)>> then\n        replace item (4) of [stages v] with [0]\n    else\n        replace item (4) of [stages v] with [1]\n    end\n    if <<(SCROLL X) < [-2000]> and <[-2100] < (SCROLL X)>> then\n        replace item (5) of [stages v] with [0]\n    else\n        replace item (5) of [stages v] with [1]\n    end\n    if <<(SCROLL X) < [-2300]> and <[-2400] < (SCROLL X)>> then\n        replace item (6) of [stages v] with [0]\n    else\n        replace item (6) of [stages v] with [1]\n    end\n    if <<<(SCROLL X) < [-2750]> and <[-3000] < (SCROLL X)>> and <(SCROLL Y) < [-300]>> then\n        replace item (7) of [stages v] with [1]\n    else\n        replace item (7) of [stages v] with [0]\n    end\n    if <<(SCROLL X) < [-3100]> and <[-3200] < (SCROLL X)>> then\n        replace item (8) of [stages v] with [0]\n    else\n        replace item (8) of [stages v] with [1]\n    end\nelse\n    if <(level) = [2]> then\n        if <<(SCROLL X) < [-1000]> and <[-1150] < (SCROLL X)>> then\n            replace item (1) of [stages v] with [0]\n        else\n            replace item (1) of [stages v] with [1]\n        end\n        if <<(SCROLL X) < [70]> and <[-50] < (SCROLL X)>> then\n            replace item (2) of [stages v] with [0]\n        else\n            replace item (2) of [stages v] with [1]\n        end\n    else\n        if <(level) = [3]> then\n            if <(SCROLL X) < [-900]> then\n                replace item (1) of [stages v] with [1]\n            else\n                replace item (1) of [stages v] with [0]\n            end\n            if <[40] < (SCROLL X)> then\n                replace item (2) of [stages v] with [0]\n            else\n                replace item (2) of [stages v] with [1]\n            end\n            if <(SCROLL Y) < [-600]> then\n                replace item (3) of [stages v] with [0]\n            else\n                replace item (3) of [stages v] with [1]\n            end\n            if <[-780] < (SCROLL Y)> then\n                replace item (4) of [stages v] with [1]\n            else\n                replace item (4) of [stages v] with [0]\n            end\n        else\n            if <(SCROLL X) < [-80]> then\n                replace item (1) of [stages v] with [0]\n            else\n                replace item (1) of [stages v] with [1]\n            end\n        end\n    end\nend\n\ndefine CHECKPOINTS\nif <(level) = [1]> then\n    CHECKPOINT AT [-1460] [400] END: [0]\n    CHECKPOINT AT [-2590] [-350] END: [1]\nelse\n    if <(level) = [2]> then\n        CHECKPOINT AT [-1450] [-250] END: [0]\n        CHECKPOINT AT [-1840] [-840] END: [1]\n    else\n        if <(level) = [3]> then\n            CHECKPOINT AT [1025] [-350] END: [0]\n            CHECKPOINT AT [2050] [-890] END: [1]\n        else\n            if <(level) = [4]> then\n                CHECKPOINT AT [-543] [425] END: [0]\n                CHECKPOINT AT [-1550] [210] END: [1]\n            else\n                CHECKPOINT AT [-1940] [-800] END: [1]\n            end\n        end\n    end\nend\n\ndefine CHECKPOINT AT (x) (y) END: (end?)\nif <(end?) = [0]> then\n    if <<(x) = (SPAWN X)> and <(y) = (SPAWN Y)>> then\n        set pen color to (#3bf01b)\n    else\n        set pen color to (#b7f0ae)\n        if <<<((SCROLL X) - (x)) < [40]> and <[-40] < ((SCROLL X) - (x))>> and <<((SCROLL Y) - (y)) < [50]> and <[-50] < ((SCROLL Y) - (y))>>> then\n            set [spawn x v] to (x)\n            set [spawn y v] to (y)\n        end\n    end\n    pen up\n    go to x: (((x) - (SCROLL X)) * (-1)) y: (((y) - (SCROLL Y)) * (-1))\n    pen down\n    go to x: (((x) - (SCROLL X)) * (-1)) y: ((((y) - (SCROLL Y)) * (-1)) + (50))\n    go to x: ((((x) - (SCROLL X)) * (-1)) + (30)) y: ((((y) - (SCROLL Y)) * (-1)) + (50))\n    go to x: ((((x) - (SCROLL X)) * (-1)) + (30)) y: ((((y) - (SCROLL Y)) * (-1)) + (30))\n    go to x: ((((x) - (SCROLL X)) * (-1)) + (0)) y: ((((y) - (SCROLL Y)) * (-1)) + (30))\nelse\n    set pen color to (#39bb02)\n    if <<<((SCROLL X) - (x)) < [40]> and <[-40] < ((SCROLL X) - (x))>> and <<((SCROLL Y) - (y)) < [50]> and <[-50] < ((SCROLL Y) - (y))>>> then\n        set [spawn x v] to (x)\n        set [spawn y v] to (y)\n        set [end v] to [:\)]\n        set pen color to (#39bb02)\n    end\n    pen up\n    go to x: (((x) - (SCROLL X)) * (-1)) y: (((y) - (SCROLL Y)) * (-1))\n    pen down\n    go to x: (((x) - (SCROLL X)) * (-1)) y: ((((y) - (SCROLL Y)) * (-1)) + (50))\n    go to x: ((((x) - (SCROLL X)) * (-1)) + (30)) y: ((((y) - (SCROLL Y)) * (-1)) + (50))\n    go to x: ((((x) - (SCROLL X)) * (-1)) + (30)) y: ((((y) - (SCROLL Y)) * (-1)) + (30))\n    go to x: ((((x) - (SCROLL X)) * (-1)) + (0)) y: ((((y) - (SCROLL Y)) * (-1)) + (30))\nend\n\nwhen I receive [setup v]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset [spawn x v] to [0]\nset [spawn y v] to [0]\nset [time v] to [0.00]\n\ndefine render thumb\nrender player [0]\nrender ground thumb\n\ndefine render ground thumb\ndelete all platform data\nadd rectangle (((mouse x) - (-2600)) / (-3)) (((mouse y) - (-1250)) / (-3)) [700] [378] [1] x / y / x size / y size / type\nadd rectangle (((mouse x) - (-500)) / (-3)) (((mouse y) - (-300)) / (-3)) [100] [61] [3] x / y / x size / y size / type\nadd rectangle (((mouse x) - (-200)) / (-3)) (((mouse y) - (-300)) / (-3)) [100] [61] [2] x / y / x size / y size / type\nadd rectangle (((mouse x) - (100)) / (-3)) (((mouse y) - (-300)) / (-3)) [84] [61] [1] x / y / x size / y size / type\nCHECKPOINT AT (((mouse x) - (200)) / (3)) (((mouse y) - (-130)) / (3)) END: []\nrender level\n\nwhen I receive [check up v]\nforever\n    if <(mobile mode?) = [0]> then\n        if <(key up?) = [0]> then\n            wait until <not <<key (up arrow v) pressed?> or <key (w v) pressed?>>>\n            wait until <<key (up arrow v) pressed?> or <key (w v) pressed?>>\n            set [key up? v] to [1]\n        else\n            if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                set [key up? v] to [1]\n            else\n                set [key up? v] to [0]\n            end\n        end\n    else\n        if <(key up?) = [0]> then\n            wait until <not <<mouse down?> and <[10] < (mouse y)>>>\n            wait until <<mouse down?> and <[10] < (mouse y)>>\n            set [key up? v] to [1]\n        else\n            if <<mouse down?> and <[10] < (mouse y)>> then\n                set [key up? v] to [1]\n            else\n                set [key up? v] to [0]\n            end\n        end\n    end\nend\n\ndefine springs\nset [# v] to [1]\nAdd Springs\nbroadcast (# of springs v)\n\ndefine add spring at (x) (y)\nif <(item (#) of [springs v]) = [1]> then\n    go to x: ((SCROLL X) - (x)) y: (((SCROLL Y) - (y)) + (([sin v] of ((timer) * (200)) ) * (13)))\n    set pen color to (#848484)\n    set pen size to (4)\n    pen down\n    repeat (1)\n        change x by (10)\n        change y by (6)\n        change x by (-10)\n        change y by (6)\n        change x by (10)\n        change y by (6)\n        change x by (-10)\n    end\n    pen up\n    check if collected (x) (y)\nend\nchange [# v] by (1)\n\ndefine setup springs (#)\ndelete all of [springs v]\nset [!springs collected! v] to [0]\nset [!max springs! v] to [0]\nif <(level) = [1]> then\n    Set # of Springs [7]\nend\nif <(level) = [2]> then\n    Set # of Springs [7]\nend\nif <(level) = [3]> then\n    Set # of Springs [8]\nend\nif <(level) = [4]> then\n    Set # of Springs [4]\nend\nif <(level) = [5]> then\n    Set # of Springs [5]\nend\n\ndefine check if collected (x) (y)\nif <<<((SCROLL X) - (x)) < [20]> and <[-20] < ((SCROLL X) - (x))>> and <<((SCROLL Y) - (y)) < [20]> and <[-20] < ((SCROLL Y) - (y))>>> then\n    replace item (#) of [springs v] with [0]\n    change [!springs collected! v] by (1)\nend\n\nwhen I receive [tick v]\nif <(start time) = [1]> then\n    change [time v] by (0.03)\nend\nbroadcast (time v)\nif <<key (q v) pressed?> and <key (r v) pressed?>> then\n    broadcast (start game v)\nend\nif <key (r v) pressed?> then\n    set [end v] to [:\(]\nend\n\nwhen I receive [home v]\nreset timer\nset [level v] to [1]\nbroadcast (setup v)\nbroadcast (home buttons v)\nforever\n    erase all\n    render grid ((mouse x) * (-1)) ((mouse y) * (-1))\n    render thumb\n    if < (|PART|) contains [Level Select]?> then\n        broadcast (records v)\n    end\nend\n\ndefine record!? (level)\nchange [!all springs collected! v] by (!SPRINGS COLLECTED!)\nif <<(TIME) < (item (((level) * (2)) - (0)) of [records v])> or <(item (((level) * (2)) - (0)) of [records v]) = []>> then\n    broadcast (NEW RECORD!!! v) and wait\nend\nif <(!SPRINGS COLLECTED!) = (!MAX SPRINGS!)> then\n    if <<(TIME) < (item ((level) * (2)) of [records all v])> or <(item ((level) * (2)) of [records all v]) = []>> then\n        broadcast (NEW RECORD!!!  ALL v) and wait\n    end\nend\n\ndefine special level\ndelete all of [stages v]\nif <(level) = [1]> then\n    repeat (8)\n        add [1] to [stages v]\n    end\nend\nif <(level) = [2]> then\n    repeat (2)\n        add [1] to [stages v]\n    end\nend\nif <(level) = [3]> then\n    repeat (4)\n        add [1] to [stages v]\n    end\nend\nif <(level) = [4]> then\n    repeat (1)\n        add [1] to [stages v]\n    end\nend\n\ndefine Extra\nupdate collisions\nif <[collisions v] contains [2]?> then\n    RESET GAME\nend\nupdate collisions\nif <[collisions v] contains [3]?> then\n    set [yv v] to [20]\nend\nupdate collisions\nchange [y pos v] by (1)\nupdate collisions\nif <[2] < (fall off)> then\n    RESET GAME\nend\n\ndefine Add Springs\nif <(level) = [1]> then\n    add spring at [-1085] [330]\n    add spring at [-190] [40]\n    add spring at [-1225] [320]\n    add spring at [-1700] [200]\n    add spring at [-2265] [200]\n    add spring at [-2045] [200]\n    add spring at [-2920] [-280]\nend\nif <(level) = [2]> then\n    add spring at [125] [-100]\n    add spring at [-125] [-100]\n    add spring at [-945] [-190]\n    add spring at [-1445] [-280]\n    add spring at [-1550] [-400]\n    add spring at [-2050] [-620]\n    add spring at [-1750] [-500]\nend\nif <(level) = [3]> then\n    add spring at [-750] [100]\n    add spring at [300] [0]\n    add spring at [880] [-200]\n    add spring at [1270] [-200]\n    add spring at [1030] [-365]\n    add spring at [1290] [-500]\n    add spring at [1885] [-900]\n    add spring at [200] [0]\nend\nif <(level) = [4]> then\n    add spring at [-194] [-100]\n    add spring at [-294] [450]\n    add spring at [-642] [450]\n    add spring at [-1390] [250]\nend\nif <(level) = [5]> then\n    add spring at [-1545] [-750]\n    add spring at [-1500] [-750]\n    add spring at [-190] [-550]\n    add spring at [-440] [-530]\n    add spring at [-1220] [-700]\nend\n\ndefine Set # of Springs (#)\nrepeat (#)\n    change [!max springs! v] by (1)\n    add [1] to [springs v]\nend\n\nset [!all springs collected! v] to [25]\n\ndefine level 6 movement\nif <(mobile mode?) = [0]> then\n    change [xv v] by ((<<key (right arrow v) pressed?> or <key (d v) pressed?>> - <<key (left arrow v) pressed?> or <key (a v) pressed?>>) * (0.9))\n    if <(start time) = [0]> then\n        if <key (any v) pressed?> then\n            set [start time v] to [1]\n        end\n    end\nelse\n    change [xv v] by ((<<mouse down?> and <[10] < (mouse x)>> - <<mouse down?> and <(mouse x) < [10]>>) * (0.9))\n    if <(start time) = [0]> then\n        if <mouse down?> then\n            set [start time v] to [1]\n        end\n    end\nend\nset [xv v] to ((Xv) * (0.9))\nchange [x pos v] by (Xv)\nupdate collisions\nif <[collisions v] contains [2]?> then\n    RESET GAME\nend\n\nwhen flag clicked\nset [!all springs collected! v] to [0]\n\nset [!all springs collected! v] to [25]\n\n@Buttons\n\nwhen I receive [home buttons v]\nwait (0) seconds\nshow\nclear graphic effects\nswitch costume to (level select v)\ncreate clone of (_myself_ v)\nswitch costume to (settings v)\ncreate clone of (_myself_ v)\nswitch costume to (title v)\n\nwhen I start as a clone\nset [id v] to (costume [number v])\nforever\n    go to [front v] layer\n    if <not <<(ID) = [5]> or <[17] < (ID)>>> then\n        if <(ID) = [8]> then\n            switch costume to ((ID) + (mobile mode?))\n            go to [front v] layer\n        else\n            if <touching (mouse-pointer v)?> then\n                set [brightness v] effect to (-4)\n                switch costume to ((ID) + (1))\n                if <mouse down?> then\n                    wait until <not <mouse down?>>\n                    if <(ID) = [6]> then\n                        if <(mobile mode?) = [0]> then\n                            set [mobile mode? v] to [1]\n                        else\n                            set [mobile mode? v] to [0]\n                        end\n                    else\n                        switch costume to (ID)\n                        if <(costume [name v]) = [start game]> then\n                            if <(level) = [6]> then\n                                if <[24] < (!ALL SPRINGS COLLECTED!)> then\n                                    broadcast (costume [name v])\n                                end\n                            else\n                                broadcast (costume [name v])\n                            end\n                        else\n                            broadcast (costume [name v])\n                        end\n                        switch costume to ((ID) + (1))\n                    end\n                end\n            else\n                switch costume to (ID)\n                set [brightness v] effect to (0)\n            end\n        end\n    end\nend\n\nwhen I receive [start game v]\nhide\ndelete this clone\n\nwhen I receive [settings v]\nwait (0) seconds\nshow\nclear graphic effects\nswitch costume to (mobile v)\ncreate clone of (_myself_ v)\nswitch costume to (mobile option v)\ncreate clone of (_myself_ v)\nswitch costume to (mobile or not?2 v)\ncreate clone of (_myself_ v)\nswitch costume to (home v)\ncreate clone of (_myself_ v)\nswitch costume to (title v)\n\nwhen I receive [settings v]\nhide\ndelete this clone\n\nwhen flag clicked\nset [mobile mode? v] to [0]\n\nwhen I receive [home v]\nhide\ndelete this clone\n\nwhen I receive [level select v]\nhide\ndelete this clone\n\nwhen I receive [level select v]\nwait (0) seconds\nshow\nclear graphic effects\nswitch costume to (arrow r v)\ncreate clone of (_myself_ v)\nswitch costume to (arrow l v)\ncreate clone of (_myself_ v)\nswitch costume to (level pic 1 v)\ncreate clone of (_myself_ v)\nswitch costume to (start game v)\ncreate clone of (_myself_ v)\nswitch costume to (title v)\nbroadcast (generate records v) and wait\n\nwhen I receive [arrow r v]\nchange [level v] by (0.2)\nif <[6] < (level)> then\n    set [level v] to [6]\nend\nbroadcast (generate records v) and wait\nwait (0) seconds\nset [level v] to (round (level))\n\nwhen I receive [arrow l v]\nchange [level v] by (-0.2)\nif <(level) < [1]> then\n    broadcast (home v)\nend\nbroadcast (generate records v) and wait\nwait (0) seconds\nset [level v] to (round (level))\n\nwhen I start as a clone\nif <[17] < (ID)> then\n    forever\n        switch costume to ((level) + (18))\n    end\nend\n\n@Chars\n\nwhen flag clicked\nset [message? v] to [0]\nhide\n\ndefine decode (stuff)\nset [timer v] to [0]\nset [decoded v] to []\nset [## v] to [1]\nset [idx v] to []\nrepeat (length of (stuff))\n    set [idx v] to (join (letter (##) of (stuff)) (letter ((##) + (1)) of (stuff)))\n    if <(idx) = [00]> then\n        if <(timer) = [0]> then\n            add (decoded) to [records v]\n            set [decoded v] to []\n        else\n            set [decoded v] to []\n            set [timer v] to [0]\n        end\n    else\n        set [decoded v] to (join (decoded) (item (idx) of [chars v]))\n        if <(item (idx) of [chars v]) = [.]> then\n            repeat (2)\n                change [## v] by (2)\n                set [idx v] to (join (letter (##) of (stuff)) (letter ((##) + (1)) of (stuff)))\n                set [decoded v] to (join (decoded) (item (idx) of [chars v]))\n            end\n            add (decoded) to [records v]\n            set [timer v] to [1]\n        end\n    end\n    change [## v] by (2)\nend\n\nwhen I receive [generate records v]\ndelete all of [records v]\ndelete all of [records all v]\ndecode (☁ 1)\ndecode all (☁ 3)\n\ndefine generate (#) (x) (y)\nset [# v] to [1]\ngo to x: (x) y: (y)\nrepeat (length of (item (#) of [records v]))\n    switch costume to (letter (#) of (item (#) of [records v]))\n    stamp\n    change [# v] by (1)\n    change x by (15)\n    if <[0] < (x)> then\n        if <touching (_edge_ v)?> then\n            go to x: (x) y: ((y) - (25))\n        end\n    else\n        if <[-100] < (x position)> then\n            go to x: (x) y: ((y) - (25))\n        end\n    end\nend\n\nwhen I receive [records v]\nif <(level) = [6]> then\n    set [# v] to [1]\n    go to x: (-30) y: (30)\n    time (!ALL SPRINGS COLLECTED!)\n    set [# v] to [1]\n    time [/]\n    set [# v] to [1]\n    time [25]\n    if <[24] < (!ALL SPRINGS COLLECTED!)> then\n        set [# v] to [1]\n        go to x: (-55) y: (-60)\n        time [unlocked]\n    else\n        set [# v] to [1]\n        go to x: (-40) y: (-60)\n        time [locked]\n    end\nelse\n    broadcast (generate records v)\n    show\n    clear graphic effects\n    generate (((level) * (2)) - (1)) [-217] [34]\n    generate (((level) * (2)) - (0)) [-217] [-26]\n    generate all (((level) * (2)) - (1)) [120] [34]\n    generate all (((level) * (2)) - (0)) [120] [-26]\n    hide\n    if <(message?) = [1]> then\n        go to x: (-185) y: (170)\n        set [brightness v] effect to (10)\n        set [# v] to [1]\n        time [you recorded a new record]\n        clear graphic effects\n    end\nend\n\nwhen I receive [time v]\nshow\ngo to x: (-215) y: (-155)\nset [# v] to [1]\ntime (TIME)\nhide\n\ndefine time (time)\nrepeat (length of (time))\n    switch costume to (letter (#) of (time))\n    stamp\n    change [# v] by (1)\n    change x by (15)\n    if <(letter (#) of (time)) = [.]> then\n        repeat (3)\n            switch costume to (letter (#) of (time))\n            stamp\n            change [# v] by (1)\n            change x by (15)\n        end\n        stop [this script v]\n    end\nend\n\nwhen I receive [# of springs v]\nshow\ngo to x: (-215) y: (155)\nset [# v] to [1]\ntime (!SPRINGS COLLECTED!)\nset [# v] to [1]\ntime [/]\nset [# v] to [1]\ntime (!MAX SPRINGS!)\nhide\n\nwhen I receive [new record!!! v]\nset [encoded v] to []\nset [### v] to [1]\nrepeat ((level) - (1))\n    repeat (2)\n        encode (item (###) of [records v])\n        change [### v] by (1)\n    end\nend\nencode (username)\nchange [### v] by (1)\nencode (TIME)\nchange [### v] by (1)\nrepeat ((5) - (level))\n    repeat (2)\n        encode (item (###) of [records v])\n        change [### v] by (1)\n    end\nend\nset cloud var [1]\nbroadcast (generate records v) and wait\nbroadcast (Congrats Message v)\n\ndefine encode (info)\nset [## v] to [1]\nset [idx v] to []\nrepeat (length of (info))\n    set [encoded v] to (join (encoded) (item # of (letter (##) of (info)) in [chars v]))\n    change [## v] by (1)\n    if <(letter (##) of (info)) = [.]> then\n        repeat (3)\n            set [encoded v] to (join (encoded) (item # of (letter (##) of (info)) in [chars v]))\n            change [## v] by (1)\n        end\n        set [encoded v] to (join (encoded) [00])\n        stop [this script v]\n    end\nend\nset [encoded v] to (join (encoded) [00])\n\ndefine set cloud var (#)\nrepeat (10)\n    if <(#) = [1]> then\n        set [☁ 1 v] to (encoded)\n    else\n        if <(#) = [2]> then\n            set [☁ 2 v] to (encoded)\n        else\n            set [☁ 3 v] to (encoded)\n        end\n    end\nend\n\nwhen I receive [new record!!!  all v]\nset [encoded v] to []\nset [### v] to [1]\nrepeat ((level) - (1))\n    repeat (2)\n        encode (item (###) of [records all v])\n        change [### v] by (1)\n    end\nend\nencode (username)\nchange [### v] by (1)\nencode (TIME)\nchange [### v] by (1)\nrepeat ((5) - (level))\n    repeat (2)\n        encode (item (###) of [records all v])\n        change [### v] by (1)\n    end\nend\nset cloud var [3]\nbroadcast (generate records v) and wait\nbroadcast (Congrats Message v)\n\ndefine read cloud var (#)\nrepeat (10)\n    if <(#) = [1]> then\n        set [val v] to (☁ 1)\n    else\n        if <(#) = [2]> then\n            set [val v] to (☁ 2)\n        else\n            set [val v] to (☁ 3)\n        end\n    end\nend\n\nset [level v] to [1]\n\nbroadcast (NEW RECORD!!! v)\n\ndefine decode all (stuff)\nset [timer v] to [0]\nset [decoded v] to []\nset [## v] to [1]\nset [idx v] to []\nrepeat (length of (stuff))\n    set [idx v] to (join (letter (##) of (stuff)) (letter ((##) + (1)) of (stuff)))\n    if <(idx) = [00]> then\n        if <(timer) = [0]> then\n            add (decoded) to [records all v]\n            set [decoded v] to []\n        else\n            set [decoded v] to []\n            set [timer v] to [0]\n        end\n    else\n        set [decoded v] to (join (decoded) (item (idx) of [chars v]))\n        if <(item (idx) of [chars v]) = [.]> then\n            repeat (2)\n                change [## v] by (2)\n                set [idx v] to (join (letter (##) of (stuff)) (letter ((##) + (1)) of (stuff)))\n                set [decoded v] to (join (decoded) (item (idx) of [chars v]))\n            end\n            add (decoded) to [records all v]\n            set [timer v] to [1]\n        end\n    end\n    change [## v] by (2)\nend\n\ndefine generate all (#) (x) (y)\nset [# v] to [1]\ngo to x: (x) y: (y)\nrepeat (length of (item (#) of [records all v]))\n    switch costume to (letter (#) of (item (#) of [records all v]))\n    stamp\n    change [# v] by (1)\n    change x by (15)\n    if <touching (_edge_ v)?> then\n        go to x: (x) y: ((y) - (25))\n    end\nend\n\nbroadcast (NEW RECORD!!!  ALL v)\n\nset [level v] to [4]\n\nset [level v] to [5]\n\nwhen I receive [congrats message v]\nset [message? v] to [1]\n\nwhen I receive [level select v]\nif <(message?) = [1]> then\n    wait (5) seconds\n    set [message? v] to [0]\nend\n\n@Animation\n\nwhen flag clicked\nhide\n\nwhen I receive [animation v]\ngo to [front v] layer\nswitch costume to (1 v)\nshow\nwait (1) seconds\nrepeat (21)\n    next costume\n    wait (0.05) seconds\nend\nwait (1) seconds\nhide\ngo to [back v] layer\n\n@Win\n\nwhen flag clicked\nhide\n\nwhen I receive [win v]\nshow\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nrepeat until <key (space v) pressed?>\n    go to [front v] layer\nend\nbroadcast (home v)\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\n@Music\n\nwhen flag clicked\nforever\n    play sound [Tetris \(1984\) - Main Theme v] until done\nend\n\n