Neon 2 - Platformer

Instructions: Use WAD or arrow keys! If you haven't played Neon 1 then go play it here!: https://scratch.mit.edu/projects/456101691/\nThanks for all the support!

@Stage\n\nwhen flag clicked\nforever\n    play sound [Vexento - Happy Robot v] until done\nend\n\n@player\n\nwhen I start as a clone\nswitch costume to (trail v)\nrepeat (10)\n    change [ghost v] effect by (10)\n    change size by (-1)\nend\ndelete this clone\n\nwhen I receive [restart v]\nstart sound [Crunch v]\nset [x v] to [0]\nset [y v] to [0]\ngo to x: (x spawn) y: (y spawn)\n\nwhen flag clicked\nbroadcast (BEGIN NOW v)\n\nhide\n\ndefine run engine\nchange [y v] by (-0.5)\nif < or <key (a v) pressed?>> then\n    switch costume to (rightt2 v)\n    change [x v] by (-.6)\nend\nif < or <key (d v) pressed?>> then\n    switch costume to (left2 v)\n    change [x v] by (.6)\nend\nset [x v] to ((x) * (0.9))\nchange x by (x)\nif <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                            change x by ((x) * (-1))\n                            if <<key (up arrow v) pressed?> or <<key (space v) pressed?> or <key (w v) pressed?>>> then\n                                set [y v] to [7]\n                                if <(x) > [0]> then\n                                    set [x v] to [-10]\n                                else\n                                    set [x v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nchange y by (y)\nif <touching (ground v)?> then\n    change y by ((y) * (-1))\n    set [y v] to [0]\nend\nchange y by (-0.5)\nif <<<touching (ground v)?> and <key (up arrow v) pressed?>> or <<<touching (ground v)?> and <key (space v) pressed?>> or <<touching (ground v)?> and <key (w v) pressed?>>>> then\n    switch costume to (up2earth v)\n    set [y v] to [9.5]\nend\nchange y by (0.5)\nif <<touching (danger v)?> or <<touching (saw v)?> or <touching (lava v)?>>> then\n    broadcast (Restart v)\nend\nif <(level) = [14]> then\ncreate clone of (_myself_ v)\n\nset [moving_? v] to [y]\n\nset [moving_? v] to [y]\n\nset [moving_? v] to [y]\n\nset [moving_? v] to [n]\n\npoint in direction (90)\ngo to x: (x spawn) y: (y spawn)\n\nwhen I receive [next v]\ngo to x: (x spawn) y: (y spawn)\n\nwhen I receive [begin now v]\nset [level v] to [1]\nshow\nset [x spawn v] to [-199]\nset [y spawn v] to [-76]\ngo to x: (x spawn) y: (y spawn)\nswitch costume to (1 v)\nswitch backdrop to (backdrop3 v)\nset size to (40) %\nset [x v] to [0]\nset [y v] to [0]\nforever\n    run engine\nend\n\nset rotation style [left-right v]\n\nset [brightness v] effect to (-7)\n\nset [moving_? v] to [y]\n\nwhen flag clicked\nforever\n    switch costume to (costume1 v)\nend\n\nwhen flag clicked\nforever\n    if <<<key (left arrow v) pressed?> or <<<key (right arrow v) pressed?> or > or <key (d v) pressed?>>> or <key (a v) pressed?>> then\n        set [moving_? v] to [y]\n    else\n        set [moving_? v] to [n]\n    end\nend\n\nif <<touching (ground v)?> and <<key (up arrow v) pressed?> or <<key (space v) pressed?> and <<key (w v) pressed?> or <touching (ground v)?>>>>> then\n    set [moving_? v] to [up]\nend\n\n\n\nif <(MOVING_?) = [u]> then\n    switch costume to (up v)\nend\n\nif <(y position) > [-60]> then\n    set [moving_? v] to [u]\nelse\n    set [moving_? v] to [n]\nend\n\nrepeat until <(costume [number v]) = [6]>\n\nset [moving_? v] to [n]\n\nif <(MOVING_?) = [y]> then\n    wait (.01) seconds\n    next costume\nelse\n    switch costume to (1 v)\nend\n\ncreate clone of (_myself_ v)\n\nforever\n    if <(MOVING_?) = [y]> then\n        wait (.01) seconds\n        next costume\n    else\n        switch costume to (1 v)\n    end\nend\n\nswitch costume to (up v)\n\nwhen flag clicked\nforever\n    if <not <<key (w v) pressed?> or <<key (a v) pressed?> or <<key (d v) pressed?> or <<key (up arrow v) pressed?> or <<key (right arrow v) pressed?> or >>>>>> then\n        switch costume to (center v)\n    end\nend\n\nset [brightness v] effect to (-9)\n\nset rotation style [left-right v]\n\nclear graphic effects\nset [brightness v] effect to (-7)\nrepeat (10)\n    change y by (6)\n    change [ghost v] effect by (10)\nend\nset [brightness v] effect to (-7)\nrepeat (10)\n    change y by (-1)\n    change [ghost v] effect by (-10)\nend\n\nwhen flag clicked\nforever\n\nchange [color v] by (0)\nwait (.3) seconds\n\n@transition\n\nwhen flag clicked\nhide\ngo to [front v] layer\ngo to x: (0) y: (347)\n\nwhen I receive [trans v]\ngo to x: (0) y: (0)\nshow\nset [ghost v] effect to (20)\nrepeat (20)\n    change [ghost v] effect by (-6)\nend\nwait (.1) seconds\nrepeat (20)\n    change [ghost v] effect by (6)\nend\nhide\n\nswitch costume to (pick random (1) to (6))\nshow\nrepeat until <(round (y position)) = [0]>\n    go to [front v] layer\n    change y by (((0) - (y position)) / (5))\nend\nrepeat until <(round (y position)) = [347]>\n    go to [front v] layer\n    change y by (15)\nend\nhide\n\nwhen I receive [next v]\nwait (0) seconds\nbroadcast (trans v)\n\nswitch costume to (pick random (1) to (6))\nshow\nrepeat until <(round (y position)) = [0]>\n    go to [front v] layer\n    change y by (((0) - (y position)) / (5))\nend\nrepeat until <(round (y position)) = [347]>\n    go to [front v] layer\n    change y by (((347) - (y position)) / (5))\nend\nhide\n\n@ground\n\nwhen flag clicked\ngo to x: (1) y: (-8)\nforever\n    switch costume to (level)\nend\n\ngo to [front v] layer\n\nwhen I receive [next v]\n\n@lava\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    go to [back v] layer\n    switch costume to (level)\nend\n\n@tn\n\nwhen flag clicked\ngo to [front v] layer\nshow\nwait (1) seconds\nhide\n\nshow\n\n