Grassformer - A Scrolling Platformer

Instructions: [Arrow Keys] or [WASD] - Move\n[P] - Skip Level

@Stage\n\nwhen flag clicked\nswitch backdrop to (intro v)\n\nwhen I receive [before start v]\nswitch backdrop to (game v)\nforever\n    play sound [thefatrat-phaera-sunlight-D1OBcvDG v] until done\nend\n\nwhen I receive [before start v]\nforever\n    play sound [Sounds of the Boreal Forest.mp3 v] until done\nend\n\n@guy\n\nwhen flag clicked\nhide\n\ndefine platform\nchange [y v] by (-1)\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<(mouse x) > (x position)> and <mouse down?>>> then\n    switch costume to (guy v)\n    change [x v] by (1)\nend\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<(mouse x) < (x position)> and <mouse down?>>> then\n    switch costume to (guy v)\n    change [x v] by (-1)\nend\nset [x v] to ((x) * (0.9))\nchange x by (x)\nif <touching (finish v)?> then\n    start sound [Win v]\n    broadcast (go v)\n    go to x: (0) y: (0)\n    change [level v] by (1)\n    set [x v] to [0]\n    set [y v] to [0]\nend\nif <touching (bad v)?> then\n    start sound [Crunch v]\n    broadcast (ded v)\n    go to x: (0) y: (0)\n    set [scrollx v] to [300]\n    set [x v] to [0]\n    set [y v] to [0]\nend\nif <touching (stages v)?> then\n    change y by (1)\n    if <touching (stages v)?> then\n        change y by (1)\n        if <touching (stages v)?> then\n            change y by (1)\n            if <touching (stages v)?> then\n                change y by (1)\n                if <touching (stages v)?> then\n                    change y by (1)\n                    if <touching (stages v)?> then\n                        change y by (1)\n                        if <touching (stages v)?> then\n                            change y by (-6)\n                            xcoll\n                            if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<(mouse y) > (y position)> and <mouse down?>>> then\n                                set [y v] to [14]\n                                if <([abs v] of (x) ) = (x)> then\n                                    set [x v] to [-8]\n                                else\n                                    set [x v] to [8]\n                                end\n                            else\n                                set [x v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nchange y by (y)\nif <touching (stages v)?> then\n    ycoll\n    set [y v] to (<<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<(mouse y) > (y position)> and <mouse down?>>> and <(y) < [0]>> * (14))\nend\nchange [scrollx v] by (x position)\nset x to (0)\n\ndefine ycoll\nrepeat until <not <touching (stages v)?>>\n    if <(y) > [0]> then\n        change y by (-1)\n    else\n        change y by (1)\n    end\nend\n\ndefine xcoll\nrepeat until <not <touching (stages v)?>>\n    if <(x) > [0]> then\n        change x by (-0.9)\n    else\n        change x by (0.9)\n    end\nend\n\nwhen I start as a clone\nif <(size) = [100]> then\n    switch costume to (trail v)\n    go to [back v] layer\n    go to (guy v)\n    repeat (10)\n        change x by ((x) * (-1))\n        change [ghost v] effect by (10)\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nif <(size) = [99]> then\n    switch costume to (eye v)\n    go to [front v] layer\n    show\n    forever\n        go to (guy v)\n        change x by ((x) * (0.25))\n        change y by ((y) * (0.25))\n    end\nend\n\nwhen I receive [before start v]\nforever\n    if <<key (p v) pressed?> and <not <([costume # v] of [stages v]) = [6]>>> then\n        start sound [Win v]\n        broadcast (go v)\n        change [level v] by (1)\n        set [x v] to [0]\n        set [y v] to [0]\n        go to x: (0) y: (0)\n        wait until <not <key (p v) pressed?>>\n    end\nend\n\nwhen I receive [before start v]\nset size to (99) %\ncreate clone of (_myself_ v)\nset [y v] to [0]\nset [x v] to [0]\ngo to x: (0) y: (0)\nset rotation style [left-right v]\nswitch costume to (guy v)\nset size to (100) %\nshow\nforever\n    create clone of (_myself_ v)\n    platform\nend\n\n@stages\n\nwhen flag clicked\nhide\nset drag mode [not draggable v]\n\ndefine go der\nswitch costume to (costume)\ngo to x: ((place) - (scrollx)) y: (0)\nshow\nif <((place) - (scrollx)) = (x position)> then\n    show\nelse\n    hide\nend\n\nwhen I receive [message1 v]\ngo der\n\nwhen I receive [go v]\nforever\n    broadcast (message1 v)\nend\n\nwhen I receive [ded v]\nset [scrollx v] to [300]\n\nwhen I receive [go v]\nmake level (level)\n\ndefine make level (level)\ndelete\nset [scrollx v] to [300]\nset [place v] to [0]\nif <(level) = [1]> then\n    set [costume v] to [0]\n    repeat (3)\n        change [costume v] by (1)\n        change [place v] by (480)\n        create clone of (_myself_ v)\n    end\nend\nif <(level) = [2]> then\n    set [costume v] to [3]\n    repeat (4)\n        change [costume v] by (1)\n        change [place v] by (480)\n        create clone of (_myself_ v)\n    end\nend\nif <(level) = [3]> then\n    set [costume v] to [7]\n    repeat (4)\n        change [costume v] by (1)\n        change [place v] by (480)\n        create clone of (_myself_ v)\n    end\nend\nif <(level) = [4]> then\n    set [costume v] to [11]\n    repeat (5)\n        change [costume v] by (1)\n        change [place v] by (480)\n        create clone of (_myself_ v)\n    end\nend\nif <(level) = [5]> then\n    set [costume v] to [16]\n    repeat (4)\n        change [costume v] by (1)\n        change [place v] by (480)\n        create clone of (_myself_ v)\n    end\nend\nif <(level) = [6]> then\n    set [costume v] to [20]\n    repeat (5)\n        change [costume v] by (1)\n        change [place v] by (480)\n        create clone of (_myself_ v)\n    end\nend\nif <(level) = [7]> then\n    set [costume v] to [26]\n    set [place v] to [480]\n    create clone of (_myself_ v)\nend\n\ndefine delete\ndelete this clone\n\nwhen I receive [before start v]\ngo to x: (0) y: (0)\nswitch costume to (4 v)\nset [level v] to [1]\nbroadcast (go v)\n\n@bad\n\nwhen I receive [message1 v]\ngo der\n\ndefine go der\nswitch costume to (costume)\ngo to x: ((place) - (scrollx)) y: (0)\nif <((place) - (scrollx)) = (x position)> then\n    show\nelse\n    hide\nend\n\nwhen I receive [go v]\ndelete\nset [scrollx v] to [300]\nset [place v] to [0]\nif <(level) = [1]> then\n    set [costume v] to [0]\n    repeat (3)\n        change [costume v] by (1)\n        change [place v] by (480)\n        create clone of (_myself_ v)\n    end\nend\nif <(level) = [2]> then\n    set [costume v] to [3]\n    repeat (4)\n        change [costume v] by (1)\n        change [place v] by (480)\n        create clone of (_myself_ v)\n    end\nend\nif <(level) = [3]> then\n    set [costume v] to [7]\n    repeat (4)\n        change [costume v] by (1)\n        change [place v] by (480)\n        create clone of (_myself_ v)\n    end\nend\nif <(level) = [4]> then\n    set [costume v] to [11]\n    repeat (5)\n        change [costume v] by (1)\n        change [place v] by (480)\n        create clone of (_myself_ v)\n    end\nend\nif <(level) = [5]> then\n    set [costume v] to [16]\n    repeat (4)\n        change [costume v] by (1)\n        change [place v] by (480)\n        create clone of (_myself_ v)\n    end\nend\nif <(level) = [6]> then\n    set [costume v] to [20]\n    repeat (4)\n        change [costume v] by (1)\n        change [place v] by (480)\n        create clone of (_myself_ v)\n    end\nend\nif <(level) = [7]> then\n    set [costume v] to [25]\n    change [place v] by (480)\n    create clone of (_myself_ v)\nend\n\nwhen flag clicked\ngo to [front v] layer\npoint in direction (90)\nhide\n\ndefine delete\ndelete this clone\n\n@Finish\n\nwhen flag clicked\nhide\nset [place v] to [0]\n\nwhen I receive [go v]\ngo to x: (1000) y: (1000)\nset [place v] to [0]\nif <(level) = [1]> then\n    set [place v] to [1440]\n    create clone of (_myself_ v)\nend\nif <(level) = [2]> then\n    set [place v] to [1920]\n    create clone of (_myself_ v)\nend\nif <(level) = [3]> then\n    set [place v] to [1920]\n    create clone of (_myself_ v)\nend\nif <(level) = [4]> then\n    set [place v] to [2400]\n    create clone of (_myself_ v)\nend\nif <(level) = [5]> then\n    set [place v] to [1920]\n    create clone of (_myself_ v)\nend\nif <(level) = [5]> then\n    set [place v] to [2400]\n    create clone of (_myself_ v)\nend\nif <(level) = [6]> then\n    set [place v] to [2400]\n    create clone of (_myself_ v)\nend\nif <(level) = [7]> then\n    set [place v] to [100000000000]\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nshow\n\nwhen I receive [message1 v]\ngo der\n\ndefine go der\nswitch costume to (costume)\ngo to x: ((place) - (scrollx)) y: (0)\nif <((place) - (scrollx)) = (x position)> then\n    show\nelse\n    hide\nend\n\n@Level\n\nwhen flag clicked\nhide\nforever\n    go to [front v] layer\nend\n\nwhen I receive [go v]\nswitch costume to (level)\ngo to x: (0) y: (135)\nset [ghost v] effect to (100)\nshow\nrepeat (50)\n    change [ghost v] effect by (-2)\nend\nwait (0.5) seconds\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nhide\n\n@Rando Bando clouds\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nshow\ngo to [back v] layer\nswitch costume to (pick random (1) to (4))\nif <(side) = [1]> then\n    go to x: (240) y: (pick random (150) to (50))\n    repeat until <(x position) < [-240]>\n        change x by (-0.5)\n    end\n    delete this clone\nend\nif <(side) = [2]> then\n    go to x: (-240) y: (pick random (150) to (50))\n    repeat until <(x position) > [240]>\n        change x by (0.5)\n    end\n    delete this clone\nend\n\nwhen I receive [before start v]\nforever\n    set [side v] to (pick random (1) to (2))\n    create clone of (_myself_ v)\n    wait (pick random (20) to (25)) seconds\nend\n\n@Thumbnail\n\nwhen flag clicked\nforever\n    go to x: (0) y: (0)\n    set [ghost v] effect to (100)\n    show\n    go to [front v] layer\nend\n\n@Intro\n\nwhen I start as a clone\nif <(size) = [70]> then\n    show\n    go to x: (0) y: (-110)\n    set [ghost v] effect to (100)\n    set size to (100) %\n    go to [front v] layer\n    switch costume to (corpcooga v)\n    repeat (5)\n        change [ghost v] effect by (-20)\n    end\n    wait (0.5) seconds\n    repeat (10)\n        wait (0.01) seconds\n        change [ghost v] effect by (10)\n    end\nend\n\nwhen flag clicked\nwait until <mouse down?>\nwait until <not <mouse down?>>\nstop all sounds\nstart sound [Teleport v]\nhide\nbroadcast (before start v)\nstop [other scripts in sprite v]\ndelete this clone\n\nwhen flag clicked\nset volume to (100) %\nstart sound [Intro music v]\nshow\ngo to [front v] layer\ngo to x: (-240) y: (0)\npoint in direction (-150)\nswitch costume to (op v)\nset [ghost v] effect to (100)\nset [vel v] to [30]\nset size to (30) %\nrepeat until <(x position) = [0]>\n    change x by (vel)\n    turn right (vel) degrees\n    change [ghost v] effect by ((vel) * (-0.5))\n    change size by ((vel) / (6))\n    change [vel v] by (-2)\nend\nset size to (71) %\ncreate clone of (_myself_ v)\nset size to (70) %\ncreate clone of (_myself_ v)\nrepeat (15)\n    set [bounce v] to (((bounce) * (0.7)) + ((80.5) - (size)))\n    change size by (bounce)\nend\nset size to (80) %\nwait (0.2) seconds\npoint in direction (90)\nset [sine v] to [0]\nrepeat (15)\n    point in direction ((90) + (([tan v] of ((sine) * (8)) ) * (10)))\nend\npoint in direction (90)\nset [size vel v] to [18]\nrepeat until <(size vel) < [2]>\n    change [size vel v] by (-2)\n    change size by (size vel)\n    turn left ((size vel) * (4)) degrees\nend\nset [sine v] to [0]\nrepeat until <(x position) < [0]>\n    set x to (([tan v] of ((sine) * (8)) ) * (20))\n    turn right (([tan v] of ((sine) * (8)) ) * (20)) degrees\nend\nrepeat until <(x position) > [0]>\n    set x to (([tan v] of ((sine) * (8)) ) * (20))\n    turn right (((90) - (direction)) / (3)) degrees\nend\nrepeat until <(size vel) < [-17]>\n    change [size vel v] by (-2)\n    change size by ((size vel) / (1.25))\n    turn left ((size vel) * (4)) degrees\nend\npoint in direction (90)\nset x to (0)\nwait (0.5) seconds\ncreate clone of (_myself_ v)\nwait (0.9) seconds\nhide\nwait (1) seconds\nstop [other scripts in sprite v]\nbroadcast (before start v)\n\nwhen I start as a clone\nif <(size) = [80]> then\n    set [sizevel v] to [30]\n    go to x: (0) y: (0)\n    switch costume to (costume1 v)\n    set size to (30) %\n    show\n    go to [front v] layer\n    repeat (30)\n        switch costume to (hax v)\n        change size by (sizevel)\n        change [sizevel v] by (-1)\n        switch costume to (costume1 v)\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nif <(size) = [71]> then\n    set size to (100) %\n    go to [front v] layer\n    switch costume to (poof-0 v)\n    repeat (13)\n        wait (0.005) seconds\n        next costume\n    end\n    delete this clone\nend\n\nwhen flag clicked\nforever\n    change [sine v] by (1)\nend\n\nwhen I start as a clone\nforever\n    if <mouse down?> then\n        delete this clone\n    end\nend\n\n