Outer Space - a Platformer #games

Instructions:                                    ᴏᴜᴛᴇʀ sᴘᴀᴄᴇ\n=============================================\n-Say in the comments if this was/wasn't generic\n-Follow me to be notified on any new platformers I make!\nClick this for joy and happiness:\nhttps://scratch.mit.edu/projects/516850396/\n

@Stage\n\nwhen flag clicked\nforever\n    play sound [Open Secrets v] until done\nend\n\n@Drones\n\nwhen flag clicked\nset size to (100) %\nhide\nset rotation style [left-right v]\nforever\n    create clone of (_myself_ v)\n    wait (pick random (0) to (1)) seconds\nend\n\nwhen I start as a clone\nshow\nset [ghost v] effect to (10)\ngo to [back v] layer\nset rotation style [left-right v]\nset y to (pick random (-300) to (300))\nswitch costume to (pick random (1) to (4))\nif <<(costume [name v]) = [1]> or <(costume [name v]) = [2]>> then\n    point in direction (pick random (-90) to (90))\n    set size to (pick random (25) to (50)) %\n    if <[5] < (pick random (1) to (10))> then\n        set x to (231)\n        glide (pick random (1) to (2)) secs to x: (-249) y: (y position)\n    else\n        set x to (-249)\n        glide (pick random (1) to (2)) secs to x: (231) y: (y position)\n    end\nelse\n    if <(costume [number v]) = [3]> then\n        point in direction (-90)\n        set size to (pick random (45) to (60)) %\n        Point [-90] and glide (pick random (1) to (3)) secs\n    end\n    if <(costume [number v]) = [4]> then\n        point in direction (90)\n        set size to (pick random (45) to (60)) %\n        Point [90] and glide (pick random (1) to (3)) secs\n    end\nend\ndelete this clone\n\ndefine Point (degrees) and glide (secs) secs\npoint in direction (degrees)\nif <(degrees) = [90]> then\n    set x to (-249)\n    glide (secs) secs to x: (231) y: (y position)\nend\nif <(degrees) = [-90]> then\n    set x to (231)\n    glide (secs) secs to x: (-249) y: (y position)\nend\n\n@Platforms\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\nforever\n    switch costume to (Level)\nend\n\n@Text\n\nwhen flag clicked\nshow\nforever\n    switch costume to (Level)\n    set [ghost v] effect to (50)\n    go to [front v] layer\nend\n\n@Art\n\nwhen flag clicked\nshow\ngo to [back v] layer\nforever\n    switch costume to (Level)\n    set [ghost v] effect to (10)\nend\n\n@Danger\n\nwhen flag clicked\nshow\ngo to [back v] layer\nforever\n    switch costume to (Level)\nend\n\n@Player\n\nwhen flag clicked\nforever\n    if <key (r v) pressed?> then\n        wait until <not <key (r v) pressed?>>\n        broadcast (Restart v)\n        go to x: (-190) y: (0)\n        set [playerx v] to [0]\n        set [playery v] to [0]\n    end\nend\n\ndefine Player Physics\ngo to [front v] layer\ngo [backward v] (9) layers\nif <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>>> then\n    change [playerx v] by (1.5)\n    switch costume to (player - right v)\nend\nif <<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>>> then\n    change [playerx v] by (-1.5)\n    switch costume to (player - left v)\nend\nif <<<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>>> and <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>>> then\n    switch costume to (player - upright v)\nend\nif <<<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>>> and <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>>> then\n    switch costume to (player - upleft v)\nend\nif <not <<key (right arrow v) pressed?> or <<key (left arrow v) pressed?> or <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<key (a v) pressed?> or <<key (d v) pressed?> or <<<mouse down?> and <(mouse x) > (x position)>> or <<mouse down?> and <(mouse x) < (x position)>>>>>>>>>> then\n    switch costume to (player - normal v)\nend\nif <<key (down arrow v) pressed?> or <<key (s v) pressed?> or <<mouse down?> and <(mouse y) < (y position)>>>> then\n    switch costume to (player - bent v)\nend\nchange x by (PlayerX)\nif <touching (platforms v)?> then\n    change x by ((PlayerX) * (-1))\n    if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n        if <(PlayerX) > [0]> then\n            set [playerx v] to [-15]\n            set [playery v] to [10]\n        else\n            set [playerx v] to [15]\n            set [playery v] to [10]\n        end\n    else\n        set [playerx v] to [0]\n    end\nelse\n    set [playerx v] to ((PlayerX) * (0.8))\nend\nchange y by (PlayerY)\nif <touching (platforms v)?> then\n    change y by ((PlayerY) * (-1))\n    set [playery v] to [0]\n    if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n        switch costume to (player - up v)\n        if <(Jumping?) = [yes]> then\n            set [playery v] to [12]\n            set [jumping? v] to [no]\n        end\n    end\nelse\n    change [playery v] by (-1)\n    set [jumping? v] to [yes]\nend\nif <(x position) > [239]> then\n    change [level v] by (1)\n    go to x: (-190) y: (20)\n    broadcast (Restart v)\n    set [playerx v] to [0]\n    set [playery v] to [0]\nend\nif <touching (bouncy v)?> then\n    if <(Jumping?) = [yes]> then\n        set [playery v] to [16]\n        set [jumping? v] to [no]\n    end\nend\nif <<<<touching (danger v)?> or <(y position) < [-178]>> or <<touching (saws v)?> or <touching (lava v)?>>> or <touching (aliens v)?>> then\n    go to x: (-190) y: (20)\n    set [playerx v] to [0]\n    set [playery v] to [0]\n    change [death v] by (1)\nend\n\nwhen I receive [-intro done  v]\n\nwhen flag clicked\nhide\nset [level v] to [1]\nset [death v] to [0]\nset [signal v] to [disactivated]\nhide variable [death v]\nshow\npoint in direction (90)\ngo to x: (-190) y: (20)\nset [playerx v] to [0]\nset [playery v] to [0]\nforever\n    Player Physics\nend\n\nwhen flag clicked\nforever\n    go to [front v] layer\nend\n\n@Saws\n\ndefine New Saw at (x) (y)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\ngo to [back v] layer\nforever\n    turn right (5) degrees\nend\n\nwhen I receive [restart v]\nwait (0.01) seconds\nset size to (75) %\nhide\nif <(Level) = [2]> then\n    New Saw at [100] [-70]\nend\nif <(Level) = [3]> then\n    New Saw at [225] [75]\n    New Saw at [117] [75]\nend\nif <(Level) = [4]> then\n    New Saw at [-14] [-75]\nend\nif <(Level) = [5]> then\n    New Saw at [115] [50]\n    New Saw at [232] [-87]\nend\nif <(Level) = [6]> then\nif <(Level) = [7]> then\n\nwhen I receive [restart v]\ndelete this clone\n\ngo to [back v] layer\n\n@Aliens\n\nwhen flag clicked\nset rotation style [left-right v]\npoint in direction (90)\nhide\n\nwhen I receive [restart v]\nwait (0.01) seconds\nset [ghost v] effect to (35)\nset size to (130) %\nhide\nif <(Level) = [3]> then\n    Spawn Alien [1]\nend\nif <(Level) = [4]> then\n    Spawn Alien [2]\nend\nif <(Level) = [5]> then\n\ndefine Spawn Alien (clone id)\nset [alien v] to (clone id)\ncreate clone of (_myself_ v)\n\nwhen I receive [restart v]\ndelete this clone\n\nwhen I start as a clone\nset rotation style [left-right v]\nshow\nset [ghost v] effect to (50)\nif <(Alien) = [1]> then\n    go to x: (210) y: (-40)\n    forever\n        point in direction (-90)\n        glide (1) secs to x: (100) y: (-40)\n        point in direction (90)\n        glide (1) secs to x: (210) y: (-40)\n    end\nend\nif <(Alien) = [2]> then\n    go to x: (-180) y: (100)\n    forever\n        point in direction (90)\n        glide (1) secs to x: (180) y: (100)\n        point in direction (-90)\n        glide (1) secs to x: (-180) y: (100)\n    end\nend\n\n@Sprite2\n\ndefine size (zz)\nset size to (0) %\nset [ghost v] effect to (100)\nshow\nrepeat (30)\n    change size by (((zz) - (size)) / (5))\n    change [ghost v] effect by (-1)\nend\nwait (0.1) seconds\nrepeat (30)\n    change [ghost v] effect by (1)\nend\ndelete this clone\n\nwhen flag clicked\nhide\n\nwhen flag clicked\nforever\n    point in direction (pick random (0) to (360))\n    set size to (pick random (1) to (3)) %\n    create clone of (_myself_ v)\n    wait (0.5) seconds\n    switch costume to (pick random (1) to (3))\nend\n\nwhen I receive [start game v]\nforever\n    create clone of (_myself_ v)\n    wait (0.5) seconds\nend\n\nwhen I start as a clone\nshow\ngo to [back v] layer\npoint in direction (pick random (0) to (360))\ngo to (random position v)\nswitch costume to (pick random (1) to (3))\nsize (pick random (50) to (200))\n\n@Thumbnail\n\nwhen flag clicked\nhide\nforever\n    reset timer\nend\n\nwhen [timer v] > (0.0001)\ngo to [front v] layer\nshow\n\n