On The Moon A Platformer 

Instructions: Check Out Cheese Clicker! :) \nhttps://scratch.mit.edu/projects/463354520\n\nTrumpet Clicker Is Out! :) https://scratch.mit.edu/projects/463923422/\n\n\n#11 On Trending 20-12-14! :)\n\n\n\nYay Another Platformer a bit of a more challanging one but I bet you can do it! :)\n\n\nComment your best time mine is 20! :)\n

@Stage\n\nwhen flag clicked\nforever\n    switch backdrop to (Level)\nend\n\n@Cube\n\nwhen flag clicked\nhide variable [☁ highscore v]\n\nwhen flag clicked\nplay sound [Vexento - Pixel Party v] until done\n\nwhen flag clicked\nset [level v] to [1]\nbroadcast (NEXT LEVEL v)\nforever\n    if <key (left arrow v) pressed?> then\n        change [x vel v] by (-1)\n    end\n    if <key (right arrow v) pressed?> then\n        change [x vel v] by (1)\n    end\n    set [x vel v] to ((x vel) * (0.9))\n    change x by (x vel)\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (-4)\n        change x by ((x vel) * (-1))\n        if <key (up arrow v) pressed?> then\n            if <(x vel) > [0]> then\n                set [x vel v] to [-10]\n            else\n                set [x vel v] to [10]\n            end\n            set [y vel v] to [15]\n        else\n            set [x vel v] to [0]\n        end\n    end\n    change [y vel v] by (-1)\n    change y by (y vel)\n    if <touching (level v)?> then\n        change y by ((y vel) - ((y vel) * (2)))\n        set [y vel v] to [0]\n    end\n    change y by (-1)\n    if <<touching (level v)?> and <key (up arrow v) pressed?>> then\n        set [y vel v] to [19]\n    end\n    change y by (1)\n    create clone of (_myself_ v)\n    if <(x position) > [250]> then\n        change [level v] by (1)\n        broadcast (NEXT LEVEL v) and wait\n    end\n    if <touching (spikes v)?> then\n        broadcast (restart v)\n    end\n    if <touching (bounce v)?> then\n        set [y vel v] to [19]\n    end\n    if <touching (enemy v)?> then\n        set [y vel v] to [15]\n    end\nend\n\nwhen I start as a clone\nclear graphic effects\nrepeat (10)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nwhen I receive [next level v]\nbroadcast (restart v)\n\nwhen I receive [restart v]\nset [x vel v] to [0]\nset [y vel v] to [0]\ngo to x: (-226) y: (-4)\n\nwhen flag clicked\ngo to x: (-224) y: (-3)\n\nwhen flag clicked\nforever\n    if <touching (lava v)?> then\n        broadcast (restart v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [9]> then\n        broadcast (you win and time c v)\n    end\nend\n\n@Level\n\nwhen flag clicked\nforever\n    switch costume to (Level)\nend\n\n@Spikes\n\nwhen flag clicked\nforever\n    switch costume to (Level)\nend\n\n@Enemy\n\nwhen flag clicked\ngo to x: (-224) y: (-3)\n\ndefine Clone at (x pos) (y pos)\ngo to x: (x pos) y: (y pos)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\ngo to [front v] layer\nforever\n    if <([x position v] of [cube v]) < (x position)> then\n        change [x vel v] by (-0.5)\n    end\n    if <(x position) < ([x position v] of [cube v])> then\n        change [x vel v] by (0.5)\n    end\n    set [x vel v] to ((x vel) * (0.9))\n    change x by (x vel)\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (-4)\n        change x by ((x vel) * (-1))\n        if <(([y position v] of [cube v]) - (50)) > (y position)> then\n            if <(x vel) > [0]> then\n                set [x vel v] to [-10]\n            else\n                set [x vel v] to [10]\n            end\n            set [y vel v] to [15]\n        else\n            set [x vel v] to [0]\n        end\n    end\n    change [y vel v] by (-1)\n    change y by (y vel)\n    if <touching (level v)?> then\n        change y by ((y vel) - ((y vel) * (2)))\n        set [y vel v] to [0]\n    end\n    change y by (-1)\n    change y by (1)\n    if <touching (bounce v)?> then\n        set [y vel v] to [19]\n    end\n    if <touching (cube v)?> then\n        change y by (-1)\n        if <<touching (level v)?> and <(([y position v] of [cube v]) - (5)) > (y position)>> then\n            delete this clone\n        else\n            broadcast (restart v)\n        end\n        change y by (1)\n    end\nend\n\nwhen I receive [restart v]\nif  then\n    delete this clone\nend\nif <(Level) = [1]> then\n    Clone at [166] [-94]\nend\n\nwhen flag clicked\nhide\ngo to [back v] layer\n\nwhen I receive [restart v]\nif  then\n    delete this clone\nend\nif <(Level) = [7]> then\n    Clone at [166] [-94]\nend\n\nwhen I receive [restart v]\nif  then\n    delete this clone\nend\nif <(Level) = [8]> then\n    Clone at [177] [-84]\nend\n\n@detector\n\nwhen flag clicked\nhide\nset [faved___ v] to [0]\nset [loved__ v] to [0]\nset [clone id v] to [0]\ncreate clone of (_myself_ v)\nwait (0.2) seconds\nset [clone id v] to [1]\ncreate clone of (_myself_ v)\nwait until <<(LOVED__) = [1]> and <(FAVED___) = [1]>>\nwait (1) seconds\nbroadcast (Message v)\nshow\ngo to [front v] layer\ngo to x: (0) y: (50)\nreset timer\nswitch costume to (pick random (1) to (4))\nset [ghost v] effect to (100)\nrepeat until <(timer) > [3.5]>\n    change y by ((y position) / (-15))\n    change [ghost v] effect by (-3)\nend\nreset timer\nrepeat until <(timer) > [3.5]>\n    change y by (((y position) - (-100)) / (-15))\n    change [ghost v] effect by (10)\nend\n\nwhen I start as a clone\nif <(clone id) = [0]> then\n    go to x: (-15) y: (0)\n    set [loved__ v] to [0]\n    switch costume to (love v)\n    forever\n        set [love? v] to <touching (mouse-pointer v)?>\n        if <touching (mouse-pointer v)?> then\n            set [loved__ v] to [1]\n        end\n    end\nend\nif <(clone id) = [1]> then\n    go to x: (0) y: (0)\n    switch costume to (fave v)\n    set [faved___ v] to [0]\n    forever\n        set [fav v] to <touching (mouse-pointer v)?>\n        if <touching (mouse-pointer v)?> then\n            set [faved___ v] to [1]\n        end\n    end\nend\n\n@Moon\n\nwhen flag clicked\nhide\n\nwhen I receive [connecting v]\nswitch costume to (joining v)\nshow\n\nwhen flag clicked\nswitch costume to (connected v)\nshow\ngo to [back v] layer\n\n@Light\n\nwhen flag clicked\nforever\n    wait (0.09) seconds\n    repeat until <(size) > [99]>\n        repeat (10)\n            change size by (2)\n        end\n    end\n    wait (0.09) seconds\n    repeat until <(size) < [81]>\n        repeat (10)\n            change size by (-2)\n        end\n    end\nend\n\nwhen I receive [start outro v]\nhide\n\nwhen flag clicked\nhide\n\nwhen flag clicked\nshow\nforever\n    go to [back v] layer\n    go to (cube v)\nend\n\n@Lava\n\nwhen flag clicked\nset [timer v] to [0]\n\nwhen I receive [you win and time c v]\nstop [other scripts in sprite v]\n\nwhen flag clicked\nforever\n    wait (1) seconds\n    change [timer v] by (1)\nend\n\nwhen flag clicked\nhide variable [timer v]\n\nwhen flag clicked\nforever\n    set [tide v] to [0]\n    repeat (10)\n        change [tide v] by (1)\n    end\n    repeat (20)\n        change [tide v] by (-1)\n    end\n    repeat (10)\n        change [tide v] by (1)\n    end\nend\n\nwhen flag clicked\nforever\n    set y to (Tide)\n    switch costume to (Level)\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [4]> then\n        hide\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [2]> then\n        show\n        go to [back v] layer\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [6]> then\n        show\n        go to [back v] layer\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [8]> then\n        hide\n    end\nend\n\n@You win\n\nwhen flag clicked\nhide\ngo to [back v] layer\n\nwhen I receive [you win and time c v]\nshow\ngo to [front v] layer\nshow variable [timer v]\nset [timer v] to (Timer)\n\nwhen flag clicked\nhide variable [☁ highscore v]\n\n@Thumbnail\n\nwhen flag clicked\nhide\ngo to [back v] layer\n\n