Little or no Light | Platformer
@Stage\n\nwhen flag clicked\nforever\n    play sound (pick random (1) to (4)) until done\nend\n\nwhen flag clicked\nforever\n    if <key (l v) pressed?> then\n        show variable [level v]\n    else\n        hide variable [level v]\n    end\nend\n\n@Character\n\nwhen flag clicked\ngo to x: (-220) y: (0)\nset [x-vel v] to [0]\nset [y-vel v] to [0]\nset [dash v] to [0]\n\ndefine Options: Wall jump (wall) Double jump (double) Wall friction (friction) Dash (dash) Ground pound (stomp) Speed (0.5-3) (speed) Dash cool-down (secs) (cool-down)\nset [<dash> v] to (dash)\nset [<double jump> v] to (double)\nset [<stomp> v] to (stomp)\nset [<wall friction> v] to (friction)\nset [<wall jump> v] to (wall)\nset [|speed| v] to (speed)\nset [|dash cool-down| v] to (cool-down)\n\ndefine Scripts\nif <not <(round (X-vel)) = [0]>> then\n    set [.x-vel v] to (X-vel)\nend\nif <<<<key (down arrow v) pressed?> or <key (s v) pressed?>> and <<not <<key (up arrow v) pressed?> or <key (w v) pressed?>>> and <(<stomp>) = [true]>>> and <not <(ground?) = [yes]>>> then\n    set [stomp v] to [1]\n    if <(dash) > [-1]> then\n        set [dash v] to [-1]\n    end\nend\nif <(ground?) = [yes]> then\n    set [stomp v] to [0]\nend\nif <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <<(jump) = [1]> and <(<double jump>) = [true]>>> then\n    if <(dash) > [-1]> then\n        set [dash v] to [-1]\n    end\n    set [y-vel v] to [12]\n    set [jump v] to [1.5]\nend\nif <<not <<key (up arrow v) pressed?> or <key (w v) pressed?>>> and <(jump) = [0.5]>> then\n    set [jump v] to [1]\nend\nif <<key (space v) pressed?> and <<(dash) < ((1) - (round ((|dash cool-down|) * (30))))> and <(<dash>) = [true]>>> then\n    set [allow dash? v] to [yes]\n    if <[0] < (X-vel)> then\n        switch costume to (right v)\n        change x by (10)\n        if <touching (ground v)?> then\n            set [allow dash? v] to [no]\n        end\n        change x by (-10)\n    else\n        switch costume to (left v)\n        change x by (-10)\n        if <touching (ground v)?> then\n            set [allow dash? v] to [no]\n        end\n        change x by (10)\n    end\n    if <(Allow Dash?) = [yes]> then\n        if <(Wall Touching) = [L]> then\n            set [.x-vel v] to [1]\n        else\n            if <(Wall Touching) = [R]> then\n                set [.x-vel v] to [-1]\n            else\n                if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n                    set [.x-vel v] to [-1]\n                end\n                if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n                    set [.x-vel v] to [1]\n                end\n            end\n        end\n        set [dash v] to [15]\n    end\nend\nchange [dash v] by (-1)\nif <(dash) < [0]> then\n    set [x-vel v] to ((X-vel) * ((0.6) + (([sqrt v] of (|speed|) ) / (7))))\n    if <(Y-vel) > [0]> then\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            change [y-vel v] by (-0.9)\n        else\n            change [y-vel v] by (-2)\n        end\n    else\n        change [y-vel v] by (-1.3)\n        set [y-vel v] to ((Y-vel) * (0.96))\n    end\n    if <([abs v] of (X-vel) ) > [15]> then\n        set [x-vel v] to ((([abs v] of (X-vel) ) / (X-vel)) * (15))\n    end\nelse\n    set [x-vel v] to ((([abs v] of (.x-vel) ) / (.x-vel)) * (12))\n    set [y-vel v] to [0]\nend\nif <(stomp) = [1]> then\n    set [y-vel v] to [-30]\nend\nchange x by (X-vel)\nchange y by (Y-vel)\nset rotation style [don't rotate v]\nif <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n    change [x-vel v] by (-1.5)\nend\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    change [x-vel v] by (1.5)\nend\nswitch costume to (down v)\nif <touching (ground v)?> then\n    set [ground? v] to [yes]\n    set [y-vel v] to [0]\n    set [jump v] to [0]\n    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        set [y-vel v] to [12]\n        set [jump v] to [0.5]\n    end\n    repeat until <not <touching (ground v)?>>\n        change y by (1)\n    end\n    change y by (-1)\nelse\n    set [ground? v] to [no]\n    if <(jump) = [0]> then\n        set [jump v] to [0.5]\n    end\nend\nswitch costume to (up v)\nif <touching (ground v)?> then\n    if <[0] < (dash)> then\n        set [dash v] to [0]\n    end\n    if <<not <(Y-vel) = [10]>> or <not <<key (up arrow v) pressed?> or <key (w v) pressed?>>>> then\n        set [y-vel v] to [0]\n    end\n    repeat until <not <touching (ground v)?>>\n        change y by (-1)\n    end\nend\nset [wall touching v] to [N]\nswitch costume to (left v)\nif <<[-1] < (dash)> and <[0] > (X-vel)>> then\n    change x by (-10)\nend\nif <touching (ground v)?> then\n    set [wall touching v] to [L]\n    if <(<wall friction>) = [true]> then\n        if <(Y-vel) < [0]> then\n            set [y-vel v] to ((Y-vel) * (0.7))\n        end\n    end\n    if <<(jump) > [0.8]> and <(<wall jump>) = [true]>> then\n        set [jump v] to [0]\n    end\n    if <[0] < (dash)> then\n        set [dash v] to [0]\n    end\n    if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <<key (left arrow v) pressed?> or <key (a v) pressed?>>> and <(<wall jump>) = [true]>> then\n        set [y-vel v] to [10]\n        set [x-vel v] to [8]\n    end\n    if <[-1] < (dash)> then\n        set [x-vel v] to [-5]\n    else\n        if <(X-vel) < [0]> then\n            set [x-vel v] to [0]\n        end\n    end\n    repeat until <not <touching (ground v)?>>\n        change x by (1)\n    end\n    change x by (-1)\nend\nif <<[-1] < (dash)> and <[0] > (X-vel)>> then\n    change x by (10)\nend\nswitch costume to (right v)\nif <<[-1] < (dash)> and <(X-vel) > [0]>> then\n    change x by (10)\nend\nif <touching (ground v)?> then\n    set [wall touching v] to [R]\n    if <(<wall friction>) = [true]> then\n        if <(Y-vel) < [0]> then\n            set [y-vel v] to ((Y-vel) * (0.7))\n        end\n    end\n    if <<(jump) > [0.8]> and <(<wall jump>) = [true]>> then\n        set [jump v] to [0]\n    end\n    if <[0] < (dash)> then\n        set [dash v] to [0]\n    end\n    if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <<key (right arrow v) pressed?> or <key (d v) pressed?>>> and <(<wall jump>) = [true]>> then\n        set [y-vel v] to [10]\n        set [x-vel v] to [-8]\n    end\n    if <[-1] < (dash)> then\n        set [x-vel v] to [5]\n    else\n        if <[0] < (X-vel)> then\n            set [x-vel v] to [0]\n        end\n    end\n    repeat until <not <touching (ground v)?>>\n        change x by (-1)\n    end\n    change x by (1)\nend\nif <<[-1] < (dash)> and <(X-vel) > [0]>> then\n    change x by (-10)\nend\nset rotation style [all around v]\nswitch costume to (costume v)\nbroadcast (Move v)\n\nwhen flag clicked\nset [dash available? v] to [false]\nOptions: Wall jump [true] Double jump [false] Wall friction [true] Dash [false] Ground pound [false] Speed (0.5-3) [1] Dash cool-down (secs) [1]\nbroadcast (Move v) and wait\nforever\n    if <<(y position) < [-179]> or <<touching (hazards v)?> or <<key (r v) pressed?> or >>> then\n        set [pitch v] effect to (pick random (0) to (30))\n        start sound [Death v]\n        go to x: (-220) y: (0)\n        change [☁ global deaths v] by (1)\n        set [x-vel v] to [0]\n        set [y-vel v] to [0]\n        wait (0.05) seconds\n    end\n    if <(x position) > [239]> then\n        broadcast (Change Level v) and wait\n    end\n    Scripts\nend\n\nwhen I receive [change level v]\nchange [level v] by (1)\ngo to x: (-220) y: (0)\n\nwhen I receive [change level v]\nif <(Level) = [12]> then\n    Options: Wall jump [true] Double jump [false] Wall friction [true] Dash [true] Ground pound [false] Speed (0.5-3) [1] Dash cool-down (secs) [1]\nend\n\nwhen I receive [change level v]\nif <(Level) = [22]> then\n    Options: Wall jump [true] Double jump [true] Wall friction [true] Dash [true] Ground pound [false] Speed (0.5-3) [1] Dash cool-down (secs) [1]\nend\n\n@Ground\n\nwhen flag clicked\nset [level v] to [1]\ngo to x: (0) y: (0)\nforever\n    switch costume to (Level)\nend\n\n@Hazards\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    switch costume to (Level)\nend\n\n@Background\n\nwhen I receive [change level v]\ngo to x: (0) y: (0)\nswitch costume to (pick random (1) to (6))\npoint in direction (pick random (-90) to (90))\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (pick random (1) to (6))\npoint in direction (pick random (-90) to (90))\n\n@Dark\n\nwhen flag clicked\nshow\nswitch costume to (1 v)\ngo to [front v] layer\nset [ghost v] effect to (10)\nforever\n    go to (character v)\nend\n\n@Story\n\nwhen flag clicked\nset size to (101) %\nset [brightness v] effect to (100)\ngo to x: (-98) y: (20)\nswitch costume to (Level)\nwait until <(Level) = [2]>\ngo to x: (24) y: (48)\nwait until <(Level) = [3]>\ngo to x: (-98) y: (90)\nwait until <(Level) = [5]>\ngo to x: (-44) y: (29)\nwait until <(Level) = [9]>\ngo to x: (-44) y: (29)\nwait until <(Level) = [12]>\ngo to x: (-98) y: (20)\nwait until <(Level) = [16]>\ngo to x: (0) y: (0)\nwait until <(Level) = [17]>\ngo to x: (-134) y: (69)\nwait until <(Level) = [18]>\ngo to x: (-119) y: (-4)\nwait until <(Level) = [22]>\ngo to x: (0) y: (-50)\n\nwhen flag clicked\nforever\n    set [ghost v] effect to ((distance to [character v]) / (1.5))\n    switch costume to (Level)\nend\n\n@Static\n\nwhen flag clicked\nset size to (120) %\nshow\ngo to x: (0) y: (0)\nset [ghost v] effect to (96)\nforever\n    wait (0.001) seconds\n    next costume\nend\n\n@Saws\n\nwhen I receive [change level v]\nif <(Level) = [9]> then\n    set size to (140) %\n    go to x: (0) y: (-56)\n    create clone of (_myself_ v)\nend\nif <(Level) = [12]> then\n    set size to (140) %\n    go to x: (6) y: (-50)\n    create clone of (_myself_ v)\n    set size to (140) %\n    go to x: (6) y: (63)\n    create clone of (_myself_ v)\nend\nif <(Level) = [15]> then\n    set size to (140) %\n    go to x: (-72) y: (-25)\n    create clone of (_myself_ v)\n    set size to (140) %\n    go to x: (116) y: (-23)\n    create clone of (_myself_ v)\nend\nif <(Level) = [16]> then\n    set size to (140) %\n    go to x: (-72) y: (-40)\n    create clone of (_myself_ v)\n    set size to (140) %\n    go to x: (116) y: (-40)\n    create clone of (_myself_ v)\nend\nif <(Level) = [17]> then\n    set size to (140) %\n    go to x: (71) y: (91)\n    create clone of (_myself_ v)\n    set size to (140) %\n    go to x: (71) y: (9)\n    create clone of (_myself_ v)\n    set size to (140) %\n    go to x: (71) y: (-73)\n    create clone of (_myself_ v)\nend\nif <(Level) = [19]> then\n    set size to (140) %\n    go to x: (-16) y: (-55)\n    create clone of (_myself_ v)\n    set size to (140) %\n    go to x: (161) y: (-14)\n    create clone of (_myself_ v)\nend\nif <(Level) = [20]> then\n    set size to (140) %\n    go to x: (90) y: (-35)\n    create clone of (_myself_ v)\n    set size to (140) %\n    go to x: (90) y: (72)\n    create clone of (_myself_ v)\nend\nif <(Level) = [21]> then\n    set size to (140) %\n    go to x: (-39) y: (83)\n    create clone of (_myself_ v)\n    set size to (140) %\n    go to x: (-39) y: (-5)\n    create clone of (_myself_ v)\nend\nif <(Level) = [23]> then\n    set size to (140) %\n    go to x: (-8) y: (126)\n    create clone of (_myself_ v)\n    set size to (140) %\n    go to x: (-8) y: (44)\n    create clone of (_myself_ v)\n    set size to (140) %\n    go to x: (-8) y: (-38)\n    create clone of (_myself_ v)\nend\nif <(Level) = [24]> then\n    set size to (140) %\n    go to x: (-7) y: (89)\n    create clone of (_myself_ v)\n    set size to (140) %\n    go to x: (-7) y: (-29)\n    create clone of (_myself_ v)\nend\nif <(Level) = [25]> then\n    set size to (140) %\n    go to x: (-118) y: (4)\n    create clone of (_myself_ v)\n    set size to (140) %\n    go to x: (-33) y: (4)\n    create clone of (_myself_ v)\n    set size to (140) %\n    go to x: (52) y: (4)\n    create clone of (_myself_ v)\n    set size to (140) %\n    go to x: (205) y: (-24)\n    create clone of (_myself_ v)\n    set size to (140) %\n    go to x: (117) y: (-166)\n    create clone of (_myself_ v)\nend\n\nwhen flag clicked\ngo to [front v] layer\ngo [backward v] (50) layers\nhide\n\nwhen I start as a clone\ngo [backward v] (50) layers\nset [level thing v] to (Level)\nswitch costume to (still v)\nshow\nforever\n    if <(level thing) = (Level)> then\n        turn right (15) degrees\n    else\n        delete this clone\n    end\nend\n\nwhen I receive [change level v]\ndelete this clone\n\n@black\n\nwhen I receive [change level v]\nif <(Level) > [24]> then\n    show\n    go to x: (0) y: (0)\n    switch costume to (1 v)\n    go to [front v] layer\n    set [ghost v] effect to (100)\n    repeat (10)\n        go to [front v] layer\n        change [ghost v] effect by (-10)\n    end\n    stop [all v]\nend\n\nwhen flag clicked\nhide\n\nswitch costume to (cover v)\nshow\ngo to x: (0) y: (0)\ngo to [front v] layer\n\n