A Ninjago Platformer

Instructions: -----------A NINJAGO PLATFORMER-------------\n-Arrow Keys or WASD to move/jump-\n\nObjective:- Flag- \n\nObstructions: -Spikes-\n\nHelpers: -Jump Panel-    -"T" to Skip Level (except it sets your time to 9999!-  :P

@Stage\n\nwhen flag clicked\nswitch backdrop to (title v)\nforever\n    forever\n        if <(backdrop) = [1]> then\n            switch backdrop to (1 v)\n        end\n        if <(backdrop) = [2]> then\n            switch backdrop to (2 v)\n        end\n        if <(backdrop) = [3]> then\n            switch backdrop to (3 v)\n        end\n        if <(backdrop) = [4]> then\n            switch backdrop to (4 v)\n        end\n        if <(backdrop) = [5]> then\n            switch backdrop to (5 v)\n        end\n        if <(backdrop) = [6]> then\n            switch backdrop to (6 v)\n        end\n        if <(backdrop) = [7]> then\n            switch backdrop to (7 v)\n        end\n        if <(backdrop) = [8]> then\n            switch backdrop to (8 v)\n        end\n        if <(backdrop) = [9]> then\n            switch backdrop to (9 v)\n        end\n        if <(backdrop) = [10]> then\n            switch backdrop to (10 v)\n        end\n        if <(backdrop) = [Title]> then\n            switch backdrop to (title v)\n        end\n        if <(backdrop) = [Pause]> then\n            switch backdrop to (pause v)\n        end\n    end\nend\n\nwhen I receive [finish v]\nset [backdrop v] to (Level)\n\nset [level v] to [9]\n\n@Player\n\nwhen flag clicked\nset [☁ time v] to [0]\nset [x vel v] to [0]\nset [game v] to [Title]\nset [level v] to [0]\nset [backdrop v] to [Title]\nhide\nset size to (100) %\ngo to [front v] layer\ngo to x: (2) y: (2)\nforever\n    if <(Game) = [Play]> then\n        show\n        set [level v] to [1]\n        go to x: (-205) y: (-129)\n        point in direction (90)\n        forever\n            if <<(Level) = [7]> or <(Level) = [8]>> then\n                platform physics [-1] [.5] [2.5] [7]\n            else\n                platform physics [-1] [.7] [2] [11]\n            end\n            if <<touching (spikes v)?> or <touching (crushers v)?>> then\n                go to x: (-205) y: (-129)\n                set [x vel v] to [0]\n                set [y vel v] to [0]\n                broadcast (death v)\n            end\n            if <touching (finish v)?> then\n                broadcast (next level v)\n                change [level v] by (1)\n                go to x: (-205) y: (-129)\n                set [x vel v] to [0]\n                point in direction (90)\n                set [y vel v] to [-5]\n                switch costume to (idle v)\n                broadcast (finish v)\n            end\n            if <touching (trampolines v)?> then\n                set [y vel v] to [17]\n            end\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    set [walk v] to [3]\n    wait (0.05) seconds\n    set [walk v] to [4]\n    wait (0.05) seconds\nend\n\nwhen flag clicked\nforever\n    broadcast (positon check v)\nend\n\nwhen flag clicked\nforever\n    if <<(Level) = [7]> or <(Level) = [8]>> then\n        set size to (50) %\n    else\n        set size to (100) %\n    end\nend\n\nwhen flag clicked\nforever\n    if <<(Game) = [Pause]> or <(Game) = [Title]>> then\n        set [ghost v] effect to (100)\n    else\n        set [ghost v] effect to (0)\n    end\nend\n\nwhen flag clicked\nforever\n    if <not <<(Level) = [0]> or <(Level) = [10]>>> then\n        if <key (t v) pressed?> then\n            wait until <not <key (t v) pressed?>>\n            broadcast (next level v)\n            change [level v] by (1)\n            go to x: (-205) y: (-129)\n            set [x vel v] to [0]\n            point in direction (90)\n            set [y vel v] to [-5]\n            switch costume to (idle v)\n            broadcast (finish v)\n        end\n    end\nend\n\nwhen flag clicked\nset [☁ best time v] to (☁ Best Time)\nforever\n    if <not <<(Level) = [0]> or <(Level) = [10]>>> then\n        if <key (t v) pressed?> then\n            wait until <not <key (t v) pressed?>>\n            set [time v] to [9999]\n            wait (5) seconds\n            hide variable [time v]\n        end\n    end\n    if <(Level) = [10]> then\n        set [t? v] to [n]\n        wait (0.004) seconds\n        set [☁ time v] to (TIME)\n        if <(☁ Best Time) > (☁ Time)> then\n            set [☁ best time v] to (☁ Time)\n        end\n    end\nend\n\nwhen flag clicked\nwait until <(Game) = [Play]>\nforever\n    if <<(Level) = [10]> or <(Game) = [Pause]>> then\n        show variable [☁ best time v]\n    else\n        hide variable [☁ best time v]\n    end\nend\n\nwhen flag clicked\n\nshow variable [☁ best time v]\nwait until <(Level) = [11]>\nforever\n\nset [☁ best time v] to [68.2]\n\nset [☁ time v] to [0]\n\nmove (7-10.52.5) steps\n\nmove (11-10.72) steps\n\nset [x plat speed v] to [jump]\n\nset [x plat speed v] to [gravity]\n\nset [x plat speed v] to [movement]\n\nset [x plat speed v] to [movement]\n\nset [x plat speed v] to [friction]\n\ndefine platform physics (gravity) (friction) (movement speed) (jump height)\nswitch costume to (hitbox v)\nchange y by (y vel)\nif <touching (ground v)?> then\n    repeat ([abs v] of (y vel) )\n        if <touching (ground v)?> then\n            change y by ((-1) * (([abs v] of (y vel) ) / (y vel)))\n        end\n    end\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <not <(y vel) > [0]>>> then\n        set [y vel v] to (jump height)\n    else\n        set [y vel v] to [0]\n    end\nelse\n    change [y vel v] by (gravity)\nend\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    change [x vel v] by (movement speed)\n    point in direction (90)\nend\nif <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n    change [x vel v] by ((-1) * (movement speed))\n    point in direction (-90)\nend\nchange x by (x vel)\nif <touching (ground v)?> then\n    set [old y v] to (y position)\n    repeat (([abs v] of (x vel) ) + (1))\n        if <touching (ground v)?> then\n            change y by (1)\n        end\n    end\n    if <touching (ground v)?> then\n        set y to (old y)\n        repeat ([ceiling v] of ([abs v] of (x vel) ) )\n            if <touching (ground v)?> then\n                change x by ((-1) * (([abs v] of (x vel) ) / (x vel)))\n            end\n        end\n        set [x vel v] to [0]\n    end\nend\nset [x vel v] to ((x vel) * (friction))\n\nswitch costume to (idle v)\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<key (left arrow v) pressed?> or <key (a v) pressed?>>> then\n    switch costume to (Walk)\nend\nif <(y vel) > [1]> then\n    switch costume to (jump v)\nend\nif <(y vel) < [-3]> then\n    switch costume to (fall v)\nend\n\n@Ground\n\nwhen flag clicked\nset [ghost v] effect to (100)\nshow\nforever\n    if <(Game) = [Play]> then\n        set [ghost v] effect to (0)\n        switch costume to (Level)\n        go to x: (0) y: (0)\n        switch costume to (costume1 v)\n    end\nend\n\nwhen I receive [next level v]\n\nnext costume\n\nwhen flag clicked\nforever\n    if <(Game) = [Pause]> then\n        set [ghost v] effect to (100)\n    end\nend\n\nset [☁ best time v] to [76.5]\n\n@Trampolines\n\nwhen flag clicked\nhide\nforever\n    if <(Game) = [Play]> then\n        show\n        switch costume to (Level)\n        go to x: (0) y: (0)\n        switch costume to (costume1 v)\n    end\nend\n\nwhen I receive [next level v]\n\nnext costume\n\nwhen flag clicked\nforever\n    if <(Game) = [Pause]> then\n        switch costume to (pause v)\n    end\nend\n\n@Spikes\n\nwhen flag clicked\nhide\nforever\n    if <(Game) = [Play]> then\n        show\n        switch costume to (Level)\n        go to x: (0) y: (0)\n        switch costume to (costume1 v)\n    end\nend\n\nnext costume\n\nwhen I receive [next level v]\n\nwhen flag clicked\nforever\n    if <(Game) = [Pause]> then\n        switch costume to (pause v)\n    end\nend\n\n@Finish\n\nbroadcast (next level v)\n\nwhen flag clicked\nforever\n    next costume\n    wait (0.05) seconds\nend\n\nwhen flag clicked\nforever\n    if <<(Level) = [7]> or <(Level) = [8]>> then\n        set size to (50) %\n    else\n        set size to (70) %\n    end\nend\n\nset [level v] to [9]\n\nwhen flag clicked\nset [game v] to [Title]\nhide\ngo to [front v] layer\nforever\n    if <(Game) = [Play]> then\n        show\n        go to x: (0) y: (0)\n        set size to (70) %\n        forever\n            if <(Level) = [1]> then\n                go to x: (-202) y: (65)\n            end\n            if <(Level) = [2]> then\n                go to x: (190) y: (131)\n            end\n            if <(Level) = [3]> then\n                go to x: (190) y: (120)\n            end\n            if <(Level) = [4]> then\n                go to x: (5) y: (-45)\n            end\n            if <(Level) = [5]> then\n                go to x: (210) y: (85)\n            end\n            if <(Level) = [6]> then\n                go to x: (187) y: (139)\n            end\n            if <(Level) = [7]> then\n                go to x: (198) y: (150)\n            end\n            if <(Level) = [8]> then\n                go to x: (-106) y: (-7)\n            end\n            if <(Level) = [9]> then\n                go to x: (-217) y: (36)\n            end\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <<<(Game) = [Pause]> or <(Game) = [Title]>> or <(Level) = [10]>> then\n        hide\n    else\n        show\n    end\nend\n\n@Bandana\n\nwhen flag clicked\nforever\n    set [walk v] to [3]\n    wait (0.05) seconds\n    set [walk v] to [4]\n    wait (0.05) seconds\nend\n\nwhen I receive [positon check v]\ngo to (player v)\n\nwhen flag clicked\nset [game v] to [Title]\nhide\nset size to (100) %\npoint in direction (90)\nforever\n    if <(Game) = [Play]> then\n        show\n        forever\n            if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n                point in direction (90)\n                switch costume to (Walk)\n            end\n            if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n                point in direction (-90)\n                switch costume to (Walk)\n            end\n        end\n    end\nend\n\nwhen I receive [next level v]\npoint in direction (90)\n\nwhen flag clicked\nforever\n    if <<(Level) = [7]> or <(Level) = [8]>> then\n        set size to (50) %\n    else\n        set size to (100) %\n    end\nend\n\nwhen flag clicked\nforever\n    if <<(Game) = [Pause]> or <(Game) = [Title]>> then\n        hide\n    else\n        show\n    end\nend\n\n@Play\n\nwhen flag clicked\nshow variable [☁ best time v]\nset [time v] to [0]\nhide variable [time v]\ngo to [front v] layer\nforever\n    set y to ((-30) + (([cos v] of (((timer) - (0)) * (170)) ) * (6)))\nend\n\nwhen flag clicked\nforever\n    if <<(Game) = [Play]> or <(Game) = [Pause]>> then\n        hide\n    else\n        show\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (mouse-pointer v)?> then\n        set size to ((size) + (((120) - (size)) / (4))) %\n    else\n        set size to ((size) + (((100) - (size)) / (3))) %\n    end\nend\n\nwhen this sprite clicked\nset [game v] to [Play]\nset [pause v] to [y]\nset [backdrop v] to [1]\nshow variable [time v]\nforever\n    if <not <(Level) = [10]>> then\n        if <(T?) = [y]> then\n            wait (0.06) seconds\n            change [time v] by (0.1)\n        end\n        if <(T?) = [n]> then\n            set [time v] to (TIME)\n        end\n    end\nend\n\n@Music\n\nwhen flag clicked\ngo to [front v] layer\nforever\n    repeat until <(Game) = [Play]>\n        play sound [Calm Before The Storm - PaulRHJT v] until done\n    end\nend\n\nwhen flag clicked\nwait (0.5) seconds\nforever\n    if <(Game) = [Play]> then\n        stop all sounds\n        play sound [Jump! - PaulRHJT v] until done\n    end\nend\n\nwhen I receive [death v]\nstart sound [death v]\n\nwhen I receive [finish v]\nstart sound [finish v]\n\nwhen flag clicked\nforever\n    set y to ((0) + (([cos v] of (((timer) - (4)) * (170)) ) * (6)))\nend\n\nwhen flag clicked\nforever\n    if <touching (mouse-pointer v)?> then\n        set size to ((size) + (((27) - (size)) / (10))) %\n    else\n        set size to ((size) + (((20) - (size)) / (3))) %\n    end\nend\n\nwhen flag clicked\nset volume to (100) %\nset size to (20) %\nswitch costume to (costume1 v)\ngo to x: (198) y: (0)\n\nwhen flag clicked\nforever\n    if <(Game) = [Play]> then\n        hide\n    else\n        show\n    end\nend\n\nwhen this sprite clicked\nnext costume\nif <(volume) > [0]> then\n    set volume to (0) %\nelse\n    set volume to (100) %\nend\n\nwhen flag clicked\nforever\n    go to [front v] layer\nend\n\n@Settings\n\nwhen flag clicked\nset [pause v] to [0]\nset [t? v] to [y]\nforever\n    if <touching (mouse-pointer v)?> then\n        set size to ((size) + (((70) - (size)) / (4))) %\n    else\n        set size to ((size) + (((50) - (size)) / (3))) %\n    end\nend\n\nwhen flag clicked\nforever\n    if <(pause) = [y]> then\n        set x to (-213)\n        set y to ((146) + (([cos v] of (((timer) - (7)) * (150)) ) * (6)))\n        if <<touching (mouse-pointer v)?> and <mouse down?>> then\n            switch backdrop to (pause v)\n            set [game v] to [Pause]\n            set [backdrop v] to [Pause]\n            set [pause v] to [n]\n            set [t? v] to [n]\n            stop all sounds\n        end\n    else\n    end\nend\n\nwhen flag clicked\nforever\n    if <(pause) = [0]> then\n        set x to (-170)\n        set y to ((0) + (([cos v] of (((timer) - (7)) * (170)) ) * (6)))\n    end\nend\n\nwhen flag clicked\nshow\nshow\nshow\nforever\n    go to [front v] layer\nend\n\nwhen flag clicked\nforever\n    if <(pause) = [n]> then\n        set x to (-170)\n        set y to ((0) + (([cos v] of (((timer) - (7)) * (170)) ) * (6)))\n        if <<touching (mouse-pointer v)?> and <mouse down?>> then\n            set [backdrop v] to (Level)\n            set [game v] to [Play]\n            set [pause v] to [y]\n            set [t? v] to [y]\n        end\n    end\nend\n\n@Title\n\nwhen flag clicked\nforever\n    if <<(Game) = [Play]> or <(Game) = [Pause]>> then\n        hide\n    else\n        show\n    end\nend\n\nwhen flag clicked\n\nwhen flag clicked\ngo to [front v] layer\nforever\n    set y to ((100) + (([cos v] of (((timer) - (8)) * (170)) ) * (6)))\nend\n\n@Texture\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\nset size to (150) %\nset [ghost v] effect to (96)\n\nhide\n\n@You Win!\n\nwhen flag clicked\nhide\nhide\nhide\nforever\n    if <(Level) = [10]> then\n        show\n        go to x: (10) y: (42)\n    end\nend\n\nset [level v] to [8]\n\nwhen flag clicked\nforever\n    set y to ((37) + (([cos v] of (((timer) - (8)) * (170)) ) * (6)))\nend\n\n@Pause\n\nwhen flag clicked\ngo to [front v] layer\ngo to x: (0) y: (0)\nset size to (150) %\nforever\n    if <(pause) = [n]> then\n        show\n    else\n        hide\n    end\nend\n\nwhen flag clicked\nforever\n    set y to ((10) + (([cos v] of (((timer) - (8)) * (170)) ) * (6)))\nend\n\nwhen flag clicked\n\n@Thumbnail\n\nforever\n    go to [front v] layer\n    set [ghost v] effect to (0)\n    show\n    hide variable [☁ best time v]\nend\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\nforever\n    go to [front v] layer\nend\n\n