Cubeland: Super Scrolling Platformer :)

Instructions: All in project\n\n@timmccool loved

@Stage\n\nwhen stage clicked\nset [mouse v] to (join ((mouse x) + (SCROLLX)) (join [     ] ((mouse y) + (SCROLLY))))\n\nwhen flag clicked\nswitch backdrop to (select v)\nbroadcast (end intro v)\nwait (1) seconds\nbroadcast (menu v)\n\nwhen I receive [menu v]\nwait (1) seconds\nswitch backdrop to (select v)\n\nwhen I receive [shop v]\nwait (1) seconds\nswitch backdrop to (shop v)\n\nwhen I receive [level maps v]\nwait (1) seconds\nswitch backdrop to (maps v)\n\nwhen I receive [play game v]\nswitch backdrop to (sky v)\n\nwhen flag clicked\ndelete all of [@used objects v]\n\nwhen I receive [play game v]\ndelete all of [@used objects v]\n\nwhen I receive [credits v]\nwait (1) seconds\nswitch backdrop to (stuff v)\n\nset [exit v] to [win]\n\n@blank\n\n@coins\n\nwhen I receive [tick v]\nposition ((x) - (SCROLLX)) ((y) - (SCROLLY))\n\nwhen I receive [reset v]\nclear graphic effects\nset [x v] to [-1000]\nset [y v] to [0]\ndelete this clone\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\nif <(costume [number v]) = [8]> then\n    change size by (5)\n    change [ghost v] effect by (10)\nelse\n    change [coincostume v] by (0.5)\n    if <(coincostume) = [7]> then\n        set [coincostume v] to [1]\n    end\n    switch costume to (coincostume)\n    if <touching (player v)?> then\n        switch costume to (coinend v)\n        start sound [coin v]\n        change [collected v] by (1)\n        add (x) to [@used objects v]\n        add (y) to [@used objects v]\n    end\nend\n\nwhen I receive [setup v]\nset size to (80) %\nswitch costume to (coin1 v)\nif <(LEVEL) = [1]> then\n    clone at [320] [-30]\n    clone at [450] [50]\n    clone at [500] [50]\n    clone at [550] [50]\n    clone at [600] [50]\n    clone at [812] [50]\n    clone at [1000] [125]\n    clone at [1525] [50]\n    clone at [1525] [100]\n    clone at [1525] [150]\n    clone at [1525] [200]\n    clone at [1284] [350]\n    clone at [1111] [370]\n    clone at [971] [444]\n    clone at [866] [550]\n    clone at [1009] [640]\n    clone at [1090] [700]\n    clone at [1145] [722]\n    clone at [1334] [850]\n    clone at [1422] [890]\n    clone at [1800] [1020]\n    clone at [1900] [1020]\n    clone at [2000] [1020]\n    clone at [2100] [1020]\n    clone at [2200] [1020]\n    clone at [2300] [1020]\n    clone at [2528] [1104]\n    clone at [2660] [1250]\n    clone at [2570] [1550]\n    clone at [2736] [1614]\nelse\n    clone at [165] [0]\n    clone at [250] [0]\n    clone at [300] [75]\n    clone at [400] [50]\n    clone at [400] [90]\n    clone at [650] [90]\n    clone at [700] [120]\n    clone at [740] [120]\n    clone at [780] [80]\n    clone at [800] [0]\n    clone at [960] [0]\n    clone at [960] [50]\n    clone at [1000] [150]\n    clone at [1050] [200]\n    clone at [1100] [150]\n    clone at [1150] [75]\n    clone at [2240] [0]\n    clone at [2240] [-50]\n    clone at [2240] [-100]\n    clone at [2300] [-100]\n    clone at [2350] [-100]\n    clone at [2400] [-100]\n    clone at [2450] [-100]\n    clone at [2500] [-100]\n    clone at [2414] [65]\n    clone at [2766] [125]\n    clone at [2920] [125]\n    clone at [3000] [60]\n    clone at [3050] [60]\n    clone at [3100] [60]\n    clone at [3164] [50]\n    clone at [3282] [-50]\n    clone at [3400] [40]\n    clone at [3450] [40]\n    clone at [3500] [95]\n    clone at [3550] [95]\n    clone at [3600] [50]\n    clone at [3600] [0]\n    clone at [3600] [-50]\n    clone at [3525] [120]\nend\nset [x v] to [-1000]\nset [y v] to [0]\n\ndefine clone at (x) (y)\nif <not <<[@used objects v] contains (x)?> and <[@used objects v] contains (y)?>>> then\n    set [coincostume v] to [0]\n    set [x v] to (x)\n    set [y v] to (y)\n    create clone of (_myself_ v)\nend\n\nwhen flag clicked\nset [collected v] to [0]\n\nif <not <key (any v) pressed?>> then\n\nwhen flag clicked\nhide\n\nbroadcast (Setup v)\n\nswitch costume to (coin1 v)\n\n@items\n\ndefine position (x) (y)\ngo to [front v] layer\ngo to x: (x) y: (y)\nset size to (100) %\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\nif <<<touching (player v)?> and <(costume [number v]) = [1]>> and <(y speed) < [0]>> then\n    start sound [collect v]\n    change [health v] by (1)\n    delete this clone\nend\nif <<<touching (player v)?> and <(costume [number v]) = [2]>> and <(y speed) < [0]>> then\n    start sound [collect v]\n    change [collected v] by (10)\n    delete this clone\nend\n\nif <(health) < [3]> then\n\nwhen I receive [tick v]\nposition ((x) - (SCROLLX)) ((y) - (SCROLLY))\n\nwhen I receive [reset v]\nset [x v] to [-1000]\nset [y v] to [0]\ndelete this clone\n\nwhen I receive [create special box item v]\nset [x v] to (item (1) of [surprise box v])\nset [y v] to (item (2) of [surprise box v])\nswitch costume to (item (3) of [surprise box v])\ncreate clone of (_myself_ v)\nset [x v] to [-1000]\nset [y v] to [0]\ndelete all of [surprise box v]\n\nwhen I start as a clone\nset [y speed v] to [12]\nrepeat until <touching (platform v)?>\n    change [y v] by (y speed)\n    change [y speed v] by (-1)\nend\nrepeat until <not <touching (platform v)?>>\n    change [y v] by (1)\nend\n\nif <(health) < [3]> then\n    change [health v] by (1)\nend\n\n@checkpoint\n\ndefine position (x) (y)\ngo to [back v] layer\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\nturn right (((90) - (direction)) / (5)) degrees\nif <<(item (1) of [checkpoint v]) = (x)> and <(item (2) of [checkpoint v]) = (y)>> then\n    switch costume to (yes v)\nelse\n    switch costume to (no v)\n    if <touching (player v)?> then\n        start sound [flag v]\n        reset timer\n        set [health v] to [4]\n        point in direction (120)\n        delete all of [checkpoint v]\n        add (x) to [checkpoint v]\n        add (y) to [checkpoint v]\n    end\nend\n\nwhen I receive [setup v]\nif <(LEVEL) = [1]> then\n    create clone at X: [1725] Y: [1020]\n    create clone at X: [2515] Y: [1525]\nelse\n    create clone at X: [1170] Y: [-50]\n    create clone at X: [3023] Y: [60]\nend\ncreate clone at X: [-1000000] Y: [0]\n\nwhen I receive [tick v]\nposition ((x) - (SCROLLX)) ((y) - (SCROLLY))\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine create clone at X: (xpos) Y: (ypos)\nset [x v] to (xpos)\nset [y v] to (ypos)\ncreate clone of (_myself_ v)\n\nwhen I receive [green flag v]\nhide\n\nbroadcast (tick v)\n\n@yay\n\nwhen I receive [course clear v]\nhide\nset [id v] to [1]\nclone [10]\nset [id v] to [2]\nclone [10]\n\ndefine clone (number or text)\nrepeat (number or text)\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nforever\n    show\n    go to [front v] layer\n    go [forward v] (1) layers\nend\n\nwhen I start as a clone\nif <(ID) = [1]> then\n    set x to (-50)\n    set y to (-500)\nend\nif <(ID) = [2]> then\n    set x to (50)\n    set y to (-500)\nend\n\nif  then\nelse\n    if <(ID) = [2]> then\n        set x to (250)\n        set y to (-500)\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nwait (0.1) seconds\nif <<(ID) = [1]> or <(ID) = [2]>> then\n    boom eff (pick random (-5.0) to (5.0)) (pick random (10.0) to (27.0))\nelse\n    boom eff (pick random (-5.0) to (5.0)) (pick random (10.0) to (15.0))\nend\n\ndefine boom eff (random) (gravity)\nif <(ID) = [3]> then\n    switch costume to (confetti v)\nelse\n    switch costume to (pick random (1) to (6))\nend\nset [clone v] to (gravity)\nrepeat (5)\n    change [clone v] by (-1)\n    change x by (random)\n    change y by (clone)\n    turn right (random) degrees\nend\nrepeat until <(y position) < [-175]>\n    change [clone v] by (-1)\n    change x by (random)\n    change y by (clone)\n    turn right (random) degrees\nend\ndelete this clone\n\nif  then\n\nwhen I start as a clone\nif <not <(ID) = [3]>> then\n    wait (0.8) seconds\n    set [id v] to [3]\n    clone [50]\nend\n\nwait until <(clone) < [0]>\n\n@Sprite2\n\nwhen flag clicked\nhide\nwait (2.5) seconds\nforever\n    show\n    go to [front v] layer\n    hide variable [collected v]\nend\n\nwhen I receive [tick v]\nshow\n\n@boxes\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nswitch costume to ((used) + (1))\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\ndefine create clone at X: (xpos) Y: (ypos)\nif <<[@used objects v] contains (xpos)?> and <[@used objects v] contains (ypos)?>> then\n    set [used v] to [1]\nelse\n    set [used v] to [0]\nend\nset [x v] to (xpos)\nset [y v] to (ypos)\ncreate clone of (_myself_ v)\n\nwhen I receive [tick v]\nposition ((x) - (SCROLLX)) ((y) - (SCROLLY))\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen I receive [bounce player v]\n\nwhen I receive [setup v]\ndelete all of [surprise box v]\nif <(LEVEL) = [1]> then\n    create clone at X: [1187] Y: [235]\n    create clone at X: [2887] Y: [1666]\nelse\n    create clone at X: [2050] Y: [170]\nend\ncreate clone at X: [-1000000] Y: [0]\n\nwhen I receive [check block v]\nif <<touching (player v)?> and <(used) = [0]>> then\n    set [used v] to [1]\n    delete all of [surprise box v]\n    add (x) to [surprise box v]\n    add (y) to [surprise box v]\n    add [2] to [surprise box v]\n    add (x) to [@used objects v]\n    add (y) to [@used objects v]\n    broadcast (create special box item v)\nend\n\nwhen I receive [green flag v]\nhide\n\n@shop\n\nwhen I receive [end intro v]\nhide\n\nwhen flag clicked\nset [skin v] to [1]\ndelete all of [skins unlocked v]\nadd [000normal] to [skins unlocked v]\nhide\n\nwhen I receive [level maps v]\nhide\n\nwhen I receive [menu v]\nhide\ndelete this clone\n\nwhen I receive [shop v]\nwait (1) seconds\nhide\nswitch costume to (000normal v)\nclear graphic effects\nclone at [-150] [50]\nclone at [-50] [50]\nclone at [50] [50]\nclone at [150] [50]\n\ndefine clone at (x) (y)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\nnext costume\n\nwhen I start as a clone\nshow\nforever\n    if <[skins unlocked v] contains (costume [name v])?> then\n        set [brightness v] effect to (0)\n    else\n        set [brightness v] effect to (-80)\n    end\n    if <(skin) = (costume [number v])> then\n        change size by (((110) - (size)) / (7))\n    else\n        change size by (((90) - (size)) / (7))\n    end\nend\n\nwhen I start as a clone\nforever\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        if <[skins unlocked v] contains (costume [name v])?> then\n            set [skin v] to (costume [number v])\n        else\n            unlocktest (join (letter (1) of (costume [name v])) (join (letter (2) of (costume [name v])) (letter (3) of (costume [name v]))))\n        end\n    end\nend\n\ndefine unlocktest (number or text)\nif <(collected) > ((number or text) - (0.5))> then\n    start sound [unlock v]\n    add (costume [name v]) to [skins unlocked v]\n    set [skin v] to (costume [number v])\n    change [collected v] by ((number or text) * (-1))\nelse\n    start sound [error v]\nend\n\n@level buttons\n\nwhen flag clicked\nhide\n\nwhen I receive [end intro v]\nhide\n\nwhen I receive [menu v]\nhide\ndelete this clone\n\nwhen I receive [shop v]\nhide\n\nwhen I receive [level maps v]\nwait (1) seconds\nswitch costume to (meadows v)\nclone at [50]\nclone at [-50]\n\ndefine clone at (y)\ngo to x: (0) y: (y)\ncreate clone of (_myself_ v)\nnext costume\n\nwhen I start as a clone\nshow\n\nwhen I start as a clone\nforever\n    if <touching (mouse-pointer v)?> then\n        if <mouse down?> then\n            change size by (((70) - (size)) / (7))\n        else\n            change size by (((110) - (size)) / (7))\n        end\n    else\n        change size by (((90) - (size)) / (7))\n    end\nend\n\nwhen I start as a clone\nforever\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        set [level v] to (costume [number v])\n        broadcast (level selected v)\n    end\nend\n\nwhen I receive [level selected v]\nrepeat (10)\n    change size by (((0) - (size)) / (5))\nend\nhide\ndelete this clone\n\n@flag\n\nwhen I receive [tick v]\nposition ((x) - (SCROLLX)) ((y) - (SCROLLY))\n\ndefine position (x) (y)\ngo to [back v] layer\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [setup v]\nif <(LEVEL) = [1]> then\n    set [x v] to [3170]\n    set [y v] to [1550]\nelse\n    set [x v] to [3850]\n    set [y v] to [-108]\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [green flag v]\nhide\n\n@fade\n\nwhen flag clicked\nhide\nclear graphic effects\n\nwhen I receive [remove clones v]\nswitch costume to (load v)\ngo to x: (0) y: (0)\nclear graphic effects\ngo to x: (0) y: (0)\nset size to (1) %\nset [ghost v] effect to (100)\nset [pixelate v] effect to (100)\nshow\nrepeat (25)\n    change size by (((110) - (size)) / (7))\n    change [pixelate v] effect by (-4)\n    change [ghost v] effect by (-10)\nend\nrepeat (25)\n    change size by (((110) - (size)) / (7))\n    change [ghost v] effect by (-10)\nend\nrepeat (10)\n    change size by (((0) - (size)) / (4))\n    change [ghost v] effect by (10)\n    change [pixelate v] effect by (10)\nend\nclear graphic effects\nhide\n\nwhen I receive [end intro v]\nswitch costume to (blank v)\nclear graphic effects\nset size to (100) %\ngo to x: (0) y: (0)\ngo to [front v] layer\nclear graphic effects\nshow\nrepeat (50)\n    switch costume to (blank v)\n    change [ghost v] effect by (2)\nend\nclear graphic effects\nhide\n\nwhen I receive [level selected v]\nswitch costume to (load v)\ngo to x: (0) y: (0)\nclear graphic effects\ngo to x: (0) y: (0)\nset size to (1) %\nset [ghost v] effect to (100)\nset [pixelate v] effect to (100)\nshow\nrepeat (25)\n    change size by (((110) - (size)) / (7))\n    change [pixelate v] effect by (-4)\n    change [ghost v] effect by (-10)\nend\nrepeat (25)\n    change size by (((110) - (size)) / (7))\n    change [ghost v] effect by (-10)\nend\nbroadcast (play game v)\nhide\nclear graphic effects\n\nwhen I receive [level complete! v]\nswitch costume to (level v)\ngo to x: (0) y: (0)\nclear graphic effects\ngo to x: (0) y: (0)\nset size to (100) %\nset [ghost v] effect to (100)\nset [pixelate v] effect to (50)\nshow\nbroadcast (level maps v)\nrepeat (25)\n    change [pixelate v] effect by (-2)\n    change [ghost v] effect by (-10)\nend\nrepeat (25)\n    change size by (((100) - (size)) / (7))\n    change [ghost v] effect by (-10)\nend\nhide\nclear graphic effects\n\nwhen I receive [black v]\nset size to (100) %\ngo to x: (0) y: (0)\ngo to [front v] layer\nclear graphic effects\nswitch costume to (load v)\nshow\n\nwhen I receive [game start v]\nset size to (100) %\ngo to x: (0) y: (0)\ngo to [front v] layer\nclear graphic effects\nswitch costume to (load v)\nhide\n\n@health thing\n\nwhen I receive [tick v]\nswitch costume to (join [health] (health))\nshow\nset y to (120)\ngo to [front v] layer\nif <(timer) > [4]> then\n    change [ghost v] effect by (10)\n    change x by (((-300) - (x position)) / (6))\nelse\n    change [ghost v] effect by (-10)\n    change x by (((-180) - (x position)) / (6))\nend\n\nwhen I receive [green flag v]\nhide\nclear graphic effects\n\nwhen I receive [setup v]\nstop [other scripts in sprite v]\nreset timer\nhide\nset x to (-180)\nset [ghost v] effect to (0)\n\nwhen I receive [die v]\nforever\n    switch costume to (health0 v)\n    change [ghost v] effect by (-10)\n    change x by (((-180) - (x position)) / (6))\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [menu v]\n\nhide\n\nwhen I receive [course clear v]\nhide\n\n@course clear\n\nwhen flag clicked\nhide\n\nwhen I receive [course clear v]\ngo to x: (-222) y: (50)\npoint in direction (45)\nset [ghost v] effect to (100)\nshow\nset size to (90) %\nrepeat (25)\n    turn right (((90) - (direction)) / (6)) degrees\n    change [ghost v] effect by (-4)\nend\nwait (2) seconds\nrepeat (10)\n    change y by (-10)\n    change [ghost v] effect by (10)\nend\nhide\nclear graphic effects\nwait (0.5) seconds\n\nwhen flag clicked\nforever\n    go to [front v] layer\nend\n\n@player\n\nwhen flag clicked\ngo to x: (0) y: (0)\nbroadcast (green flag v) and wait\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\n\nwhen I receive [play game v]\ndelete all of [@used objects v]\ndelete all of [checkpoint v]\nadd [0] to [checkpoint v]\nadd [0] to [checkpoint v]\nforever\n    broadcast (black v) and wait\n    switch costume to (hit v)\n    broadcast (Reset v) and wait\n    broadcast (Setup v) and wait\n    game on\n    set [health v] to [4]\n    set [hurt?? v] to [0]\n    reset timer\n    show\n    go to x: (0) y: (0)\n    clear graphic effects\n    set [exit v] to []\n    broadcast (game start v)\n    repeat until <<(EXIT) = [win]> or <(EXIT) = [end]>>\n        Tick\n        position\n        if <(EXIT) = [die]> then\n            ouch\n            if <(health) > [0]> then\n                set [exit v] to []\n            end\n        end\n        if <(skin) = [4]> then\n            change [color v] effect by (2)\n        end\n        broadcast (tick v)\n    end\n    if <(EXIT) = [end]> then\n        set [health v] to [0]\n        broadcast (die v)\n        reset timer\n        hide\n        clear graphic effects\n        wait (1) seconds\n        broadcast (black v) and wait\n        set [scrollx v] to (item (1) of [checkpoint v])\n        set [scrolly v] to (item (2) of [checkpoint v])\n        broadcast (tick v) and wait\n    end\n    if <(EXIT) = [win]> then\n        win\n        hide\n        wait (1) seconds\n        broadcast (green flag v)\n        broadcast (Level Complete! v)\n        hide\n        stop [this script v]\n    end\nend\n\nif <(skin) = [4]> then\n    change [color v] effect by (1)\nend\n\ndefine game on\nset [x v] to (item (1) of [checkpoint v])\nset [y v] to (item (2) of [checkpoint v])\nset [sy v] to [0]\nset [in air v] to [100000000000000000000000000000000000000000000000000]\nset [exit v] to []\nset [sx v] to [0]\nset [scrollx v] to (item (1) of [checkpoint v])\nset [scrolly v] to (item (2) of [checkpoint v])\nset [hurt?? v] to [0]\nbroadcast (tick v) and wait\nshow\n\ndefine Tick\nswitch costume to (hit v)\nsay []\nif <key (left arrow v) pressed?> then\n    change [sx v] by (-2)\nend\nif <key (right arrow v) pressed?> then\n    change [sx v] by (2)\nend\nset [sx v] to ((SX) * (0.8))\nif <([abs v] of (SX) ) > [0]> then\n    change x by (round (SX))\nend\nif <<key (up arrow v) pressed?> and <(in air) < [4]>> then\n    set [sy v] to [16]\nend\nchange [sy v] by (-2)\nif <(SY) < [-15]> then\n    set [sy v] to [-16]\nend\nChange y by (SY)\nchange [scrollx v] by (((x) - (SCROLLX)) / (8))\nif <[0] > (SCROLLX)> then\n    set [scrollx v] to [0]\nend\nchange [scrolly v] by (((y) - (SCROLLY)) / (8))\nif <[0] > (SCROLLY)> then\n    set [scrolly v] to [0]\nend\nif <[-175] > (y)> then\n    set [exit v] to [end]\nend\nif <touching color (#ff0000)?> then\n    set [exit v] to [die]\nend\nif <(x) < [-200]> then\n    set [x v] to [-200]\nend\ndie??\nset [scrollx v] to (round (SCROLLX))\nset [scrolly v] to (round (SCROLLY))\nswitch costume to (skin)\nif <touching color (#fcff00)?> then\n    set [sy v] to [35]\nend\nif <touching color (#ff0000)?> then\n    set [exit v] to [die]\nend\nif <touching (flag v)?> then\n    set [exit v] to [win]\nend\nif <touching color (#8dff9c)?> then\n    set [exit v] to [die]\nend\n\ndefine Change y by (gravity)\nchange [in air v] by (1)\nchange [y v] by (gravity)\nposition\ndie??\nrepeat until <not <<touching (platform v)?> or <<touching color (#efa100)?> or <touching color (#6b4700)?>>>>\n    if <(gravity) > [0]> then\n        change [y v] by (-1)\n        if <(gravity) > [0]> then\n            broadcast (check block v)\n        end\n    else\n        change [y v] by (1)\n        set [in air v] to [0]\n    end\n    set [sy v] to [0]\n    position\nend\n\ndefine position\ngo to x: ((x) - (SCROLLX)) y: ((y) - (SCROLLY))\n\ndefine change x by (sx)\nchange [x v] by (sx)\nposition\nif <<touching (platform v)?> or <<touching color (#efa100)?> or <touching color (#6b4700)?>>> then\n    repeat (12)\n        change [y v] by (1)\n        position\n        if <not <<touching (platform v)?> or <<touching color (#efa100)?> or <touching color (#6b4700)?>>>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-12)\n    repeat until <not <<touching (platform v)?> or <<touching color (#efa100)?> or <touching color (#6b4700)?>>>>\n        if <(sx) > [0]> then\n            change [x v] by (-1)\n        else\n            change [x v] by (1)\n        end\n        position\n    end\nend\n\ndefine ouch\nif <(hurt??) = [0]> then\n    broadcast (hurt v)\n    reset timer\nend\n\ndefine die??\nif <<touching (lava v)?> or <touching (bottom lava v)?>> then\n    set [exit v] to [die]\nend\n\ndefine win\nstart sound [win v]\nrepeat (50)\n    change x by (((([x position v] of [flag v]) - (25)) - (x position)) / (10))\n    change y by (((([y position v] of [flag v]) + (20)) - (y position)) / (10))\nend\nbroadcast (course clear v) and wait\nrepeat (20)\n    change x by (10)\nend\n\nwhen I receive [enemyboost v]\nset [sy v] to [10]\nif <key (up arrow v) pressed?> then\n    set [sy v] to [25]\nend\n\nwhen I receive [bounce player v]\nset [sy v] to [30]\n\nif <key (up arrow v) pressed?> then\n\nwhen I receive [speedup v]\nset [sx v] to [70]\n\nwhen flag clicked\nset [level v] to [1]\n\n\n\nif <not <(x) = [0]>> then\n    set [exit v] to []\n    wait (0.3) seconds\n    hide\n    repeat (2)\n        wait (0.3) seconds\n        show\n        wait (0.3) seconds\n        hide\n    end\nend\n\nset [exit v] to [die]\n\nif <key (up arrow v) pressed?> then\n    if <(sx) > [0]> then\n        set [sx v] to [-16]\n    else\n        set [sx v] to [16]\n    end\n    set [in air v] to [0]\nelse\n    set [sx v] to [0]\nend\n\nchange y by (-1)\n\nset [scrolly v] to [1000]\nset [sy v] to [0]\nset [y v] to [1000]\nset [sy v] to [0]\n\nwhen flag clicked\nset [skin v] to [1]\n\nbroadcast (tick v) and wait\n\nwhen I receive [hurt v]\nchange [health v] by (-1)\nif <(health) = [0]> then\n    hide\n    set [exit v] to [end]\nelse\n    set [hurt?? v] to [1]\n    repeat (5)\n        repeat (8)\n            change [ghost v] effect by (10)\n        end\n        repeat (8)\n            change [ghost v] effect by (-10)\n        end\n    end\n    set [hurt?? v] to [0]\nend\n\n\n\nif <(SCROLLY) < [0]> then\n    set [scrolly v] to [0]\nend\n\nset [exit v] to [win]\n\n@platform\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((x) - (SCROLLX)) ((y) - (SCROLLY))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (1 1 v)\n    create clone at X: [480] Y: [0]\n    create clone at X: [480] Y: [0]\n    create clone at X: [480] Y: [100]\n    create clone at X: [-480] Y: [300]\n    create clone at X: [300] Y: [360]\n    create clone at X: [480] Y: [200]\n    create clone at X: [250] Y: [0]\n    create clone at X: [270] Y: [0]\n    create clone at X: [500] Y: [400]\n    create clone at X: [280] Y: [300]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (2 1 v)\n        create clone at X: [475] Y: [0]\n        create clone at X: [475] Y: [0]\n        create clone at X: [475] Y: [0]\n        create clone at X: [475] Y: [0]\n        create clone at X: [475] Y: [0]\n        create clone at X: [475] Y: [0]\n        create clone at X: [475] Y: [0]\n        create clone at X: [475] Y: [0]\n    end\nend\n\ndefine create clone at X: (xpos) Y: (ypos)\ncreate clone of (_myself_ v)\nset [scrolly v] to [0]\nchange [x v] by (xpos)\nchange [y v] by (ypos)\nnext costume\n\nwhen I receive [reset v]\nhide\ndelete this clone\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I start as a clone\nhide\n\nwhen [s v] key pressed\nif <<(username) = [poliakoff]> and <not <(LEVEL) = [6]>>> then\n    set [exit v] to [win]\nend\n\nif <(costume [number v]) = [17]> then\n    change y by (10)\nend\n\nwhen flag clicked\npoint in direction (90)\n\nwhen I start as a clone\nif <(costume [number v]) = [8]> then\n    change [x v] by (175)\n    forever\n        wait (0.5) seconds\n        repeat (58)\n            change [x v] by (-6)\n        end\n        wait (0.5) seconds\n        repeat (58)\n            change [x v] by (6)\n        end\n    end\nend\n\nset [exit v] to [win]\n\nchange [x v] by (-2)\n\nstart sound [pop v]\n\n@buttons\n\nwhen flag clicked\nhide\n\nwhen I receive [menu v]\nwait (1) seconds\nswitch costume to (play v)\ncreate clone of (_myself_ v)\nswitch costume to (skins v)\ncreate clone of (_myself_ v)\nswitch costume to (credits v)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nset size to (1) %\nset x to (0)\nif <(costume [number v]) = [1]> then\n    set y to (25)\nelse\n    if <(costume [number v]) = [2]> then\n        set y to (-50)\n    else\n        if <(costume [number v]) = [4]> then\n            set y to (-125)\n        else\n            go to x: (-200) y: (-150)\n        end\n    end\nend\nshow\nforever\n    if <touching (mouse-pointer v)?> then\n        change size by (((125) - (size)) / (8))\n    else\n        change size by (((100) - (size)) / (8))\n    end\nend\n\nwhen I start as a clone\nforever\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        broadcast (remove clones v)\n        if <(costume [name v]) = [back]> then\n            start sound [back button v]\n        else\n            start sound [click v]\n        end\n        if <(costume [name v]) = [play]> then\n            broadcast (level maps v)\n        else\n            if <(costume [name v]) = [skins]> then\n                broadcast (shop v)\n            else\n                if <(costume [name v]) = [credits]> then\n                    broadcast (credits v)\n                else\n                    broadcast (menu v)\n                end\n                delete this clone\n            end\n            delete this clone\n        end\n        delete this clone\n    end\nend\n\nwhen I receive [remove clones v]\nrepeat (10)\n    change size by (((0) - (size)) / (5))\nend\nhide\ndelete this clone\n\nwhen I receive [shop v]\nwait (1) seconds\nswitch costume to (back v)\ncreate clone of (_myself_ v)\n\nwhen I receive [level maps v]\nwait (1) seconds\nswitch costume to (back v)\ncreate clone of (_myself_ v)\n\nwhen I receive [level selected v]\nrepeat (10)\n    change size by (((0) - (size)) / (5))\nend\nhide\ndelete this clone\n\nwhen I receive [credits v]\nwait (1) seconds\nswitch costume to (back v)\ncreate clone of (_myself_ v)\n\n@cubeland\n\nwhen flag clicked\nclear graphic effects\nhide variable [collected v]\nwait (2) seconds\nforever\n    show\n    go to [front v] layer\n    change [ghost v] effect by (4)\nend\n\nwhen flag clicked\nwait (2.5) seconds\nshow variable [collected v]\n\nhide variable [collected v]\n\nwhen this sprite clicked\ngo to [front v] layer\n\n@score\n\nwhen flag clicked\nbroadcast (killclone v)\nwait (3) seconds\nforever\n    hide\n    broadcast (killclone v)\n    write (letter (1) of (collected)) (letter (2) of (collected)) (letter (3) of (collected)) (length of (collected))\nend\n\nwhen I receive [killclone v]\ndelete this clone\n\ndefine write (1) (2) (3) (length)\ngo to x: (160) y: (135)\nset x to (160)\nif <(length) > [0]> then\n    switch costume to (join [number-] (1))\n    create clone of (_myself_ v)\n    change x by (25)\n    if <(length) > [1]> then\n        switch costume to (join [number-] (2))\n        create clone of (_myself_ v)\n        change x by (25)\n        if <(length) > [2]> then\n            switch costume to (join [number-] (3))\n            create clone of (_myself_ v)\n        end\n    end\nend\n\nwhen I start as a clone\nclear graphic effects\ngo to [front v] layer\nshow\ngo to [front v] layer\n\n@enemy!!\n\nwhen I receive [reset v]\nhide\ndelete this clone\n\nwhen I receive [tick v]\nposition (((x) + (Added position)) - (SCROLLX)) ((y) - (SCROLLY))\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\ngo to [back v] layer\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\ndefine create clone at X: (xpos) Y: (ypos)\nset [x v] to (xpos)\nset [y v] to (ypos)\ncreate clone of (_myself_ v)\nbroadcast (tick v)\n\nwhen I receive [setup v]\nshow\nset [x v] to [0]\nset [y v] to [0]\nset [added position v] to [0]\nif <(LEVEL) = [2]> then\n    switch costume to (1 v)\n    create clone at X: [765] Y: [-68]\n    create clone at X: [1925] Y: [45]\nend\ncreate clone at X: [-100000] Y: [1000000000000000]\n\nwhen I start as a clone\nswitch costume to (1 v)\nset [added position v] to [120]\nforever\n    repeat (80)\n        change [added position v] by (-3)\n    end\n    set [added position v] to [-120]\n    repeat (80)\n        change [added position v] by (3)\n    end\n    set [added position v] to [120]\nend\n\ndefine clone die\nbroadcast (enemyboost v)\nrepeat (4)\n    next costume\nend\n\nwait (0.001) seconds\n\nwhen I start as a clone\nforever\n    if <touching (player v)?> then\n        if <<([y position v] of [player v]) > ((y position) + (15))> and <([sy v] of [player v]) < [-1]>> then\n            clone die\n            delete this clone\n        else\n            set [exit v] to [die]\n        end\n    end\nend\n\nwhen I start as a clone\nforever\n    go to [front v] layer\nend\n\n@roll things\n\n