The Darkness - A Platformer
@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\nbroadcast (Menu v)\n\nwhen I receive [start v]\nif <(weird?) = [1]> then\n    switch backdrop to (backdrop2 v)\nelse\n    switch backdrop to (backdrop1 v)\nend\n\nwhen I receive [menu v]\nswitch backdrop to (backdrop1 v)\n\n@pen\n\ndefine render\nerase all\nDraw Player\nDraw Lights\nDraw Ground\nDraw Spikes\nDraw Goals\nif <(win?) = [1]> then\n    change [end animation v] by (5)\n    go to x: (0) y: (0)\n    if <(weird?) = [1]> then\n        set pen color to (#000000)\n    else\n        set pen color to (#ffffff)\n    end\n    set pen size to ((100) + ((end animation) * (4)))\n    set pen (transparency v) to ((100) - (end animation))\n    pen down\n    pen up\nend\n\nwhen flag clicked\nerase all\nhide\n\ndefine Draw rect from (x) (y) to (x2) (y2)\npen up\nGo to (x) (y)\npen down\nGo to (x2) (y)\nGo to (x2) (y2)\nGo to (x) (y2)\nGo to (x) (y)\npen up\n\ndefine Go to (x) (y)\nif <(weird?) = [1]> then\n    go to x: (() - ((x) - (Camera X))) y: ((y) - (Camera Y))\nelse\n    go to x: ((x) - (Camera X)) y: ((y) - (Camera Y))\nend\n\ndefine Draw Player\nif <(weird?) = [1]> then\n    set pen color to (#9c008a)\nelse\n    set pen color to (#ffae00)\nend\nset pen (transparency v) to (100)\nset pen size to (((340) - ((55) * (Camera Speed))) + (([sin v] of ((timer) * (100)) ) * (5)))\nif <(Camera Speed) = [0]> then\n    set pen size to ((500) + (([sin v] of ((timer) * (100)) ) * (5)))\nend\nrepeat (10)\n    Go to ((X) + ((Width) / (2))) ((Y) + ((Height) / (2)))\n    pen down\n    pen up\n    change pen size by ((((340) - ((55) * (Camera Speed))) + (([sin v] of ((timer) * (50)) ) * (10))) / (-10))\n    change pen (transparency v) by (-10)\nend\nif <(weird?) = [1]> then\n    set pen color to (#000000)\nelse\n    set pen color to (#ffffff)\nend\nset pen size to (5)\nDraw rect from ((X) + (5)) ((Y) + (5)) to (((X) + (Width)) - (5)) (((Y) + (Height)) - (5))\n\ndefine Draw Ground\nif <(weird?) = [1]> then\n    set pen color to (#ffffff)\nelse\n    set pen color to (#000000)\nend\nset pen size to (5)\nset [i v] to [1]\nrepeat until <(i) > (length of [ground v])>\n    Draw rect from (item ((i) + (0)) of [ground v]) (item ((i) + (1)) of [ground v]) to (item ((i) + (2)) of [ground v]) (item ((i) + (3)) of [ground v])\n    change [i v] by (4)\nend\n\ndefine Create Level\ndelete all of [spikes v]\ndelete all of [ground v]\ndelete all of [lights v]\ndelete all of [goals v]\nAdd light at [10] [-50] height [50] size [100]\nAdd ground from [0] [-100] to [275] [-50]\nAdd ground from [100] [-50] to [150] [0]\nAdd ground from [350] [-100] to [500] [-50]\nAdd ground from [500] [-100] to [550] [10]\nAdd ground from [550] [-100] to [900] [-50]\nAdd a spike from [675] [-50] to [700] [-25]\nAdd a spike from [700] [-50] to [725] [-25]\nAdd light at [650] [-50] height [50] size [150]\nAdd light at [750] [-50] height [50] size [150]\nAdd ground from [950] [-100] to [1000] [0]\nAdd ground from [1050] [-100] to [1100] [50]\nAdd ground from [1150] [0] to [1500] [50]\nAdd ground from [1400] [50] to [1500] [100]\nAdd ground from [1250] [125] to [1350] [150]\nAdd ground from [1400] [200] to [1500] [225]\nAdd ground from [1200] [275] to [1300] [300]\nAdd light at [1250] [300] height [50] size [200]\nAdd ground from [1225] [350] to [1275] [375]\nAdd ground from [800] [350] to [1150] [375]\nAdd light at [1100] [375] height [25] size [100]\nAdd light at [950] [375] height [50] size [150]\nAdd a spike from [920] [375] to [940] [395]\nAdd a spike from [940] [375] to [960] [405]\nAdd a spike from [960] [375] to [980] [395]\nAdd goal at [750] [450] size [50]\n\ndefine Add ground from (x) (y) to (x2) (y2)\nadd (x) to [ground v]\nadd (y) to [ground v]\nadd (x2) to [ground v]\nadd (y2) to [ground v]\n\ndefine physics\nif <key (left arrow v) pressed?> then\n    change [xv v] by (-1)\nend\nif <key (right arrow v) pressed?> then\n    change [xv v] by (1)\nend\nset [xv v] to ((xv) * (0.9))\nChange X by (round (xv))\nchange [yv v] by (-1)\nif <<key (up arrow v) pressed?> and <(Can Jump?) = [1]>> then\n    set [yv v] to [12]\nend\nChange Y by (yv)\nCollisions\nif <<(Y) < [-400]> or <[collisions v] contains [2]?>> then\n    Reset\nend\nif <[collisions v] contains [3]?> then\n    set [win? v] to [1]\nend\n\ndefine Collisions\ndelete all of [collisions v]\nset [i v] to [1]\nrepeat until <(i) > (length of [ground v])>\n    change [i v] by (-1)\n    if <<<(item ((i) + (3)) of [ground v]) > (X)> and <((X) + (Width)) > (item ((i) + (1)) of [ground v])>> and <<(item ((i) + (4)) of [ground v]) > (Y)> and <((Y) + (Height)) > (item ((i) + (2)) of [ground v])>>> then\n        add [1] to [collisions v]\n    end\n    change [i v] by (5)\nend\nset [i v] to [1]\nrepeat until <(i) > (length of [spikes v])>\n    change [i v] by (-1)\n    if <<<(item ((i) + (3)) of [spikes v]) > (X)> and <((X) + (Width)) > (item ((i) + (1)) of [spikes v])>> and <<(item ((i) + (4)) of [spikes v]) > (Y)> and <((Y) + (Height)) > (item ((i) + (2)) of [spikes v])>>> then\n        add [2] to [collisions v]\n    end\n    change [i v] by (5)\nend\nset [i v] to [1]\nrepeat until <(i) > (length of [goals v])>\n    if <<<((item ((i) + (0)) of [goals v]) + (item ((i) + (2)) of [goals v])) > (X)> and <((X) + (Width)) > (item ((i) + (0)) of [goals v])>> and <<((item ((i) + (1)) of [goals v]) + (item ((i) + (2)) of [goals v])) > (Y)> and <((Y) + (Height)) > (item ((i) + (1)) of [goals v])>>> then\n        add [3] to [collisions v]\n    end\n    change [i v] by (3)\nend\n\ndefine Change X by (xv)\nchange [x v] by (xv)\nCollisions\nrepeat until <not <[collisions v] contains [1]?>>\n    change [x v] by (() - (([abs v] of (xv) ) / (xv)))\n    set [xv v] to [0]\n    Collisions\nend\n\ndefine Change Y by (yv)\nset [can jump? v] to [0]\nchange [y v] by (yv)\nCollisions\nrepeat until <not <[collisions v] contains [1]?>>\n    if <(yv) < [0]> then\n        set [can jump? v] to [1]\n    end\n    change [y v] by (() - (([abs v] of (yv) ) / (yv)))\n    set [yv v] to [0]\n    Collisions\nend\n\ndefine scroll\nif <(Camera Speed) = [0]> then\n    change [camera x v] by (round (((X) - (Camera X)) / (4)))\n    change [camera y v] by (round (((Y) - (Camera Y)) / (4)))\nelse\n    if <(Camera Y) > [399]> then\n        change [camera x v] by ((Camera Speed) * (-2))\n        set [camera y v] to [400]\n    else\n        if <(Camera X) < [1300]> then\n            change [camera x v] by ((Camera Speed) * (2))\n            set [camera y v] to [0]\n        else\n            set [camera x v] to [1300]\n            change [camera y v] by (Camera Speed)\n        end\n    end\n    if <(Camera X) > ((240) + (X))> then\n        set [x v] to ((Camera X) - (240))\n        Collisions\n        if <[collisions v] contains [1]?> then\n            Reset\n        end\n    end\n    if <(X) > (((240) + (Camera X)) - (Width))> then\n        set [x v] to (((240) + (Camera X)) - (Width))\n        Collisions\n        if <[collisions v] contains [1]?> then\n            Reset\n        end\n    end\nend\n\ndefine Reset\nset [x v] to [0]\nset [y v] to [0]\nset [width v] to [40]\nset [height v] to [40]\nset [xv v] to [0]\nset [yv v] to [0]\nset [camera x v] to [0]\nset [camera y v] to [0]\n\ndefine Add a spike from (x) (y) to (x2) (y2)\nadd (x) to [spikes v]\nadd (y) to [spikes v]\nadd (x2) to [spikes v]\nadd (y2) to [spikes v]\n\ndefine Draw Spikes\nif <(weird?) = [1]> then\n    set pen color to (#ffffff)\nelse\n    set pen color to (#000000)\nend\nset pen size to (5)\nset [i v] to [1]\nrepeat until <(i) > (length of [spikes v])>\n    Go to (item ((i) + (0)) of [spikes v]) (item ((i) + (1)) of [spikes v])\n    pen down\n    Go to (item ((i) + (2)) of [spikes v]) (item ((i) + (1)) of [spikes v])\n    Go to (((item ((i) + (0)) of [spikes v]) + (item ((i) + (2)) of [spikes v])) / (2)) (item ((i) + (3)) of [spikes v])\n    Go to (item ((i) + (0)) of [spikes v]) (item ((i) + (1)) of [spikes v])\n    pen up\n    change [i v] by (4)\nend\n\ndefine Add light at (x) (y) height (height) size (size)\nadd (x) to [lights v]\nadd (y) to [lights v]\nadd (height) to [lights v]\nadd (size) to [lights v]\n\ndefine Draw Lights\nset [i v] to [1]\nrepeat until <(i) > (length of [lights v])>\n    if <(weird?) = [1]> then\n        set pen color to (#9c008a)\n    else\n        set pen color to (#ffae00)\n    end\n    set pen (transparency v) to (100)\n    set pen size to ((item ((i) + (3)) of [lights v]) + (([sin v] of ((timer) * (100)) ) * (5)))\n    repeat (10)\n        Go to (item ((i) + (0)) of [lights v]) ((item ((i) + (1)) of [lights v]) + (item ((i) + (2)) of [lights v]))\n        pen down\n        pen up\n        change pen size by (((item ((i) + (3)) of [lights v]) + (([sin v] of ((timer) * (50)) ) * (10))) / (-10))\n        change pen (transparency v) by (-10)\n    end\n    if <(weird?) = [1]> then\n        set pen color to (#000000)\n    else\n        set pen color to (#ffffff)\n    end\n    set pen size to (5)\n    Go to (item ((i) + (0)) of [lights v]) ((item ((i) + (1)) of [lights v]) + (5))\n    pen down\n    Go to (item ((i) + (0)) of [lights v]) ((item ((i) + (1)) of [lights v]) + (item ((i) + (2)) of [lights v]))\n    set pen size to (15)\n    pen down\n    pen up\n    change [i v] by (4)\nend\n\nwhen I receive [start v]\nReset\nCreate Level\nset [win? v] to [0]\nset [end animation v] to [0]\nforever\n    render\n    physics\n    scroll\n    Collisions\n    if <(end animation) > [200]> then\n        broadcast (Menu v)\n        stop [this script v]\n    end\nend\n\ndefine Add goal at (x) (y) size (size)\nadd (x) to [goals v]\nadd (y) to [goals v]\nadd (size) to [goals v]\n\ndefine Draw Goals\nset [i v] to [1]\nrepeat until <(i) > (length of [goals v])>\n    if <(weird?) = [1]> then\n        set pen color to (#000000)\n    else\n        set pen color to (#ffffff)\n    end\n    set pen (transparency v) to (100)\n    set pen size to (((item ((i) + (2)) of [goals v]) * (3)) + (([sin v] of ((timer) * (100)) ) * (5)))\n    repeat (10)\n        Go to ((item ((i) + (0)) of [goals v]) + ((item ((i) + (2)) of [goals v]) / (2))) ((item ((i) + (1)) of [goals v]) + ((item ((i) + (2)) of [goals v]) / (2)))\n        pen down\n        pen up\n        change pen size by ((((item ((i) + (2)) of [goals v]) * (3)) + (([sin v] of ((timer) * (50)) ) * (10))) / (-10))\n        change pen (transparency v) by (-10)\n    end\n    set pen size to (5)\n    Draw rect from (item ((i) + (0)) of [goals v]) (item ((i) + (1)) of [goals v]) to ((item ((i) + (0)) of [goals v]) + (item ((i) + (2)) of [goals v])) ((item ((i) + (1)) of [goals v]) + (item ((i) + (2)) of [goals v]))\n    Go to ((item ((i) + (0)) of [goals v]) + ((item ((i) + (2)) of [goals v]) / (2))) ((item ((i) + (1)) of [goals v]) + ((item ((i) + (2)) of [goals v]) / (2)))\n    set pen size to ((item ((i) + (2)) of [goals v]) * (0.5))\n    pen down\n    pen up\n    change [i v] by (3)\nend\n\n@menu\n\nwhen I receive [menu v]\nerase all\ngenerate\n\nwhen flag clicked\nhide\n\ndefine generate\nswitch costume to (costume1 v)\ngo to x: (0) y: (130)\nrepeat (5)\n    create clone of (_myself_ v)\n    change y by (-60)\n    next costume\nend\n\nwhen I start as a clone\nshow\nforever\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (-30)\n        if <mouse down?> then\n            Set Difficulty (costume [number v])\n            broadcast (start v)\n        end\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\ndefine Set Difficulty (#)\nset [weird? v] to [0]\nif <(#) = [1]> then\n    set [camera speed v] to [1]\nend\nif <(#) = [2]> then\n    set [camera speed v] to [2]\nend\nif <(#) = [3]> then\n    set [camera speed v] to [3]\nend\nif <(#) = [4]> then\n    set [camera speed v] to [1.5]\n    set [weird? v] to [1]\nend\nif <(#) = [5]> then\n    set [camera speed v] to [0]\nend\n\nwhen I receive [start v]\ndelete this clone\n\n
Thought I should make a Halloween Platformer, so I made this.\n\nChoose one of 5 modes, then carefully navigate through this dark, spooky, landscape.\n\nThis is very short, and more of a test than a full game.