spooky castle - a scrolling platformer 

Instructions: spooky castle\n*****************************************************\nDon't play this game if you don't want to see blood!\n*****************************************************\nYou are in the ruins by night. There are many spooky characters. Can you get out?\n*****************************************************\n- Move with arrow keys, WASD or mobile mode\n- Find the four towers\n- You can walljump\n- spook you =D

@Stage\n\n@Danger\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setip v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1-1 v)\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\n@Platforms\n\nwhen I receive [green flag v]\nhide\nswitch backdrop to (backdrop3 v)\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setip v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1-1 v)\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [700] y: [800]\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nClone at x: [1663] y: [557]\n\nwhen I receive [green flag v]\n\nwhen flag clicked\nforever\n    go to [front v] layer\n    go [backward v] (1) layers\nend\n\n@Player\n\nwhen flag clicked\nbroadcast (Green Flag v) and wait\nbroadcast (Play Game v) and wait\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\n\nwhen I receive [play game v]\nset [level v] to [1]\nforever\n    broadcast (Reset v) and wait\n    broadcast (Setip v) and wait\n    Game on\n    repeat until <(EXIT) > []>\n        Tick\n        broadcast (Tick v) and wait\n    end\n    if <(EXIT) = [Win]> then\n        Game - Win\n    else\n        Game - Die\n    end\nend\n\ndefine Game on\nif <(Checkpoint) = [0]> then\n    set [x v] to [0]\n    set [y v] to [0]\nelse\n    if <(Checkpoint) = [1]> then\n        set [x v] to [2050]\n        set [y v] to [20]\n    else\n        set [x v] to [4307]\n        set [y v] to [120]\n    end\nend\nset [speed y v] to [0]\nset [speed x v] to [0]\nset [in air v] to [0]\nset [exit v] to []\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset size to (10) %\nclear graphic effects\nshow\n\ndefine Tick\nif <<key (left arrow v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>> then\n    change [speed x v] by (-2)\n    point in direction (-90)\nend\nif <<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>> then\n    change [speed x v] by (2)\n    point in direction (90)\nend\nset [speed x v] to ((Speed x) * (0.8))\nif <([abs v] of (Speed x) ) > [0.9]> then\n    Change player x by (round (Speed x))\nend\nif <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> then\n    if <(in air) < [4]> then\n        set [speed y v] to [16]\n    end\nend\nif <(Speed y) > [-20]> then\n    change [speed y v] by (-2)\nend\nChange player y by (Speed y)\nTest - Die\nset [scroll x v] to (x)\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\nend\nif <(SCROLL X) > [6723]> then\n    set [scroll x v] to [6723]\nend\nchange [scroll y v] by (round (((y) - (SCROLL Y)) / (10)))\nif <(SCROLL Y) < [0]> then\n    set [scroll y v] to [0]\nend\nPosition\nif <(y) < [-178]> then\n    set [exit v] to [Die]\nend\nif <touching (danger v)?> then\n    set [exit v] to [Die]\nend\nif <(SCROLL X) > [0]> then\n    switch backdrop to (backdrop3 v)\nend\nif <(SCROLL X) > [2041]> then\n    switch backdrop to (backdrop2 v)\nend\nif <(SCROLL X) > [4307]> then\n    switch backdrop to (backdrop1 v)\nend\nif <(SCROLL X) > [6450]> then\n    switch backdrop to (backdrop2 v)\nend\n\ndefine Change player y by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nPosition\nrepeat until <not <touching (platforms v)?>>\n    if <(sy) > [0]> then\n        change [y v] by (-1)\n    else\n        change [y v] by (1)\n        set [in air v] to [0]\n    end\n    Position\n    set [speed y v] to [0]\nend\n\ndefine Position\ngo to x: ((x) - (SCROLL X)) y: ((y) - (SCROLL Y))\n\ndefine Change player x by (sx)\nchange [x v] by (sx)\nPosition\nif <touching (platforms v)?> then\n    repeat (12)\n        change [y v] by (1)\n        Position\n        if <not <touching (platforms v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-12)\n    if <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> then\n        if <(sx) > [0]> then\n            set [speed x v] to [-16]\n        else\n            set [speed x v] to [16]\n        end\n        set [in air v] to [0]\n    else\n        set [speed x v] to [0]\n    end\n    repeat until <not <touching (platforms v)?>>\n        if <(sx) > [0]> then\n            change [x v] by (-1)\n        else\n            change [x v] by (1)\n        end\n        Position\n    end\nend\n\ndefine Game - Die\nset [exit v] to []\nrepeat (5)\n    hide\n    wait (0.1) seconds\n    show\n    wait (0.1) seconds\nend\n\ndefine Game - Win\nrepeat (50)\n    point towards (exit v)\n    turn right (65) degrees\n    move ((distance to [exit v]) / (2)) steps\n    change size by (-0.25)\n    change [ghost v] effect by (2)\nend\nhide\nclear graphic effects\nchange [level v] by (1)\nwait (1) seconds\n\ndefine Test - Die\n\nif <(Checkpoint) = [1]> then\n    set [x v] to [2050]\n    set [y v] to [20]\nelse\n    set [x v] to [4307]\n    set [y v] to [120]\nend\n\nwhen flag clicked\nforever\n    if <touching (bounce v)?> then\n        if <(in air) < [4]> then\n            set [speed y v] to [35]\n        end\n    end\nend\n\n@Checkpoint \n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <(costume [number v]) = [2]> then\n    if <touching (player v)?> then\n        change [checkpoint v] by (1)\n        switch costume to (green flag v)\n    end\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\ndefine Clone at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\n\nwhen flag clicked\nset [checkpoint v] to [0]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (close flag v)\n    Clone at x: [2050] y: [20]\n    Clone at x: [4307] y: [100]\nend\nset [x v] to [-99999]\n\nClone at x: [4307] y: [100]\n\n@bounce\n\nwhen I receive [green flag v]\nhide\nswitch backdrop to (backdrop3 v)\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setip v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1-1 v)\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [700] y: [800]\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nClone at x: [1663] y: [557]\n\nwhen I receive [green flag v]\n\n@Lightning\n\nwhen flag clicked\nforever\n    set pen (transparency v) to (0)\n    hide\n    pen up\n    erase all\n    go to (random position v)\n    set y to (180)\n    set pen color to (#eef20e)\n    point in direction (pick random (150) to (210))\n    pen down\n    repeat (pick random (1) to (5))\n        repeat (1)\n            move (20) steps\n        end\n        turn right (pick random (25) to (50)) degrees\n        if <(pick random (1) to (2)) = [1]> then\n            create clone of (_myself_ v)\n        end\n        repeat (1)\n            move (20) steps\n        end\n        turn left (pick random (25) to (50)) degrees\n        if <(pick random (1) to (2)) = [1]> then\n            create clone of (_myself_ v)\n        end\n    end\n    wait (0.1) seconds\n    broadcast (hide v)\n    wait (0.1) seconds\n    erase all\nend\n\nforever\nend\n\nwhen I start as a clone\nrepeat (pick random (1) to (2))\n    repeat (1)\n        move (20) steps\n    end\n    turn right (pick random (25) to (50)) degrees\nend\nif <(pick random (1) to (5)) = [1]> then\n    create clone of (_myself_ v)\nend\nrepeat (1)\n    move (20) steps\nend\nturn left (pick random (25) to (50)) degrees\nif <(pick random (1) to (5)) = [1]> then\n    create clone of (_myself_ v)\nend\ndelete this clone\n\n@rain\n\nwhen I start as a clone\nshow\ngo to [back v] layer\nchange [brightness v] effect by (pick random (0) to (50))\nset [ghost v] effect to (45)\nswitch costume to (pick random (1) to (2))\ngo to x: (pick random (-240) to (240)) y: (180)\nrepeat until <(y position) = [-180]>\n    change y by (-12)\nend\ndelete this clone\n\nwhen I start as a clone\nforever\n    if <(level) = [20]> then\n        delete this clone\n    end\nend\n\nwhen I receive [player clicked stop v]\nhide\n\nwhen [l v] key pressed\nstop [other scripts in sprite v]\nforever\nend\n\nplay sound [The-sound-of-rain v] until done\n\nwhen I start as a clone\nforever\n    if <key (l v) pressed?> then\n        delete this clone\n    end\nend\n\nwhen flag clicked\nforever\nend\n\nplay sound [The-sound-of-rain v] until done\n\nwhen flag clicked\ngo to [back v] layer\nhide\nforever\n    create clone of (_myself_ v)\n    create clone of (_myself_ v)\n    create clone of (_myself_ v)\n    wait (pick random (0) to (.05)) seconds\nend\n\nwhen flag clicked\nforever\n    if <([costume # v] of [ground v]) = [19]> then\n        hide\n    end\nend\n\n@Platforms2\n\nwhen I receive [green flag v]\nhide\nswitch backdrop to (backdrop3 v)\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setip v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1-1 v)\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [700] y: [800]\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nClone at x: [1663] y: [557]\n\nwhen I receive [green flag v]\n\nwhen flag clicked\nforever\n    go to [back v] layer\nend\n\n@Platforms3\n\nwhen I receive [green flag v]\nhide\nswitch backdrop to (backdrop3 v)\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setip v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1-1 v)\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [700] y: [800]\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nClone at x: [1663] y: [557]\n\nwhen I receive [green flag v]\n\nwhen flag clicked\nforever\n    go to [front v] layer\n    go [forward v] (1) layers\nend\n\n@rain2\n\nwhen I start as a clone\nshow\ngo to [back v] layer\nchange [brightness v] effect by (pick random (0) to (50))\nset [ghost v] effect to (45)\nswitch costume to (pick random (1) to (2))\ngo to x: (pick random (-240) to (240)) y: (180)\nrepeat until <(y position) = [-180]>\n    change y by (-12)\nend\ndelete this clone\n\nwhen I start as a clone\nforever\n    if <(level) = [20]> then\n        delete this clone\n    end\nend\n\nwhen I receive [player clicked stop v]\nhide\n\nwhen [l v] key pressed\nstop [other scripts in sprite v]\nforever\nend\n\nplay sound [The-sound-of-rain v] until done\n\nwhen I start as a clone\nforever\n    if <key (l v) pressed?> then\n        delete this clone\n    end\nend\n\nwhen flag clicked\nforever\nend\n\nplay sound [The-sound-of-rain v] until done\n\nwhen flag clicked\ngo to [back v] layer\nhide\nforever\n    create clone of (_myself_ v)\n    create clone of (_myself_ v)\n    create clone of (_myself_ v)\n    wait (pick random (0) to (.05)) seconds\nend\n\nwhen flag clicked\nforever\n    if <([costume # v] of [ground v]) = [19]> then\n        hide\n    end\nend\n\n@bild\n\nwhen flag clicked\nhide\n\ngo to [front v] layer\n\n