Warp - A platformer

Instructions: WASD or arrow keys to move.\nS or down to attack (if you have a power up).\nTip: hit up or w to jump high when you have the spring.\nSpace to teleport.

@Stage\n\n@Sprite1\n\nwhen flag clicked\nforever\n    go to [back v] layer\nend\n\n@Sprite2\n\nwhen flag clicked\nforever\n    go to [back v] layer\nend\n\n@player\n\nwhen I receive [level changing v]\nswitch costume to (costume1 v)\npoint in direction (90)\nset [run speed v] to [0]\nset [jump speed v] to [0]\nset [on ground? v] to [0]\nset y to (item (level:) of [level y v])\nset x to (-222)\nrepeat until <touching color (#33ff00)?>\n    change x by (run speed)\n    change y by (jump speed)\n    change [jump speed v] by (-1)\n    if <<touching color (#ff0000)?> or <touching (enemy v)?>> then\n        broadcast (death v)\n    end\n    if <<<key (down arrow v) pressed?> or <key (s v) pressed?>> and <not <(costume [number v]) = [1]>>> then\n        broadcast (attack v)\n    end\n    if <<<(level:) > [1]> and <(level:) < [20]>> and <key (space v) pressed?>> then\n        wait (0.21) seconds\n        go to (ghost v)\n        set [run speed v] to ((0) - (run speed))\n    end\n    if <key (p v) pressed?> then\n        change [level: v] by (1)\n        wait (.05) seconds\n        broadcast (level changing v)\n    end\n    if <touching (power up v)?> then\n        switch costume to (([costume # v] of [power up v]) + (1))\n    end\n    if <<touching color (#000000)?> and <(jump speed) < [0]>> then\n        put on ground\n    end\n    if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <not <(costume [number v]) = [4]>>> and <(on ground?) = [1]>> then\n        set [on ground? v] to [0]\n        set [jump speed v] to [12]\n    end\n    if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <(costume [number v]) = [4]>> and <(on ground?) = [1]>> then\n        switch costume to (costume1 v)\n        set [on ground? v] to [0]\n        set [jump speed v] to [19]\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        point in direction (-90)\n        change [run speed v] by (-2)\n    end\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        point in direction (90)\n        change [run speed v] by (2)\n    end\n    if <key (r v) pressed?> then\n        broadcast (death v)\n    end\n    set [run speed v] to ((run speed) * (0.7))\nend\nbroadcast (new level v)\n\nwhen flag clicked\nset [level: v] to [1]\nbroadcast (level changing v)\n\ndefine put on ground\nrepeat until <not <touching color (#000000)?>>\n    change y by (1)\nend\nset [jump speed v] to [0]\nset [on ground? v] to [1]\n\nwhen I receive [death v]\nbroadcast (level changing v)\n\nwhen I receive [new level v]\nchange [level: v] by (1)\nbroadcast (level changing v)\n\nwhen flag clicked\nforever\n    set [directon v] to (direction)\nend\n\nwhen flag clicked\ndelete all of [level y v]\nrepeat (7)\n    add [-148] to [level y v]\nend\nadd [85] to [level y v]\n\nwhen I receive [all good v]\nswitch costume to (costume1 v)\n\nwhen flag clicked\nforever\n    if <key (1 v) pressed?> then\n        switch costume to (costume2 v)\n    end\n    if <key (2 v) pressed?> then\n        switch costume to (costume3 v)\n    end\n    if <key (3 v) pressed?> then\n        switch costume to (costume4 v)\n    end\nend\n\n@Stage\n\nwhen flag clicked\nforever\n    switch costume to (level:)\nend\n\nchange [level: v] by (-1)\n\n@ghost\n\nwhen flag clicked\nforever\n    go to [front v] layer\n    set [ghost v] effect to (50)\n    if <<(level:) > [1]> and <(level:) < [20]>> then\n        show\n    else\n        hide\n    end\n    go to x: ((0) - ([x position v] of [player v])) y: ([y position v] of [player v])\n    point in direction ((0) - ([direction v] of [player v]))\n    switch costume to ([costume # v] of [player v])\nend\n\n@boss\n\nwhen I receive [boss v]\nswitch costume to (costume1 v)\nset [boss hp v] to [5]\nbroadcast (kill clone v)\nshow variable [boss hp v]\ngo to x: (0) y: (50)\nset voice to (tenor v)::tts\nsay [long i have been your shadow, your ghost, but times have changed.]\nspeak [long i have been your shadow, your ghost, but times have changed.]::tts\nwait (1) seconds\nsay [now i will use my shadowy powers to destroy you and all non-shadows!]\nspeak [now i will use my shadowy powers to destroy you and all non-shadows!]::tts\nwait (1) seconds\nsay [and you can not stop me for i can teleport and duplicate and fly and... well that is it.]\nspeak [and you can not stop me for i can teleport and duplicate and fly and,,, well that is it.]::tts\nwait (1) seconds\nsay [on with the battle!] for (2) seconds\nrepeat until <(BOSS HP) = [0]>\n    create clone of (_myself_ v)\n    go to x: (50) y: (50)\n    wait until <touching (attack v)?>\n    create clone of (sprite4 v)\n    change [boss hp v] by (-1)\n    broadcast (kill clone v)\nend\nhide variable [boss hp v]\nplay sound [Screech v] until done\nsay [no!!!!] for (2) seconds\nspeak [nooo!]::tts\npoint in direction (90)\nswitch costume to (costume2 v)\n\nwhen I receive [level changing v]\nif <(level:) = [20]> then\n    show\n    broadcast (boss v)\nelse\n    hide\nend\n\nwhen I start as a clone\ngo to x: (-50) y: (50)\nwait until <touching (attack v)?>\ncreate clone of (sprite4 v)\ndelete this clone\n\nwhen I receive [kill clone v]\ndelete this clone\n\nwhen flag clicked\nhide variable [boss hp v]\nset [boss hp v] to [5]\nforever\n    set [boss hp v] to (boss hp)\n    set [ghost v] effect to (50)\nend\n\n@attack\n\nwhen I receive [attack v]\nif <not <([costume # v] of [player v]) = [1]>> then\n    if <([costume # v] of [player v]) = [2]> then\n        switch costume to (costume1 v)\n        broadcast (all good v)\n        go to (player v)\n        show\n        repeat until <<<touching (_edge_ v)?> or <touching (stage v)?>> or <touching (ghost v)?>>\n            point towards (ghost v)\n            move (5) steps\n        end\n        hide\n        stop [this script v]\n    end\n    if <([costume # v] of [player v]) = [3]> then\n        go to (player v)\n        repeat (2)\n            create clone of (_myself_ v)\n        end\n        broadcast (all good v)\n    end\n    if <([costume # v] of [player v]) = [4]> then\n        go to (player v)\n        broadcast (all good v)\n        switch costume to (costume4 v)\n        show\n        repeat until <<<touching (_edge_ v)?> or <touching (boss v)?>> or <touching (stage v)?>>\n            change y by (5)\n        end\n        hide\n        stop [this script v]\n    end\nelse\n    hide\n    stop [this script v]\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [attack v]\nset [aim v] to [90]\n\nwhen I start as a clone\nswitch costume to (costume4 v)\nshow\nset [aim v] to ((0) - (aim))\npoint in direction (aim)\ngo to (player v)\nshow\nrepeat until <<touching (_edge_ v)?> or <touching (stage v)?>>\n    move (5) steps\nend\nhide\ndelete this clone\n\nwhen flag clicked\nforever\n    go to [front v] layer\nend\n\nwhen I receive [level changing v]\nhide\n\nwhen I receive [new level v]\nhide\n\n@power up\n\nwhen I receive [level changing v]\nset [hit this level v] to [1]\n\nwhen flag clicked\nforever\n    go to x: (0) y: (-151)\n    if <<<(level:) = [14]> or <<(level:) = [15]> or <<<(level:) = [17]> or <(level:) = [18]>> or <(level:) = [20]>>>> and <(hit this level) = [1]>> then\n        show\n    else\n        hide\n    end\n    if <touching (player v)?> then\n        set [hit this level v] to [0]\n    end\n    if <(level:) = [14]> then\n        switch costume to (costume1 v)\n    else\n        if <(level:) = [15]> then\n            switch costume to (costume1 v)\n        else\n            if <(level:) = [17]> then\n                switch costume to (costume2 v)\n            else\n                if <(level:) = [18]> then\n                    switch costume to (costume3 v)\n                else\n                    switch costume to (costume3 v)\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [boss v]\nrepeat until <(BOSS HP) = [0]>\n    set [hit this level v] to [1]\n    wait (pick random (3) to (9)) seconds\nend\n\n@enemy\n\nwhen flag clicked\nforever\n    if <<<(level:) = [14]> or <<(level:) = [15]> or <(level:) = [17]>>> and <(hit this level) = [1]>> then\n        show\n    else\n        hide\n    end\n    if <touching (attack v)?> then\n        set [hit this level v] to [0]\n        set [enemy? v] to [0]\n    end\nend\n\nwhen I receive [level changing v]\nset [hit this level v] to [1]\nset [enemy? v] to [1]\n\nwhen flag clicked\nforever\n    glide (1) secs to x: (0) y: (50)\n    glide (1) secs to x: (0) y: (-150)\nend\n\n@door\n\nwhen flag clicked\nforever\n    if <(enemy?) = [1]> then\n        if <(costume [number v]) = [26]> then\n            switch costume to (playing_with_your_mind_by_fleur555 v)\n        else\n            next costume\n        end\n    else\n        switch costume to (costume1 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <<(level:) = [14]> or <<(level:) = [15]> or <(level:) = [17]>>> then\n        show\n    else\n        hide\n    end\nend\n\n@Sprite3\n\nwhen flag clicked\nhide\nforever\n    go to [front v] layer\nend\n\nwhen flag clicked\nwait (0.1) seconds\nhide variable [boss hp v]\n\nshow\n\n@Sprite4\n\nwhen I start as a clone\nshow\ngo to (boss v)\npoint towards (player v)\nrepeat until <touching (stage v)?>\n    move (8) steps\nend\nhide\ndelete this clone\n\nwhen flag clicked\nhide\n\nset [level: v] to [20]\n\n