Lucid Valley - Scrolling platformer

Instructions:                         ✦  LUCID VALLEY ✦\n          It's out!!! My first scrolling platformer! \n     Please love and fave, it would really help me out!\n      Maybe even follow me! Help spread word about me\n    for more games like these! So I hope you enjoy \n         my game! More coming out soon!\n-----------------------------------------------------------

@Stage\n\nwhen flag clicked\nforever\n    play sound [jobii-brunch v] until done\nend\n\n@Blank\n\n@Player\n\ndefine Start The Game\nset [ded v] to []\nset [y v] to [0]\nset [x v] to [-50]\nset [sx v] to [0]\nset [sy v] to [0]\nset [in air v] to [0]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset size to (130) %\nset [ghost v] effect to (0)\nshow\n\nif <(CHECKPOINT?) = [1]> then\n    set [y v] to [396]\n    set [x v] to [2618]\nelse\nend\n\nwhen flag clicked\nset [checkpoint? v] to [0]\nset [level v] to [1]\nset [timer v] to [0]\nbroadcast (Set Game v)\nbroadcast (Play Game v)\n\nwhen I receive [set game v]\nhide\ngo to [front v] layer\n\nwhen I receive [play game v]\nforever\n    broadcast (Reset v)\n    broadcast (Setup v)\n    Start The Game\n    repeat until <(DED) > []>\n        Tick\n        broadcast (Tick v)\n    end\n    if <(DED) = [Dead]> then\n        Player Die\n    end\nend\n\ndefine Tick\nif <<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>>> then\n    switch costume to (left v)\n    change [sx v] by (-2)\nend\nif <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>>> then\n    switch costume to (right v)\n    change [sx v] by (2)\nend\nif <not <<<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 <(mouse x) < (x position)>>>>>> then\n    switch costume to (normal v)\nend\nset [sx v] to ((sx) * (0.8))\nif <([abs v] of (sx) ) > [0.9]> then\n    Change X By (player) (round (sx))\nend\nif <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n    if <(In Air) < [4]> then\n        set [sy v] to [16]\n    end\nend\nif <(sy) > [-20]> then\n    change [sy v] by (-2)\nend\nChange Y (player) By (sy)\nTrap Die\nset [scroll x v] to (x)\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\nend\nif <(SCROLL Y) < [0]> then\n    set [scroll y v] to [0]\nend\nchange [scroll y v] by (((y) - (SCROLL Y)) / (15))\nPosition\nif <(y) < [-180]> then\n    set [ded v] to [Dead]\nend\n\ndefine Change X By (player) (sx)\nchange [x v] by (sx)\nchange [in air v] by (1)\nPosition\nif <touching (level v)?> then\n    repeat (12)\n        change [y v] by (1)\n        Position\n        if <not <touching (level v)?>> then\n            stop [other scripts in sprite v]\n        end\n    end\n    change [y v] by (-12)\n    if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n        if <(sx) > [0]> then\n            set [sx v] to [-16]\n        else\n            set [sx v] to [16]\n        end\n        set [in air v] to [0]\n    else\n        set [sx v] to [0]\n    end\n    repeat until <not <touching (level 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 Position\ngo to x: ((x) - (SCROLL X)) y: ((y) - (SCROLL Y))\n\ndefine Change Y (player) By (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nPosition\nrepeat until <not <touching (level 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\nchange [sy v] by (-2)\nChange Y (player) By (sy)\n\ndefine Player Die\nset [ded v] to []\n\ndefine Trap Die\nif <touching (danger v)?> then\n    set [ded v] to [Dead]\nend\n\nset [scroll y v] to (y)\n\nwhen I receive [play game v]\n\nset [y v] to [0]\nset [x v] to [-50]\n\nwhen I receive [tick v]\nif <touching (you win! v)?> then\n    broadcast (WIN! v)\nend\n\n@Level\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 [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\ndefine Clone at (x) (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nwhen I receive [set game v]\nhide\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen I receive [setup v]\nset [x v] to [0]\nset [y v] to [0]\nhide\nif <(LEVEL) = [1]> then\n    switch costume to (1 1 v)\n    Clone at [360] [0]\n    Clone at [360] [0]\n    Clone at [360] [0]\n    Clone at [360] [0]\n    Clone at [720] [0]\n    Clone at [720] [250]\n    Clone at [720] [250]\n    Clone at [720] [300]\nend\n\n@Danger\n\nwhen I receive [setup v]\ngo to [back v] layer\nset [x v] to [0]\nset [y v] to [0]\nhide\nif <(LEVEL) = [1]> then\n    switch costume to (1 1 v)\n    Clone at [360] [0]\n    Clone at [360] [0]\n    Clone at [360] [0]\n    Clone at [360] [0]\n    Clone at [720] [0]\n    Clone at [720] [250]\n    Clone at [720] [250]\nend\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [set game v]\nhide\n\ndefine Clone at (x) (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\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\nClone at [360] [-200]\n\nClone at [720] [250]\n\n@Decor\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 [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\ndefine Clone at (x) (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nwhen I receive [set game v]\ngo to [back v] layer\nhide\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen I receive [setup v]\nset [x v] to [0]\nset [y v] to [0]\nhide\nif <(LEVEL) = [1]> then\n    switch costume to (1 1 v)\n    Clone at [360] [0]\n    Clone at [360] [0]\n    Clone at [360] [0]\n    Clone at [360] [0]\n    Clone at [720] [0]\n    Clone at [720] [250]\n    Clone at [720] [250]\nend\n\ngo to [back v] layer\n\n@YOU WIN!\n\nwhen I receive [setup v]\ngo to [back v] layer\nset [x v] to [0]\nset [y v] to [0]\nhide\nif <(LEVEL) = [1]> then\n    switch costume to (1 1 v)\n    Clone at [360] [0]\n    Clone at [360] [0]\n    Clone at [360] [0]\n    Clone at [360] [0]\n    Clone at [720] [0]\n    Clone at [720] [250]\n    Clone at [720] [250]\n    Clone at [720] [300]\nend\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [set game v]\nhide\n\ndefine Clone at (x) (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\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\nClone at [360] [-200]\n\nwhen I receive [win! v]\nstop [other scripts in sprite v]\nhide\nbroadcast (WIN SCREEN v)\n\n@Win screen\n\nwhen flag clicked\ngo to [front v] layer\nhide\nset [ghost v] effect to (100)\n\nwhen I receive [win screen v]\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\n    go to [front v] layer\nend\nwait (3) seconds\nstop [all v]\n\n@Thumbnail!\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    go to [front v] layer\nend\n\n