Frozen - A Scrolling Platformer

Instructions: -----------------------------------------------------------------------\nWASD, mobile or arrow keys to move Elsa.\nHave fun!\n3 Frozen levels so far!\n-----------------------------------------------------------------------

@Stage\n\nwhen flag clicked\nforever\n    play sound [Into the Unknown v] until done\nend\n\n@Ground\n\nwhen I receive [load v]\ngo to [back v] layer\n\nwhen flag clicked\ngo to [front v] layer\nset [level v] to [1]\n\nwhen I receive [setup v]\nrepeat (1)\n    delete this clone\nend\nset [i am a clone? v] to [0]\nswitch costume to (costume1 v)\nset [x v] to [0]\nset [y v] to [0]\nhide\nif <(LEVEL) = [1]> then\n    switch costume to (costume1 v)\n    Clone [0] [0]\n    Clone [450] [0]\n    Clone [450] [0]\n    Clone [100] [-20]\nend\nif <(LEVEL) = [2]> then\n    switch costume to (costume5 v)\n    Clone [0] [0]\n    Clone [450] [0]\n    Clone [450] [0]\n    Clone [600] [0]\n    Clone [600] [0]\nend\nif <(LEVEL) = [3]> then\n    switch costume to (costume10 v)\n    Clone [0] [0]\n    Clone [450] [0]\n    Clone [450] [0]\n    Clone [500] [0]\n    Clone [500] [0]\nend\nif <(LEVEL) = [4]> then\n    switch costume to (costume5 v)\n    Clone [0] [0]\nend\n\nClone [450] [0]\nClone [400] [100]\n\nwhen flag clicked\nbroadcast (Setup v)\n\nClone [500] [0]\nClone [450] [0]\nClone [400] [0]\n\nwhen flag clicked\nbroadcast (Delete all clones v)\nbroadcast (Setup v)\nset [level v] to [1]\n\nif <<(x position) = (x)> and <(y position) = (y)>> then\n    show\nelse\n    hide\nend\nif <(I am a clone?) = [0]> then\n    hide\nend\n\nwhen I receive [tick v]\nGo to ((x) + ((0) - (SCROLL X))) ((y) + ((0) - (SCROLL Y)))\n\ndefine Clone (x) (y)\nchange [x v] by (x)\nchange [y v] by (y)\ncreate clone of (_myself_ v)\nnext costume\n\nwhen I start as a clone\nset [i am a clone? v] to [1]\nshow\n\ndefine Go to (x) (y)\ngo to x: (x) y: (y)\nif <<(x position) = (x)> and <(y position) = (y)>> then\n    show\nelse\n    hide\nend\nif <(I am a clone?) = [0]> then\n    hide\nend\n\n@1st\n\nwhen I receive [delete all clones v]\ndelete this clone\n\nwhen I receive [tick v]\nGo to ((x) + ((0) - (SCROLL X))) ((y) + ((0) - (SCROLL Y)))\n\ndefine Clone (x) (y)\nchange [x v] by (x)\nchange [y v] by (y)\ncreate clone of (_myself_ v)\nnext costume\n\nwhen I start as a clone\nset [i am a clone? v] to [1]\nshow\n\ndefine Go to (x) (y)\ngo to x: (x) y: (y)\nif <<(x position) = (x)> and <(y position) = (y)>> then\n    show\nelse\n    hide\nend\nif <(I am a clone?) = [0]> then\n    hide\nend\n\nwhen I receive [load v]\ngo to [back v] layer\n\nwhen flag clicked\ngo to [front v] layer\ngo to [back v] layer\nset [level v] to [1]\ngo to [back v] layer\n\nClone [450] [0]\nClone [400] [100]\n\nwhen I receive [tick v]\ngo to [back v] layer\n\nClone [450] [0]\nClone [-450] [300]\n\nClone [400] [0]\n\nwhen I receive [setup v]\nrepeat (1)\n    delete this clone\nend\nset [i am a clone? v] to [0]\nswitch costume to (costume1 v)\nset [x v] to [0]\nset [y v] to [0]\nhide\nif <(LEVEL) = [1]> then\n    switch costume to (costume1 v)\n    Clone [0] [0]\n    Clone [450] [0]\n    Clone [450] [0]\n    Clone [500] [0]\nend\nif <(LEVEL) = [2]> then\n    switch costume to (costume4 v)\n    Clone [0] [0]\n    Clone [450] [0]\n    Clone [1500] [100]\nend\nif <(LEVEL) = [3]> then\n    switch costume to (costume7 v)\n    Clone [0] [0]\n    Clone [450] [0]\n    Clone [450] [0]\n    Clone [550] [0]\n    Clone [550] [0]\nend\nif <(LEVEL) = [4]> then\n    switch costume to (level 4 v)\n    Clone [0] [0]\nend\n\n@2nd\n\nwhen I receive [delete all clones v]\ndelete this clone\n\nwhen I receive [tick v]\nGo to ((x) + ((0) - (SCROLL X))) ((y) + ((0) - (SCROLL Y)))\n\ndefine Clone (x) (y)\nchange [x v] by (x)\nchange [y v] by (y)\ncreate clone of (_myself_ v)\nnext costume\n\nwhen I start as a clone\nset [i am a clone? v] to [1]\nshow\n\ndefine Go to (x) (y)\ngo to x: (x) y: (y)\nif <<(x position) = (x)> and <(y position) = (y)>> then\n    show\nelse\n    hide\nend\nif <(I am a clone?) = [0]> then\n    hide\nend\n\nwhen I receive [load v]\ngo to [back v] layer\n\nwhen flag clicked\ngo to [back v] layer\ngo to [back v] layer\nset [level v] to [1]\ngo to [back v] layer\n\nClone [450] [0]\nClone [-450] [300]\n\nClone [500] [0]\n\nwhen I receive [tick v]\ngo to [back v] layer\n\nwhen I start as a clone\nset [ghost v] effect to (30)\n\nwhen I receive [setup v]\nrepeat (1)\n    delete this clone\nend\nset [i am a clone? v] to [0]\nswitch costume to (costume1 v)\nset [x v] to [0]\nset [y v] to [0]\nhide\nif <(LEVEL) = [1]> then\n    switch costume to (costume1 v)\n    Clone [0] [0]\n    Clone [450] [0]\n    Clone [450] [0]\nend\nif <(LEVEL) = [2]> then\n    switch costume to (costume4 v)\n    Clone [0] [0]\n    Clone [450] [0]\n    Clone [450] [0]\n    Clone [1200] [200]\nend\nif <(LEVEL) = [3]> then\n    switch costume to (costume8 v)\n    Clone [0] [0]\n    Clone [450] [0]\n    Clone [450] [0]\n    Clone [1000] [0]\n    Clone [750] [0]\nend\nif <(LEVEL) = [4]> then\n    switch costume to (level 4 v)\n    Clone [0] [0]\nend\n\nClone [400] [0]\n\n@Spikes\n\nwhen I receive [delete all clones v]\ndelete this clone\n\nwhen I receive [tick v]\nGo to ((x) + ((0) - (SCROLL X))) ((y) + ((0) - (SCROLL Y)))\n\ndefine Clone (x) (y)\nchange [x v] by (x)\nchange [y v] by (y)\ncreate clone of (_myself_ v)\nnext costume\n\nwhen I start as a clone\nset [i am a clone? v] to [1]\nshow\n\ndefine Go to (x) (y)\ngo to x: (x) y: (y)\nif <<(x position) = (x)> and <(y position) = (y)>> then\n    show\nelse\n    hide\nend\nif <(I am a clone?) = [0]> then\n    hide\nend\n\nwhen I receive [load v]\ngo to [back v] layer\n\nwhen flag clicked\ngo to [back v] layer\nset [level v] to [1]\n\nClone [450] [0]\nClone [-450] [300]\n\nClone [0] [0]\n\nwhen I receive [setup v]\nrepeat (1)\n    delete this clone\nend\nset [i am a clone? v] to [0]\nswitch costume to (costume1 v)\nset [x v] to [0]\nset [y v] to [0]\nhide\nif <(LEVEL) = [1]> then\n    switch costume to (costume1 v)\n    Clone [600] [-150]\nend\nif <(LEVEL) = [2]> then\n    switch costume to (costume2 v)\n    Clone [450] [0]\n    Clone [450] [0]\n    Clone [600] [100]\n    Clone [400] [200]\nend\nif <(LEVEL) = [3]> then\n    switch costume to (costume6 v)\n    Clone [0] [0]\n    Clone [450] [0]\n    Clone [450] [0]\nend\nif <(LEVEL) = [4]> then\n    switch costume to (level 4 v)\n    Clone [0] [0]\nend\n\nClone [500] [0]\nClone [450] [0]\nClone [400] [0]\n\n@Portal\n\nwhen I receive [delete all clones v]\ndelete this clone\n\nwhen I receive [tick v]\nGo to ((x) + ((0) - (SCROLL X))) ((y) + ((0) - (SCROLL Y)))\n\ndefine Clone (x) (y)\nchange [x v] by (x)\nchange [y v] by (y)\ncreate clone of (_myself_ v)\nnext costume\n\nwhen I start as a clone\nset [i am a clone? v] to [1]\nshow\n\ndefine Go to (x) (y)\ngo to x: (x) y: (y)\nif <<(x position) = (x)> and <(y position) = (y)>> then\n    show\nelse\n    hide\nend\nif <(I am a clone?) = [0]> then\n    hide\nend\n\nwhen I receive [load v]\ngo to [back v] layer\n\nwhen flag clicked\ngo to [front v] layer\nset [level v] to [1]\n\nwhen I receive [setup v]\nrepeat (1)\n    delete this clone\nend\nset [i am a clone? v] to [0]\nswitch costume to (costume2 v)\nset [x v] to [0]\nset [y v] to [0]\nhide\nif <(LEVEL) = [1]> then\n    switch costume to (costume1 v)\n    Clone [1000] [-30]\nend\nif <(LEVEL) = [2]> then\n    switch costume to (costume1 v)\n    Clone [2500] [200]\nend\nif <(LEVEL) = [3]> then\n    switch costume to (costume2 v)\n    Clone [0] [0]\nend\nif <(LEVEL) = [4]> then\n    switch costume to (costume2 v)\n    Clone [0] [0]\nend\n\nwhen flag clicked\nbroadcast (Setup v)\nforever\n\nClone [450] [0]\nClone [400] [100]\n\nClone [500] [0]\nClone [450] [0]\nClone [400] [0]\n\nwhen I receive [tick v]\ngo to [back v] layer\n\nwhen flag clicked\nforever\n    if <touching (sprite1 v)?> then\n        start sound [Connect v]\n    end\nend\n\nwhen flag clicked\nforever\n\nwhen I start as a clone\nforever\n    set size to ((([sin v] of ((timer) * (90)) ) * (20)) + (70)) %\n    set y to ((([sin v] of ((timer) * (50)) ) * (10)) + (90))\nend\n\n@Water\n\nwhen I receive [setup v]\nrepeat (1)\n    delete this clone\nend\nset [i am a clone? v] to [0]\nswitch costume to (costume1 v)\nset [x v] to [0]\nset [y v] to [0]\nhide\nif <(LEVEL) = [1]> then\n    switch costume to (costume1 v)\n    Clone [700] [-20]\nend\nif <(LEVEL) = [2]> then\n    switch costume to (costume2 v)\n    Clone [450] [0]\n    Clone [450] [0]\n    Clone [450] [0]\n    Clone [450] [0]\nend\nif <(LEVEL) = [3]> then\n    switch costume to (costume6 v)\n    Clone [450] [0]\n    Clone [450] [0]\n    Clone [450] [0]\nend\nif <(LEVEL) = [4]> then\n    switch costume to (costume5 v)\n    Clone [450] [0]\nend\n\nwhen flag clicked\nforever\n    erase all\nend\n\nwhen I receive [delete all clones v]\ndelete this clone\n\nClone [450] [0]\nClone [450] [0]\nClone [-450] [300]\n\nwhen I receive [tick v]\nset [ghost v] effect to (60)\ngo to [front v] layer\nGo to ((x) + ((0) - (SCROLL X))) ((y) + ((0) - (SCROLL Y)))\n\ndefine Clone (x) (y)\nchange [x v] by (x)\nchange [y v] by (y)\ncreate clone of (_myself_ v)\nnext costume\n\nwhen I start as a clone\nshow\nset [i am a clone? v] to [1]\n\ndefine Go to (x) (y)\ngo to x: (x) y: (y)\nif <(I am a clone?) = [0]> then\n    hide\nelse\n    if <<(x position) = (x)> and <(y position) = (y)>> then\n        show\n        set [ghost v] effect to (40)\n        set y to ((y) + (([sin v] of (((timer) + (1)) * (300)) ) * (8)))\n        stamp\n        set y to ((y) + (([sin v] of (((timer) + (2)) * (300)) ) * (8)))\n        stamp\n        set y to ((y) + (([sin v] of (((timer) + (3)) * (300)) ) * (8)))\n        stamp\n        set [ghost v] effect to (100)\n    else\n        hide\n    end\nend\n\n@Sprite1\n\ndefine Set Costume\n\nif <(in air) < [6]> then\n    if <(frame) = [0]> then\n        switch costume to (stand_1 v)\n    else\n        switch costume to ([floor v] of ((4) + ((frame) mod (8))) )\n    end\nelse\n    if <(speed y) > [0]> then\n        switch costume to (jump_1 v)\n    else\n        switch costume to (fall_1 v)\n    end\nend\n\ndefine reset\nset [x v] to [0]\nset [y v] to [0]\nset [scroll x v] to [0]\nset [scroll y v] to [20]\n\nwhen I start as a clone\nrepeat (50)\n    change x by (-1)\n    change size by (-2)\n    change [ghost v] effect by (5)\nend\ndelete this clone\n\ndefine game on!\nset [x v] to [0]\nset [y v] to [0]\nset [sy v] to [0]\nset [in air v] to [0]\nset [exit v] to []\nbroadcast (close space v)\nset rotation style [left-right v]\npoint in direction (90)\nshow\n\nwhen I receive [green flag v]\nset size to (50) %\nset [level v] to [1]\nforever\n    broadcast (Tick v)\nend\n\nwhen flag clicked\nbroadcast (green flag v)\n\nwhen I receive [setup v]\nset [x v] to [0]\nset [y v] to [0]\n\ndefine game-die\n\nwhen flag clicked\nset volume to (100) %\nbroadcast (start! v) and wait\n\ndefine Tick\nchange player x by (Xv)\nif <touching (bounce v)?> then\n    set [sy v] to [30]\nend\nif <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <(mouse x) > [10]>>>> then\n    change [xv v] by (3.5)\n    change [frame v] by (0.5)\n    point in direction (90)\nelse\n    if <<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<mouse down?> and <(mouse x) < [-10]>>>> then\n        change [xv v] by (-3.5)\n        change [frame v] by (0.5)\n    else\n        set [frame v] to [0]\n    end\nend\nif <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n    if <(in air) < [4]> then\n        set [sy v] to [15]\n    end\nend\nchange [sy v] by (-2)\nchange player y by (sy)\nPosition\ntest die\nchange [scroll x v] by (round (((x) - (SCROLL X)) / (10)))\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\nend\nchange [scroll y v] by (round (((y) - (SCROLL Y)) / (10)))\nposition\nif <<(y) < [-180]> or <touching (spikes v)?>> then\n    reset\nend\nset [xv v] to ((Xv) * (0.7))\n\nSet Costume\n\nwhen flag clicked\nreset\nset [level v] to [1]\n\nwhen I receive [tick v]\nif <touching (portal v)?> then\n    if <<(LEVEL) = [1]> and <not <(wait) = [1]>>> then\n        set [level v] to [2]\n        change [wait v] by (1)\n        broadcast (wait v)\n    end\n    if <<(LEVEL) = [2]> and <not <(wait) = [1]>>> then\n        set [level v] to [3]\n        change [wait v] by (1)\n        broadcast (wait v)\n    end\n    broadcast (Delete all clones v)\n    broadcast (Setup v)\n    reset\n    set [scroll x v] to [0]\n    set [scroll y v] to [0]\n    set [x v] to [0]\n    set [y v] to [0]\n    wait until <not <touching (portal v)?>>\nend\n\ndefine change player x by (sx)\nchange [x v] by ((sx) * (1.1))\nposition\nif <touching (ground v)?> then\n    repeat (10)\n        change [y v] by (1)\n        position\n        if <not <touching (ground v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-10)\n    repeat until <not <touching (ground v)?>>\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\nwhen I receive [green flag v]\ngo to [front v] layer\ngo [backward v] (1) layers\n\nwhen I receive [tick v]\nTick\n\ndefine position\ngo to x: ((x) - (SCROLL X)) y: ((y) - (SCROLL Y))\n\ndefine game - win\npoint in direction (90)\n\ndefine test die\n\ndefine change player y by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nposition\nrepeat until <not <touching (ground v)?>>\n    if <(sy) > [0]> then\n        change [y v] by (-1)\n    else\n        change [y v] by (1)\n        set [in air v] to [0]\n    end\n    position\n    set [sy v] to [0]\nend\n\ndefine Run\n\nwhen flag clicked\nset size to (25) %\n\nwhen I receive [tick v]\nset size to (35) %\nset rotation style [left-right v]\n\ndefine Set Costume\n\ndefine Set Costume\n\nrepeat (1)\n\nwhen flag clicked\nset [wait v] to [0]\n\nwhen I receive [wait v]\nwait (0.5) seconds\nset [wait v] to [0]\n\nwhen I receive [tick v]\nif <<key (space v) pressed?> and <(username) = [--Dove--]>> then\n    broadcast (Delete all clones v)\n    broadcast (Setup v)\n    set [level v] to [3]\n    reset\nend\n\nwhen [timer v] > (CheckTimer)\nhide\n\nwhen flag clicked\nshow\n\n@Clouds\n\nwhen I start as a clone\nshow\nset [yv v] to [0]\nshow\nset size to (100) %\nset [ghost v] effect to (pick random (30) to (70))\nswitch costume to (pick random (1) to (3))\nshow\nshow\ngo to x: (-150) y: (pick random (100) to (175))\nchange [clones v] by (1)\nset [x v] to ((x position) + (SCROLL X))\nset [y v] to ((y position) + (SCROLL Y))\nset [bg effects: xv v] to (pick random (1) to (2))\nset [yv v] to [0]\nrepeat until <(x) > [1999]>\n    go to x: ((x) + ((0) - (SCROLL X))) y: ((y) + ((0) - (SCROLL Y)))\n    change [x v] by (BG Effects: Xv)\n    change [y v] by (Yv)\n    if <<(x position) > [290]> or <(x position) < [-290]>> then\n        hide\n    else\n        show\n    end\nend\nchange [clones v] by (-1)\ndelete this clone\n\ndefine Clone (#)\nrepeat (#)\n    create clone of (_myself_ v)\nend\n\nwhen flag clicked\nset [clones v] to [0]\nwait (1) seconds\nClone [1]\nforever\n    wait (pick random (7) to (10)) seconds\n    Clone [1]\nend\n\n@Thumbnail\n\nwhen flag clicked\nset [ghost v] effect to (100)\ngo to [front v] layer\n\nwhen [timer v] > (CheckTimer)\ngo to [front v] layer\nset [ghost v] effect to (0)\ngo to x: (0) y: (0)\nforever\n    point in direction ((([sin v] of ((timer) * (50)) ) * (10)) + (90))\nend\n\nwhen flag clicked\nforever\n    set [checktimer v] to (timer)\nend\n\n