Chaos Unleashed - a Platformer v. 2.0

Instructions: [Space] - Jump ; [WASD] / [Arrow keys] move \nIf hard press button in top left corner.\nEditor shortcuts:\n[C] - Play/Edit ; [X] Change edit mode,\nWhile choosing type [1-5]\nWhile choosing height [0-9] or hold [Z] + [0-9]\n[Top button] - Edit mode

@Stage\n\nwhen flag clicked\nswitch backdrop to (1 v)\n\nwhen I receive [next level v]\nnext backdrop\n\nwhen flag clicked\nforever\n    play sound [Music v] until done\nend\n\n@Thumbail\n\nwhen flag clicked\ngo to x: (36) y: (24)\nshow\nswitch costume to (costume1 v)\nset [ghost v] effect to (100)\nforever\n    go to [front v] layer\nend\n\n@Ninja\n\nwhen flag clicked\nhide\nswitch costume to (1 v)\nforever\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nswitch costume to (clones v)\nrepeat (5)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nwhen I receive [start v]\nshow\nswitch costume to (1 v)\nset size to (100) %\npoint in direction (90)\ngo to x: (-193) y: (-88)\nset [x v] to [0]\nset [y v] to [0]\nforever\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        switch costume to (1 v)\n        change [x v] by (0.9)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        switch costume to (2 v)\n        change [x v] by (-0.9)\n    end\n    set [x v] to ((X) * (0.9))\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 x by ((X) * (-1))\n                            change y by (-1)\n                            if <<mouse down?> and <touching (mouse-pointer v)?>> then\n                                if <(X) > [0]> then\n                                    set [x v] to [-5]\n                                else\n                                    set [x v] to [5]\n                                end\n                                set [y 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    change [y v] by (-1)\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 (-1)\n    if <touching (ground v)?> then\n        if <<mouse down?> and <touching (mouse-pointer v)?>> then\n            set [y v] to [15]\n        end\n    end\n    if <(x position) > [247]> then\n        show\n        switch costume to (1 v)\n        set size to (100) %\n        point in direction (90)\n        go to x: (-193) y: (-88)\n        broadcast (Next Level v)\n    end\n    if <<touching (spikes v)?> or <touching (lava v)?>> then\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n        set size to (100) %\n        point in direction (90)\n        set [ghost v] effect to (0)\n        go to x: (-193) y: (-88)\n    end\nend\n\nwhen I receive [die v]\nif <touching (enemy v)?> then\n    set size to (100) %\n    point in direction (90)\n    set [ghost v] effect to (0)\n    go to x: (-193) y: (-88)\nend\n\n@GG\n\nwhen flag clicked\nshow\ngo to x: (36) y: (28)\nset size to (150) %\nforever\n    go to x: (([x position v] of [cursor v]) * (-0.1)) y: (([y position v] of [cursor v]) * (-0.1))\nend\n\nwhen I receive [start v]\nhide\n\n@cursor\n\nwhen flag clicked\nforever\n    go to (mouse-pointer v)\nend\n\n@Gg\n\nwhen flag clicked\nshow\nforever\n    go to [back v] layer\n    go to x: (([x position v] of [cursor v]) * (0.1)) y: (([y position v] of [cursor v]) * (0.1))\nend\n\nwhen I receive [start v]\nhide\n\n@Word\n\nwhen flag clicked\nshow\ngo to x: (-82) y: (133)\nswitch costume to (costume1 v)\nforever\n    if <touching (mouse-pointer v)?> then\n        switch costume to (costume2 v)\n    else\n        switch costume to (costume1 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        hide\n        broadcast (Start v)\n        stop [this script v]\n    end\nend\n\n@Ground\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nshow\nswitch costume to (1 v)\ngo to x: (36) y: (28)\n\nwhen I receive [next level v]\nchange [level v] by (1)\nnext costume\n\nwhen flag clicked\nset [level v] to [1]\n\n@Spikes\n\nwhen flag clicked\nhide\nforever\n    go to [back v] layer\nend\n\nwhen I receive [start v]\nshow\nswitch costume to (1 v)\n\nwhen I receive [next level v]\nnext costume\n\n@Sword\n\nwhen flag clicked\nset [attack in progress v] to [0]\nset [direction of sword v] to [right]\nset [sword v] to [0]\npoint in direction (90)\nset size to (90) %\nhide\n\nswitch costume to (1 v)\n\nwhen flag clicked\nhide\nswitch costume to (1 v)\ngo to x: (-17) y: (-12)\nwait until <(Level) = [3]>\nshow\nforever\n    repeat (10)\n        change y by (1)\n    end\n    repeat (10)\n        change y by (-1)\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (ninja v)?> then\n        broadcast (Sword v)\n    end\nend\n\nwhen I receive [sword v]\nshow\nset [sword v] to [1]\nstop [other scripts in sprite v]\nforever\n    go to (ninja v)\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        if <(Attack in progress) = [0]> then\n            switch costume to (1 v)\n            set [direction of sword v] to [right]\n        else\n            set [direction of sword v] to [right]\n        end\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        if <(Attack in progress) = [0]> then\n            set [direction of sword v] to [left]\n            switch costume to (9 v)\n        else\n            set [direction of sword v] to [left]\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    go to [front v] layer\nend\n\nwhen [space v] key pressed\nif <(Attack in progress) = [0]> then\n    broadcast (Actack v)\nend\n\nwhen I receive [actack v]\nif <(sword) = [1]> then\n    if <(Attack in progress) = [0]> then\n        set [attack in progress v] to [1]\n        if <(Attack in progress) = [1]> then\n            repeat (7)\n                next costume\n            end\n            repeat (20)\n                change [ghost v] effect by (5)\n            end\n        end\n        if <(Direction of sword) = [right]> then\n            switch costume to (1 v)\n        else\n            switch costume to (9 v)\n        end\n        set [attack in progress v] to [0]\n        set [ghost v] effect to (0)\n        wait until <not <key (space v) pressed?>>\n    end\nend\n\n@Sun\n\nwhen I receive [start v]\nshow\ngo to [back v] layer\ngo to x: (-2) y: (2)\nset size to (100) %\nset [size v] to [100]\nforever\n    change size by ([cos v] of (size) )\n    change [size v] by (5)\nend\n\n@Cloud\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nset size to (pick random (55) to (59)) %\nshow\ngo to [back v] layer\nset [ghost v] effect to (25)\nif <(random) = [1]> then\n    go to x: (300) y: (pick random (150) to (100))\n    repeat until <(x position) < [-200]>\n        change x by (-1)\n    end\n    delete this clone\nend\nif <(random) = [2]> then\n    go to x: (-300) y: (pick random (150) to (100))\n    repeat until <(x position) > [200]>\n        change x by (1)\n    end\n    delete this clone\nend\n\nwhen I receive [start v]\nforever\n    set [random v] to (pick random (1) to (2))\n    create clone of (_myself_ v)\n    wait (2.5) seconds\nend\n\n@Enemy\n\nwhen flag clicked\nhide\nforever\n    go to [front v] layer\nend\n\ndefine Clone at : (x) (y)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\n\nwhen I receive [next level v]\nbroadcast (Delete Clones v) and wait\nif <(Level) = [4]> then\n    Clone at : [211] [-58]\nelse\n    if <(Level) = [7]> then\n        Clone at : [211] [-58]\n    else\n        if <(Level) = [11]> then\n            Clone at : [211] [-58]\n        else\n            if <(Level) = [12]> then\n                Clone at : [211] [-58]\n            else\n                if <(Level) = [14]> then\n                    Clone at : [162] [-83]\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [delete clones v]\ndelete this clone\n\nwhen I start as a clone\nshow\nset [enemy x v] to [0]\nset [enemy y v] to [0]\nset rotation style [left-right v]\nrepeat until <touching (sword v)?>\n    change [enemy y v] by (-1)\n    if <([x position v] of [ninja v]) < (x position)> then\n        point in direction (90)\n        change [enemy x v] by (-.5)\n    else\n        change [enemy x v] by (.5)\n        point in direction (-90)\n    end\n    set [enemy x v] to ((Enemy X) * (.9))\n    change x by (Enemy 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 (-4)\n                        change x by ((Enemy X) * (-1))\n                        if <([y position v] of [ninja v]) > ((y position) + (5))> then\n                            set [enemy y v] to [8]\n                            if <([abs v] of (Enemy X) ) = (Enemy X)> then\n                                set [enemy x v] to [-5]\n                            else\n                                set [enemy x v] to [5]\n                            end\n                        else\n                            set [enemy x v] to [0]\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (Enemy Y)\n    if <touching (ground v)?> then\n        change y by ((Enemy Y) * (-1))\n        set [enemy y v] to [0]\n    end\n    change y by (-1)\n    if <<([y position v] of [ninja v]) > ((y position) + (5))> and <touching (ground v)?>> then\n        set [enemy y v] to [12]\n    end\n    change y by (1)\n    if <<touching (ninja v)?> or <touching (lava v)?>> then\n        broadcast (Die v)\n    end\nend\ndelete this clone\n\nwhen I receive [die v]\nbroadcast (Delete Clones v) and wait\nif <(Level) = [4]> then\n    Clone at : [211] [-58]\nelse\n    if <(Level) = [7]> then\n        Clone at : [211] [-58]\n    else\n        if <(Level) = [11]> then\n            Clone at : [211] [-58]\n        else\n            if <(Level) = [12]> then\n                Clone at : [211] [-58]\n            else\n                if <(Level) = [14]> then\n                    Clone at : [162] [-83]\n                end\n            end\n        end\n    end\nend\n\n@Lava\n\nwhen flag clicked\nhide\nforever\n    go to [back v] layer\nend\n\nwhen I receive [start v]\nshow\nswitch costume to (1 v)\n\nwhen I receive [next level v]\nnext costume\n\nwhen flag clicked\nforever\n    glide (1) secs to x: (33) y: (64)\n    glide (1) secs to x: (33) y: (55)\nend\n\n