Moon - A 360 Platformer

Instructions: Moon - A 360 Platformer!\n\nPlease Love and Fave if you enjoyed it.\n\nArrow Keys to move!\n\nYou are playing on the moon, pretty much just collect all those green flags!\n\n\n\n\n#Fun\n#360\n#Platformer\n#Games\n#Hard\n#Nathanimations_\n#All\n#all\n#game\n#platformers

@Stage\n\nwhen flag clicked\nforever\n    play sound [Unlimited v] until done\nend\n\n@less lag\n\n@Platforms\n\ndefine Position\ngo to x: ((0) - (Scroll X)) y: ((0) - (Scroll Y))\npoint in direction ((0) - (Rotation))\n\nwhen I receive [tick v]\nPosition\n\nwhen flag clicked\nswitch costume to (costume2 v)\nforever\n    switch costume to (Level)\nend\n\nwhen I receive [next level v]\n\nnext costume\n\nchange [level v] by (1)\n\n@Player\n\nwhen I receive [start v]\nset [change? v] to [0]\n\ndefine Get Direction (dx) (dy)\nif <(dy) = [0]> then\n    if <(dx) > [0]> then\n        set [get direction? v] to [90]\n    else\n        set [get direction? v] to [-90]\n    end\nelse\n    set [get direction? v] to ([atan v] of ((dx) / (dy)) )\n    if <(dy) < [0]> then\n        if <(dx) > [0]> then\n            change [get direction? v] by (180)\n        else\n            if <(dx) < [0]> then\n                change [get direction? v] by (-180)\n            else\n                set [get direction? v] to [180]\n            end\n        end\n    end\nend\n\ndefine Move (sx) (sy)\nchange [position x v] by (sx)\nchange [position y v] by (sy)\nPosition\nif <touching color (#999999)?> then\n    repeat (6)\n        change [position x v] by ((1) * ([sin v] of ((Rotation) + (0)) ))\n        change [position y v] by ((1) * ([cos v] of ((Rotation) + (0)) ))\n        Position\n        if <not <touching color (#999999)?>> then\n            set [collided? v] to [1]\n            set [can jump? v] to [5]\n            stop [this script v]\n        end\n    end\n    change [position x v] by (((-6) * ([sin v] of ((Rotation) + (0)) )) - (sx))\n    change [position y v] by (((-6) * ([cos v] of ((Rotation) + (0)) )) - (sy))\n    Position\n    set [collided? v] to [2]\nelse\n    set [collided? v] to [0]\nend\n\ndefine Position\nset [tx v] to (((Position X) * ([cos v] of (Rotation) )) - ((Position Y) * ([sin v] of (Rotation) )))\nset [ty v] to (((Position X) * ([sin v] of (Rotation) )) + ((Position Y) * ([cos v] of (Rotation) )))\ngo to x: ((tx) - (Scroll X)) y: ((ty) - (Scroll Y))\n\ndefine Tick\nset [new speed x v] to [0]\nif <key (left arrow v) pressed?> then\n    switch costume to (costume2 v)\n    set [new speed x v] to [-5]\nelse\n    if <key (right arrow v) pressed?> then\n        switch costume to (costume1 v)\n        set [new speed x v] to [5]\n    else\n        switch costume to (ball v)\n    end\nend\nif <(Can Jump?) > [0]> then\n    change [can jump? v] by (-1)\n    if <key (up arrow v) pressed?> then\n        set [speed x v] to ((10) * ([sin v] of ((Rotation) + (0)) ))\n        set [speed y v] to ((10) * ([cos v] of ((Rotation) + (0)) ))\n    end\nend\nchange [speed x v] by ((1) * ([sin v] of ((Rotation) + (180)) ))\nchange [speed y v] by ((1) * ([cos v] of ((Rotation) + (180)) ))\nMove (Speed X) (Speed Y)\nif <(collided?) > [0]> then\n    set [speed x v] to [0]\n    set [speed y v] to [0]\nend\nif <not <(New Speed X) = [0]>> then\n    set [new speed y v] to ((New Speed X) * ([cos v] of ((Rotation) + (90)) ))\n    set [new speed x v] to ((New Speed X) * ([sin v] of ((Rotation) + (90)) ))\n    Move (New Speed X) (New Speed Y)\nend\nGet Direction (Position X) (Position Y)\nset [rotation v] to (Get Direction?)\nset [scroll x v] to (((Position X) * ([cos v] of (Rotation) )) - ((Position Y) * ([sin v] of (Rotation) )))\nset [scroll y v] to (((Position X) * ([sin v] of (Rotation) )) + ((Position Y) * ([cos v] of (Rotation) )))\nPosition\n\nMove ((Speed X) + (New Speed X)) ((Speed Y) + (New Speed Y))\n\nwhen flag clicked\ngo to [front v] layer\nset [level v] to [1]\nset [position x v] to [0]\nset [position y v] to [250]\nset [speed x v] to [0]\nset [speed y v] to [0]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset [rotation v] to [0]\nset [can jump? v] to [0]\nGet Direction (Position X) (Position Y)\nset [rotation v] to (Get Direction?)\nset [scroll x v] to (((Position X) * ([cos v] of (Rotation) )) - ((Position Y) * ([sin v] of (Rotation) )))\nset [scroll y v] to (((Position X) * ([sin v] of (Rotation) )) + ((Position Y) * ([cos v] of (Rotation) )))\nPosition\nbroadcast (tick v) and wait\nforever\n    Tick\n    broadcast (tick v)\nend\n\nset [speed x v] to [0]\nset [speed y v] to [0]\n\n\n\n\n\nswitch costume to (costume2 v)\nset [new speed x v] to [-5]\n\nwhen flag clicked\nforever\n    if <<<touching color (#41ff40)?> or > and <(Level) = [1]>> then\n        broadcast (NEXT LEVEL v)\n        go to [front v] layer\n        reset\n    end\n    wait (0.00001) seconds\n    if <<<touching color (#41ff40)?> or > and <(Level) = [2]>> then\n        broadcast (NEXT LEVEL v)\n        go to [front v] layer\n        reset\n    end\n    wait (0.00001) seconds\n    if <<<touching color (#41ff40)?> or > and <(Level) = [3]>> then\n        broadcast (NEXT LEVEL v)\n        go to [front v] layer\n        reset\n    end\n    wait (0.00001) seconds\n    if <<<touching color (#41ff40)?> or > and <(Level) = [4]>> then\n        broadcast (NEXT LEVEL v)\n        go to [front v] layer\n        reset\n    end\n    wait (0.00001) seconds\n    if <<<touching color (#41ff40)?> or > and <(Level) = [5]>> then\n        broadcast (NEXT LEVEL v)\n        go to [front v] layer\n        reset\n    end\n    wait (0.00001) seconds\n    if <<<touching color (#41ff40)?> or <touching color (#2aeb28)?>> and <(Level) = [6]>> then\n        broadcast (NEXT LEVEL v)\n        go to [front v] layer\n        reset\n    end\n    wait (0.00001) seconds\nend\n\nset [level v] to [2]\n\nset [level v] to [3]\n\nset [level v] to [4]\n\nset [level v] to [5]\n\nset [level v] to [6]\n\nset [level v] to [7]\n\nchange [level v] by (1)\n\nwhen flag clicked\nforever\n    if <<touching color (#f5f5f5)?> or <touching color (#c6c6c6)?>> then\n        set [position x v] to [0]\n        set [position y v] to [250]\n        set [speed x v] to [0]\n        set [speed y v] to [0]\n        set [scroll x v] to [0]\n        set [scroll y v] to [0]\n        set [rotation v] to [0]\n        set [can jump? v] to [0]\n    end\n    if <touching color (#ff0000)?> then\n        set [position x v] to [0]\n        set [position y v] to [250]\n        set [speed x v] to [0]\n        set [speed y v] to [0]\n        set [scroll x v] to [0]\n        set [scroll y v] to [0]\n        set [rotation v] to [0]\n        set [can jump? v] to [0]\n    end\nend\n\ngo to x: (0) y: (0)\n\nwhen flag clicked\nforever\n    if <touching color (#41ff40)?> then\n    end\nend\n\n@Sprite1\n\nwhen I receive [next level v]\nshow\ngo to [front v] layer\nset [ghost v] effect to (100)\nrepeat (50)\n    change [ghost v] effect by (-2)\nend\nchange [level v] by (1)\nrepeat (50)\n    change [ghost v] effect by (2)\nend\nset [ghost v] effect to (100)\n\nwhen flag clicked\nhide\n\n@Sprite2\n\nwhen flag clicked\nhide\n\nshow\ngo to [front v] layer\n\n