[FIXED] Dark and Afraid = A Scrolling Platformer

Instructions: Storyline:\nYou have been trapped on a field trip to a mine. You are alone, but you have light. You have to escape to survive. The collapse of the cave made pointy spikes, daring landscapes, and a journey so terrifying, you have to try for yourself. \n\nControls:\nArrow keys, wasd, or tap to move\nUse your light to find your way!\n\nTips: Press down arrow, s, of mobile way to move like:\n1. Smaller character\n2. Faster downwards\n\nWhat I fixed/ why I reshared:\nWhat I fixed:\n1. The dying at beginning.\n2. A little bit of velocity changes.\n\nReshared (8/16/2020) :\nI don't like it when I fix a bug and the project is shared. I did this once I was trending (I didn't unshare) and there was a major glitch that took an hour to fix (oop me XP).

@Stage\n\n@platforms\n\nwhen I receive [flag v]\nshow\n\nwhen I receive [tik v]\nposition ((x) - (SCROLLX)) ((Y) - (SCROLLY))\n\nwhen I receive [setup v]\nswitch costume to (level 1 1 v)\nhide\nset [x v] to [0]\nset [y v] to [0]\nclone at x [0] Y: [0]\nclone at x [0] Y: [360]\nclone at x [0] Y: [360]\nclone at x [0] Y: [360]\nclone at x [0] Y: [360]\nclone at x [0] Y: [360]\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\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\n\nmove (10) steps\n\nclone at x [360] Y: [0]\n\nclone at x [360] Y: [0]\n\nset [level v] to [3]\n\nwhen flag clicked\ndelete this clone\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\n\nwhen flag clicked\nset [brightness v] effect to (-100)\n\n@loader\n\nwhen flag clicked\nshow\nset [percent v] to [0]\nbroadcast (no lag v)\nrepeat until <<(percent) = [100]> or <(percent) > [100]>>\n    erase all\n    load (percent)\n    change [percent v] by (pick random (-0.5) to (3))\n    wait (pick random (0) to (0.1)) seconds\nend\nerase all\nset pen size to (25)\nset pen color to (#00a91e)\npen up\ngo to x: (-100) y: (0)\npen down\ngo to x: (100) y: (0)\nwait (0.4) seconds\nbroadcast (up down v)\nwait (0.35) seconds\nbroadcast (flag v)\nerase all\nwait (0.3) seconds\nerase all\nhide\n\ndefine load (percent)\nset pen size to (25)\nset pen color to (#b4b4b4)\npen up\ngo to x: (-100) y: (0)\npen down\ngo to x: (100) y: (0)\npen up\nset pen color to (#00a91e)\ngo to x: (-100) y: (0)\npen down\ngo to x: ((-100) + ((percent) * (2))) y: (0)\n\n@end sign\n\nwhen I receive [flag v]\nshow\n\nwhen I receive [tik v]\nposition ((x) - (SCROLLX)) ((Y) - (SCROLLY))\n\nwhen I receive [setup v]\nswitch costume to (level 1 1 v)\nhide\nset [x v] to [0]\nset [y v] to [0]\nclone at x [0] Y: [0]\nclone at x [0] Y: [360]\nclone at x [0] Y: [360]\nclone at x [0] Y: [360]\nclone at x [0] Y: [360]\nclone at x [0] Y: [500]\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\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\n\nmove (10) steps\n\nclone at x [360] Y: [0]\n\nclone at x [360] Y: [0]\n\nset [level v] to [3]\n\nwhen flag clicked\ndelete this clone\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\ngo to [front v] layer\n\nwhen I receive [tik v]\nset [brightness v] effect to ((distance to [player v]) / (2.3))\n\nwhen flag clicked\nhide\n\n@ghost layer 1\n\nwhen flag clicked\nhide\n\nwhen I receive [tik v]\ngo to [back v] layer\nshow\ngo to (player v)\nset [ghost v] effect to (78)\nset size to ((([sin v] of ((ghost) * (300)) ) * (6)) + (133)) %\nchange [ghost v] by (0.033)\n\nwhen flag clicked\nforever\n    reset timer\nend\n\n@ghost layer 2\n\nwhen flag clicked\nhide\n\nwhen I receive [tik v]\nshow\ngo to [back v] layer\ngo to (player v)\nset [ghost v] effect to (82)\nset size to ((([cos v] of ((ghost) * (230)) ) * (5)) + (115)) %\n\n@ghost layer 3\n\nwhen flag clicked\nhide\n\nwhen I receive [tik v]\ngo to [back v] layer\nshow\ngo to (player v)\nset [ghost v] effect to (86)\nset size to ((([cos v] of ((ghost) * (235)) ) * (7)) + (172)) %\n\n@ghost layer 4\n\nwhen flag clicked\nhide\n\nwhen I receive [tik v]\ngo to [back v] layer\nshow\ngo to (player v)\nset [ghost v] effect to (91)\nset size to ((([cos v] of ((ghost) * (215)) ) * (6)) + (195)) %\n\n@load notes\n\nwhen flag clicked\nshow\nswitch costume to (costume1 v)\nrepeat until <<(percent) > [100]> or <(percent) = [100]>>\n    switch costume to (pick random (1) to (7))\n    wait (pick random (0.05) to (0.3)) seconds\nend\nswitch costume to (costume8 v)\n\nforever\nend\n\nwhen I receive [play game v]\nhide\n\nwhen I receive [no lag v]\nshow\nswitch costume to (costume1 v)\nrepeat until <<(percent) > [100]> or <(percent) = [100]>>\n    switch costume to (pick random (1) to (7))\n    wait (pick random (0.05) to (0.3)) seconds\nend\nswitch costume to (costume8 v)\n\nwhen I receive [flag v]\nshow\nswitch costume to (costume1 v)\nrepeat until <<(percent) > [100]> or <(percent) = [100]>>\n    switch costume to (pick random (1) to (7))\n    wait (0.05) seconds\nend\nswitch costume to (costume8 v)\n\nshow\nswitch costume to (costume1 v)\nrepeat until <<(percent) > [100]> or <(percent) = [100]>>\n    switch costume to (pick random (1) to (7))\n    wait (0.05) seconds\nend\nswitch costume to (costume8 v)\n\nwhen I receive [play game v]\nhide\n\nwhen I receive [reset v]\nhide\n\nwhen I receive [setup v]\nhide\n\nwhen I receive [tik v]\nhide\n\nwhen I receive [title tick v]\nhide\n\n@thumbnail\n\nwhen flag clicked\nset [ghost v] effect to (100)\ngo to x: (0) y: (0)\ngo to [front v] layer\n\nwhen I receive [up down v]\nset [ghost v] effect to (0)\ngo to [front v] layer\ngo to x: (0) y: (0)\n\nwait (1) seconds\nrepeat (100)\nend\n\nwait (0.01) seconds\n\nset [ghost v] effect to (100)\ngo to x: (0) y: (0)\nset [title can tik v] to [1]\n\nset [ghost v] effect to (100)\n\nglide (0.35) secs to x: (0) y: (-360)\n\nwhen [timer v] > (0)\nhide variable [oofs v]\nhide variable [time v]\n\nwhen [timer v] > (0)\nset [ghost v] effect to (0)\ngo to x: (0) y: (0)\ngo to [front v] layer\n\nbroadcast (begin title tik v)\n\nwhen I receive [tik v]\nchange [ghost v] effect by (1)\n\n@spikes\n\nwhen I receive [flag v]\nshow\n\nwhen I receive [tik v]\nposition ((x) - (SCROLLX)) ((Y) - (SCROLLY))\n\nwhen I receive [setup v]\nswitch costume to (level 1 1 v)\nhide\nset [x v] to [0]\nset [y v] to [0]\nclone at x [0] Y: [0]\nclone at x [0] Y: [360]\nclone at x [0] Y: [360]\nclone at x [0] Y: [360]\nclone at x [0] Y: [360]\nclone at x [0] Y: [360]\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\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\n\nmove (10) steps\n\nclone at x [360] Y: [0]\n\nclone at x [360] Y: [0]\n\nset [level v] to [3]\n\nwhen flag clicked\ndelete this clone\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\n\nwhen flag clicked\nset [brightness v] effect to (-100)\n\n@music/mute\n\nwhen I receive [play game v]\nshow\nforever\n    play sound [Haunted Pass 1 v] until done\n    play sound [Haunted Pass 2 v] until done\nend\n\nwhen this sprite clicked\nif <<touching (mouse-pointer v)?> and <mouse down?>> then\n    if <(volume) = [0]> then\n        set volume to (100) %\n        wait until <not <<touching (mouse-pointer v)?> and <mouse down?>>>\n        stop [this script v]\n    end\n    if <(volume) = [100]> then\n        set volume to (0) %\n        wait until <not <<touching (mouse-pointer v)?> and <mouse down?>>>\n        stop [this script v]\n    end\nend\n\nwhen flag clicked\nhide\nset volume to (100) %\n\nwhen I receive [tik v]\nif <touching (mouse-pointer v)?> then\n    set [music touch v] to [1]\nelse\n    set [music touch v] to [0]\nend\n\n@text\n\nwhen I receive [flag v]\nshow\n\nwhen I receive [tik v]\nposition ((x) - (SCROLLX)) ((Y) - (SCROLLY))\n\nwhen I receive [setup v]\nswitch costume to (level 1 1 v)\nhide\nset [x v] to [0]\nset [y v] to [0]\nclone at x [0] Y: [0]\nclone at x [0] Y: [360]\nclone at x [0] Y: [360]\nclone at x [0] Y: [360]\nclone at x [0] Y: [360]\nclone at x [0] Y: [500]\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\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\n\nmove (10) steps\n\nclone at x [360] Y: [0]\n\nclone at x [360] Y: [0]\n\nset [level v] to [3]\n\nwhen flag clicked\ndelete this clone\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\ngo to [front v] layer\n\nwhen I receive [tik v]\nset [brightness v] effect to ((distance to [player v]) / (2.6))\n\n@win\n\nwhen I receive [real win v]\nset [won peeps v] to [1]\ngo to x: (0) y: (0)\nshow\nset [ghost v] effect to (100)\nset size to (130) %\ngo to [front v] layer\nrepeat (10)\n    change size by (-3)\n    change [ghost v] effect by (-10)\n    go to [front v] layer\nend\nrepeat (10)\n    go to x: (pick random (-10) to (10)) y: (pick random (-10) to (10))\n    go to [front v] layer\nend\nshow variable [time v]\nshow variable [oofs v]\n\nwhen flag clicked\nset [time v] to [0]\nset [won peeps v] to [0]\nhide variable [time v]\nhide variable [oofs v]\nhide\ngo to [front v] layer\nrepeat until <(won peeps) = [1]>\n    wait (1) seconds\n    change [time v] by (1)\nend\n\n@detector\n\nwhen flag clicked\nhide\nset [faved___ v] to [0]\nset [loved__ v] to [0]\nset [clone id v] to [0]\ncreate clone of (_myself_ v)\nwait (0.2) seconds\nset [clone id v] to [1]\ncreate clone of (_myself_ v)\nwait until <<(LOVED__) = [1]> and <(FAVED___) = [1]>>\nwait (1) seconds\nshow\ngo to x: (0) y: (50)\nreset timer\nswitch costume to (pick random (1) to (4))\nset [ghost v] effect to (100)\nrepeat (33)\n    change y by ((y position) / (-15))\n    change [ghost v] effect by (-3)\nend\nwait (1) seconds\nrepeat (10)\n    change y by (((y position) - (-100)) / (-15))\n    change [ghost v] effect by (10)\nend\n\nwhen I start as a clone\nif <(clone id) = [0]> then\n    go to x: (-15) y: (0)\n    set [loved__ v] to [0]\n    switch costume to (love v)\n    forever\n        set [love? v] to <touching (mouse-pointer v)?>\n        if <touching (mouse-pointer v)?> then\n            set [loved__ v] to [1]\n        end\n    end\nend\nif <(clone id) = [1]> then\n    go to x: (0) y: (0)\n    switch costume to (fave v)\n    set [faved___ v] to [0]\n    forever\n        set [fav v] to <touching (mouse-pointer v)?>\n        if <touching (mouse-pointer v)?> then\n            set [faved___ v] to [1]\n        end\n    end\nend\n\n@player\n\nwhen flag clicked\nbroadcast (flag v) and wait\nbroadcast (play game v) and wait\n\nwhen I receive [flag v]\nhide\n\nwhen I receive [play game v]\nset [level v] to [1]\nforever\n    broadcast (reset v)\n    broadcast (setup v)\n    Game on\n    repeat until <(EXIT) > []>\n        Tick\n        broadcast (tik 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\nset [x v] to [0]\nset [y v] to [0]\nset [sy v] to [0]\nset [in air v] to []\nset [exit v] to []\nset size to (40) %\npoint in direction (90)\nshow\n\ndefine Tick\nif <(title can tik) = [1]> then\n    broadcast (begin title tik v)\nend\nif <<touching (end sign v)?> and <(win?) = [0]>> then\n    set [win? v] to [1]\n    broadcast (real win v)\nend\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(x position) > (mouse x)>>> then\n    point in direction (-90)\n    change [sx v] by (-3.4)\n    change player x by [-9]\n    switch costume to (costume2 v)\nend\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n    point in direction (90)\n    change [sx v] by (3.4)\n    change player x by [9]\n    switch costume to (costume1 v)\nend\nif <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <key (space v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> then\n    if <(in air) < [1]> then\n        set [sy v] to [23]\n    end\nend\nchange [sy v] by (-2)\nChange player y by? (sy)\nposition\nTEST_die\nset [scrollx v] to (x)\nif <(SCROLLX) < [0]> then\n    set [scrollx v] to [0]\nend\nchange [scrolly v] by (round ((Y) - (SCROLLY)))\nif <(SCROLLY) < [0]> then\n    set [scrolly v] to [0]\nend\nposition\nif <(y position) < [-180]> then\n    set [exit v] to [die]\nend\nset [sx v] to ((sx) * (0.7))\n\ndefine Change player y by? (sy)\nchange [y v] by (sy)\nset [in air v] to [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 [sy v] to [0]\nend\n\ndefine position\ngo to x: ((x) - (SCROLLX)) y: ((Y) - (SCROLLY))\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    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\nchange [x v] by (-7)\n\ndefine Game-Die\nchange [oofs v] by (1)\nset [exit v] to []\nbroadcast (die v)\nrepeat (5)\n    hide\n    wait (0.1) seconds\n    show\n    wait (0.1) seconds\nend\nhide\nwait (0.5) seconds\n\ndefine TEST_die\nif <<touching (spikes v)?> or <touching (danger2 v)?>> then\n    broadcast (die v)\nend\n\nwait (0.01) seconds\n\ndefine game win\nstart sound [Teleport2 v]\nrepeat (50)\n    point towards (exit v)\n    turn right (65) degrees\n    move ((distance to [exit v]) / (2)) steps\n    change size by (-1)\n    change [ghost v] effect by (-2)\nend\nhide\nchange [level v] by (1)\nwait (1) seconds\n\nwhen [right arrow v] key pressed\n\nwhen flag clicked\nswitch costume to (costume1 v)\n\nwhen flag clicked\n\nturn left (15) degrees\n\nwhen I receive [die v]\nset [exit v] to [die]\n\nwhen I receive [tik v]\nset [big sy v] to (sy)\n\nTEST_die\n\nwhen I receive [reset v]\nwait until <not <<<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <key (space v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> or <<<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> or <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(x position) > (mouse x)>>>>>>\nset [x v] to [0]\nset [y v] to [0]\n\nwhen flag clicked\nset [title can tik v] to [0]\nset [win? v] to [0]\nrepeat (10)\n    set [oofs v] to [0]\nend\n\nwhen I receive [up down v]\nchange player x by [0.1]\n\nwhen flag clicked\nset [x v] to [0]\nset [y v] to [0]\nset [sy v] to [0]\nset [in air v] to []\nset [exit v] to []\nset size to (40) %\npoint in direction (90)\n\nwhen I receive [flag v]\nset [x v] to [0]\nset [y v] to [0]\nset [sy v] to [0]\nset [in air v] to []\nset [exit v] to []\nset size to (40) %\npoint in direction (90)\nhide\n\nwhen I receive [play game v]\nrepeat (10)\n    set [oofs v] to [0]\nend\n\nwhen I receive [play game v]\nset [x v] to [0]\nset [y v] to [0]\nset [sy v] to [0]\nset [in air v] to []\nset [exit v] to []\nset size to (40) %\npoint in direction (90)\nhide\n\nwhen I receive [real win v]\nset [x v] to [0]\nset [y v] to [0]\nset [sy v] to [0]\nset [in air v] to []\nset [exit v] to []\nset size to (40) %\npoint in direction (90)\nhide\n\nwhen I receive [flag v]\nrepeat (10)\n    set [oofs v] to [0]\nend\n\n@Remember\n\nwhen flag clicked\nhide\nwait (14) seconds\nstart sound [Ding - Sound Effect \[HD\] v]\ngo to x: (0) y: (85)\nshow\nglide (1) secs to x: (0) y: (0)\nwait (1) seconds\nglide (1) secs to x: (0) y: (85)\nhide\n\n