Space - A Platformer

Instructions: Arrow keys or WASD to move. (Mobile compatible)\n

@Stage\n\nwhen flag clicked\nset volume to (70) %\nforever\n    play sound [bensound-summer v] until done\nend\n\n@Logo\n\nwhen flag clicked\ngo to x: (-30) y: (-16)\n\nwhen flag clicked\npoint in direction (90)\ngo to x: (0) y: (90)\nset size to (100) %\nhide\nset [ghost v] effect to (100)\nwait (0.5) seconds\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nbroadcast (background v)\n\nwhen flag clicked\nset [sine v] to [0]\npoint in direction (90)\nforever\n    change [sine v] by (6.5)\n    point in direction ((([sin v] of (sine) ) * (4)) + (90))\n    set size to ((([sin v] of ((sine) * (2)) ) * (9)) + (100)) %\nend\n\nwhen I receive [hide v]\nhide\n\nglide (1) secs to (random position v)\n\n@Background\n\nwhen flag clicked\nhide\nset [ghost v] effect to (100)\n\nwhen I receive [background v]\nshow\nrepeat (5)\n    change [ghost v] effect by (-20)\nend\nbroadcast (playbutton v)\n\nwhen I receive [hide v]\nhide\n\n@PlayButton\n\nwhen flag clicked\nset [clickable? v] to [1]\nset size to (160) %\nforever\n    set size to (160) %\n    if <touching (mouse-pointer v)?> then\n        repeat (2)\n            change size by (10)\n        end\n        wait until <not <touching (mouse-pointer v)?>>\n    else\n        repeat (2)\n            change size by (-10)\n        end\n        wait until <touching (mouse-pointer v)?>\n    end\nend\n\nwhen flag clicked\nhide\ngo to x: (-277) y: (-155)\n\nwhen I receive [playbutton v]\nshow\nset [speed v] to [64]\nrepeat until <(speed) < [1.6]>\n    change x by (speed)\n    change [speed v] by (((speed) / (2)) * (-1))\nend\n\nwhen this sprite clicked\nif <(clickable?) = [1]> then\n    set [clickable? v] to [0]\n    start sound [Click v]\n    broadcast (game v)\nelse\nend\n\nwhen I receive [hide v]\nhide\n\n@Fade\n\nwhen flag clicked\ngo to [front v] layer\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\nhide\n\nwhen I receive [game v]\nshow\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\nbroadcast (hide v)\nwait (0.5) seconds\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nhide\n\nwhen I receive [game v]\nshow\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\nbroadcast (gamestart v)\nwait (0.5) seconds\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nhide\n\n@You\n\nwhen flag clicked\nhide\nset [lvl v] to [1]\n\ndefine Reset\ngo to x: (-213) y: (-11)\nset [movement v] to [False]\nset [x v] to [0]\nset [y v] to [0]\nwait (0.3) seconds\nset [movement v] to [True]\n\nwhen flag clicked\nset [blastable? v] to [1]\nforever\n    if < ((lvl) / (10)) contains [.]?> then\n        if <not <(lvl) = [31]>> then\n            if <(x position) > [232]> then\n                change [lvl v] by (1)\n                Reset\n            end\n        end\n    else\n        if <touching (rocket ship v)?> then\n            if <(blastable?) = [1]> then\n                broadcast (blastoff v)\n                set [blastable? v] to [0]\n            end\n        end\n    end\n    if <touching (spikes v)?> then\n        start sound [Crunch v]\n        Reset\n    end\nend\n\nwhen I start as a clone\nswitch costume to (costume2 v)\nset [ghost v] effect to (10)\nrepeat (16)\n    change [ghost v] effect by (7)\n    change size by (-4)\nend\ndelete this clone\n\nwhen I receive [gamestart v]\nswitch costume to (costume1 v)\nset [movement v] to [False]\nwait (0.1) seconds\nset [movement v] to [True]\ngo to x: (-213) y: (-11)\nshow\nset [y v] to [0]\nset [x v] to [0]\nset rotation style [left-right v]\nset size to (70) %\nforever\n    change [y v] by (-0.5)\n    if <(Movement) = [True]> then\n        if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(x position) < (mouse x)>>> then\n            point in direction (90)\n            change [x v] by (1)\n        end\n        if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n            point in direction (-90)\n            change [x v] by (-1)\n        end\n    end\n    set [x v] to ((x) * (0.85))\n    change x by (x)\n    if <touching (ground v)?> then\n        change y by (1)\n        if <touching (ground v)?> then\n            change y by (1)\n            if <touching (ground v)?> then\n                change y by (1)\n                if <touching (ground v)?> then\n                    change y by (1)\n                    if <touching (ground v)?> then\n                        change y by (1)\n                        if <touching (ground v)?> then\n                            change y by (1)\n                            if <touching (ground v)?> then\n                                change y by (-6)\n                                if <<<key (w v) pressed?> or <key (up arrow v) pressed?>> or <<mouse down?> and <((mouse y) - (y position)) > [50]>>> then\n                                    set [y v] to [10]\n                                    if <(x) > [0]> then\n                                        set [x v] to [-10]\n                                    else\n                                        set [x v] to [10]\n                                    end\n                                else\n                                    change x by ((x) * (-1))\n                                    set [x v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (y)\n    if <touching (ground v)?> then\n        change y by ((y) * (-1))\n        set [y v] to [0]\n    end\n    change y by (-0.5)\n    if <<touching (ground v)?> and <<<key (w v) pressed?> or <key (up arrow v) pressed?>> or <<mouse down?> and <((mouse y) - (y position)) > [50]>>>> then\n        start sound [Jump v]\n        set [y v] to [8.5]\n    end\n    change y by (0.5)\nend\n\nwhen I receive [game v]\nforever\n    create clone of (_myself_ v)\nend\n\nwhen I receive [reset v]\nReset\nset [blastable? v] to [1]\n\n@Ground\n\nwhen I receive [gamestart v]\nshow\nforever\n    switch costume to (lvl)\nend\n\nwhen flag clicked\nhide\n\n@Spikes\n\nwhen I receive [gamestart v]\nshow\nforever\n    switch costume to (lvl)\nend\n\nwhen flag clicked\nhide\n\n@Swipe\n\nwhen flag clicked\ngo to x: (0) y: (400)\nhide\n\nwhen I receive [blastoff v]\ngo to [front v] layer\ngo to x: (0) y: (345)\nshow\nset [speed v] to [-5]\nrepeat until <(y position) < [-338]>\n    change y by (speed)\n    change [speed v] by (-1)\nend\nhide\n\nwhen I receive [blastoff v]\nwait until <(y position) < [8]>\nchange [lvl v] by (1)\nbroadcast (reset v)\nstop [this script v]\n\n@Rocket Ship\n\nwhen flag clicked\nswitch costume to (costume1 v)\nforever\n    if < ((lvl) / (10)) contains [.]?> then\n        hide\n    else\n        go to x: (0) y: (-65)\n        show\n    end\nend\n\n@Thumbnail\n\nwhen flag clicked\nhide\nforever\n    go to [front v] layer\nend\n\n