In A Cave (A Platformer).

Instructions: Use The Arrow Keys And W,A,S,D Keys To Move The Player.\n

@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop2 v)\n\nwhen I receive [start v]\nswitch backdrop to (backdrop1 v)\nforever\n    if <(Level) = [21]> then\n        wait (5) seconds\n        broadcast (outro v)\n        stop [other scripts in sprite v]\n        stop [this script v]\n    end\nend\n\nwhen I receive [start v]\nwait (1) seconds\nset volume to (50) %\nforever\n    play sound [Mysterious Sleeper v] until done\nend\n\n@Blank\n\n@PLatform\n\nwhen I receive [start v]\nshow\nforever\n    go to x: (0) y: (0)\n    switch costume to (Level)\n    if <not <(Level) = [21]>> then\n        go to [back v] layer\n    else\n        go to [front v] layer\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [outro v]\nforever\n    hide\n    stop [other scripts in sprite v]\n    stop [this script v]\nend\n\n@Will\n\nwhen I receive [play v]\ngo to [back v] layer\ngo [forward v] (2) layers\nshow\nforever\n    Platforming Engine [6]\nend\n\ndefine Touch Ground <up?>\nchange [falling? v] by (1)\nrepeat until <not <touching (platform v)?>>\n    if <up?> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [falling? v] to [0]\n    end\n    set [speed y v] to [0]\nend\n\ndefine Walk (direction) (speed)\npoint in direction (direction)\nchange x by (speed)\nset [slope v] to [0]\nrepeat until <<(slope) = [8]> or <not <touching (platform v)?>>>\n    change y by (1)\n    change [slope v] by (1)\nend\nif <(slope) = [8]> then\n    change x by ((0) - (speed))\n    change y by ((0) - (slope))\nend\nchange [frame v] by (0.5)\n\ndefine Set Costume\nif <(falling?) < [6]> then\n    if <(frame) = [0]> then\n        switch costume to (stand v)\n    else\n        switch costume to ([floor v] of ((4) + ((frame) mod (8))) )\n    end\nelse\n    if <(speed y) > [0]> then\n        switch costume to (jump v)\n    else\n        switch costume to (fall v)\n    end\nend\n\ndefine Platforming Engine (speed)\nswitch costume to (hitbox v)\nif <<(speed y) < [4]> or <<key (w v) pressed?> or <key (up arrow v) pressed?>>> then\n    change [speed y v] by (-1)\nelse\n    change [speed y v] by (-2)\nend\nchange y by (speed y)\nTouch Ground <(speed y) > [0]>\nif <touching (trampoline v)?> then\n    set [speed y v] to [20]\nend\nif <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n    Walk (-90) ((speed) * (-1))\nelse\n    if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n        Walk (90) (speed)\n    else\n        set [frame v] to [0]\n    end\nend\nif <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n    if <<(jump key) = [0]> and <(falling?) < [3]>> then\n        start sound [recording1 v]\n        set [speed y v] to [14]\n        set [falling? v] to [6]\n        set [jump key v] to [1]\n    end\nelse\n    set [jump key v] to [0]\nend\nif <<(y position) < [-190]> or <touching (blades v)?>> then\n    start sound [fall v]\n    Reset Player\n    point in direction (90)\n    set [speed y v] to [0]\nend\nSet Costume\n\nwhen I receive [start v]\nstop [other scripts in sprite v]\nbroadcast (SetUp v) and wait\nbroadcast (Play v)\n\nwhen flag clicked\nhide\n\ndefine Reset Player\nshow\nset size to (35) %\nset rotation style [left-right v]\npoint in direction (90)\ngo to x: (-210) y: (-133)\nif <<(Level) = [1]> or <(Level) = [3]>> then\n    go to x: (-210) y: (-133)\nend\nif <(Level) = [2]> then\n    go to x: (-210) y: (-147)\nend\nif <(Level) = [4]> then\n    go to x: (-210) y: (-133)\nend\nif <(Level) = [5]> then\n    go to x: (-210) y: (-154)\nend\nif <(Level) = [6]> then\n    go to x: (-210) y: (-139)\nend\nset [speed y v] to [0]\nset [falling? v] to [10]\n\nwhen I receive [setup v]\nReset Player\n\nwhen I receive [play v]\ngo to [front v] layer\nforever\n    if <(x position) > [239]> then\n        broadcast (delete clones v)\n        change [level v] by (1)\n        Reset Player\n        if <(Level) = [21]> then\n            go to [back v] layer\n            broadcast (Out v)\n            hide\n            stop [other scripts in sprite v]\n            stop [this script v]\n        end\n        wait (1) seconds\n    end\nend\n\nwhen I receive [delete clones v]\nwait (0.5) seconds\nbroadcast (Create Clone v)\nstop [this script v]\n\nwhen I receive [play v]\nforever\n    if <(Level) = [21]> then\n        go to [back v] layer\n        set [ghost v] effect to (110)\n        hide\n    end\nend\n\nwhen I receive [outro v]\nforever\n    hide\n    stop [other scripts in sprite v]\n    stop [this script v]\nend\n\n@Decorations\n\nwhen I receive [start v]\nshow\nset [level v] to [1]\nforever\n    go to x: (0) y: (0)\n    switch costume to (Level)\n    if <not <(Level) = [21]>> then\n        go to [back v] layer\n    else\n        go to [front v] layer\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [outro v]\nforever\n    hide\n    stop [other scripts in sprite v]\n    stop [this script v]\nend\n\n@blades\n\nwhen flag clicked\nhide\n\ndefine Clone at x: (x) y: (y) Turn (rotate) Set Size (size) BladeType (saw/spikes)\npoint in direction (90)\ngo to x: (x) y: (y)\nset [rotation v] to (rotate)\nset [size v] to (size)\nswitch costume to (saw/spikes)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nclear graphic effects\nset size to (size) %\nshow\ngo to [back v] layer\nforever\n    turn right (rotation) degrees\nend\n\nwhen I receive [delete clones v]\ndelete this clone\n\nwhen [m v] key pressed\nset [editor v] to (join (mouse x) (join [,] (mouse y)))\n\ndefine pre-celebration!\n\nwhen I receive [start v]\nhide\nforever\n    wait until <(Level) = [7]>\n    Clone at x: [-13] y: [-125] Turn [0] Set Size [95] BladeType [Spikes]\n    wait until <(Level) = [9]>\n    Clone at x: [-13] y: [-125] Turn [5] Set Size [95] BladeType [Saw]\n    wait until <(Level) = [10]>\n    Clone at x: [-13] y: [-125] Turn [5] Set Size [95] BladeType [Saw]\n    wait until <(Level) = [10]>\n    Clone at x: [141] y: [-112] Turn [0] Set Size [95] BladeType [Spikes]\n    wait until <(Level) = [11]>\n    Clone at x: [-72] y: [98] Turn [5] Set Size [95] BladeType [Saw]\n    wait until <(Level) = [13]>\n    Clone at x: [-54] y: [-152] Turn [5] Set Size [95] BladeType [Saw]\n    Clone at x: [131] y: [-135] Turn [5] Set Size [95] BladeType [Saw]\n    wait until <(Level) = [14]>\n    Clone at x: [3] y: [-189] Turn [5] Set Size [95] BladeType [Saw]\n    wait until <(Level) = [15]>\n    Clone at x: [-125] y: [-151] Turn [0] Set Size [95] BladeType [Spikes]\n    Clone at x: [131] y: [-117] Turn [5] Set Size [95] BladeType [Saw]\n    wait until <(Level) = [16]>\n    Clone at x: [-19] y: [-184] Turn [5] Set Size [95] BladeType [Saw]\n    wait until <(Level) = [17]>\n    Clone at x: [10] y: [-73] Turn [5] Set Size [95] BladeType [Saw]\n    Clone at x: [147] y: [-67] Turn [0] Set Size [95] BladeType [Spikes]\n    wait until <(Level) = [19]>\n    Clone at x: [-233] y: [-36] Turn [5] Set Size [95] BladeType [Saw]\n    Clone at x: [-109] y: [-130] Turn [0] Set Size [95] BladeType [Spikes]\n    Clone at x: [102] y: [-197] Turn [5] Set Size [95] BladeType [Saw]\nend\n\n\n\nwhen I receive [out v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\nwhen flag clicked\nhide\n\nwhen I receive [outro v]\nforever\n    hide\n    stop [other scripts in sprite v]\n    stop [this script v]\nend\n\n@Out\n\nwhen I receive [show v]\ngo to [back v] layer\ngo [forward v] (2) layers\nshow\nforever\n    Platforming Engine [6]\nend\n\ndefine Touch Ground <up?>\nchange [falling? v] by (1)\nrepeat until <not <touching (platform v)?>>\n    if <up?> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [falling? v] to [0]\n    end\n    set [speed y v] to [0]\nend\n\ndefine Walk (direction) (speed)\npoint in direction (direction)\nchange x by (speed)\nset [slope v] to [0]\nrepeat until <<(slope) = [8]> or <not <touching (platform v)?>>>\n    change y by (1)\n    change [slope v] by (1)\nend\nif <(slope) = [8]> then\n    change x by ((0) - (speed))\n    change y by ((0) - (slope))\nend\nchange [frame v] by (0.5)\n\ndefine Set Costume\ngo to [front v] layer\nif <(falling?) < [6]> then\n    if <(frame) = [0]> then\n        switch costume to (stand v)\n    else\n        switch costume to ([floor v] of ((4) + ((frame) mod (8))) )\n    end\nelse\n    if <(speed y) > [0]> then\n        switch costume to (jump v)\n    else\n        switch costume to (fall v)\n    end\nend\n\ndefine Platforming Engine (speed)\nswitch costume to (hitbox v)\nif <<(speed y) < [4]> or <<key (w v) pressed?> or <key (up arrow v) pressed?>>> then\n    change [speed y v] by (-1)\nelse\n    change [speed y v] by (-2)\nend\nchange y by (speed y)\nTouch Ground <(speed y) > [0]>\nif <touching (trampoline v)?> then\n    set [speed y v] to [20]\nend\nif <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n    Walk (-90) ((speed) * (-1))\nelse\n    if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n        Walk (90) (speed)\n    else\n        set [frame v] to [0]\n    end\nend\nif <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n    if <<(jump key) = [0]> and <(falling?) < [3]>> then\n        start sound [recording1 v]\n        set [speed y v] to [14]\n        set [falling? v] to [6]\n        set [jump key v] to [1]\n    end\nelse\n    set [jump key v] to [0]\nend\nif <<(y position) < [-190]> or <touching (blades v)?>> then\n    start sound [recording2 v]\n    change [health v] by (-1)\n    Reset Player\n    point in direction (90)\n    set [speed y v] to [0]\nend\nSet Costume\n\nwhen I receive [out v]\nclear graphic effects\nstop [other scripts in sprite v]\nbroadcast (Setup v) and wait\nbroadcast (Show v)\n\nwhen flag clicked\nset [ghost v] effect to (100)\nhide\n\ndefine Reset Player\nshow\nset size to (35) %\nset rotation style [left-right v]\npoint in direction (90)\ngo to x: (-210) y: (-133)\nif <<(Level) = [1]> or <(Level) = [3]>> then\n    go to x: (-210) y: (-133)\nend\nif <(Level) = [2]> then\n    go to x: (-210) y: (-147)\nend\nif <(Level) = [4]> then\n    go to x: (-210) y: (-133)\nend\nif <(Level) = [5]> then\n    go to x: (-210) y: (-154)\nend\nif <(Level) = [6]> then\n    go to x: (-210) y: (-139)\nend\nset [speed y v] to [0]\nset [falling? v] to [10]\n\nwhen I receive [setup v]\nReset Player\n\nwhen I receive [outro v]\nforever\n    hide\n    stop [other scripts in sprite v]\nend\n\n@Intro\n\nwhen flag clicked\nset [intro v] to [Yes]\nstart sound [Zaza - Be Together v]\ngo to x: (0) y: (0)\nswitch costume to (logo v)\npoint in direction (-70)\nset [ghost v] effect to (100)\nset size to (20) %\nshow\nrepeat (17)\n    turn left (10) degrees\n    change [ghost v] effect by (-5)\n    change size by (4)\nend\nrepeat (3)\n    turn left (7.5) degrees\n    change [ghost v] effect by (-3.75)\n    change size by (3)\nend\nrepeat (1)\n    turn left (5) degrees\n    change [ghost v] effect by (-2.5)\n    change size by (2)\nend\nrepeat (1)\n    turn left (3) degrees\n    set size to (100) %\n    clear graphic effects\nend\nwait (0.5) seconds\nwait (5.5) seconds\nstart sound [car passing v]\ncreate clone of (_myself_ v)\nswitch costume to (glide v)\ngo to x: (-800) y: (0)\nset [level v] to [1]\nglide (0.2) secs to x: (0) y: (0)\nbroadcast (del v)\nbroadcast (Start v)\nglide (0.2) secs to x: (800) y: (0)\nhide\n\nwhen flag clicked\nwait (1.7) seconds\nset [x v] to [2]\nrepeat (8)\n    wait (0.4) seconds\n    create clone of (_myself_ v)\n    change [x v] by (1)\nend\nset [x v] to [999]\n\nwhen I receive [del v]\ndelete this clone\n\nwhen I start as a clone\nif <(intro) = [Yes]> then\n    if <(x) = [999]> then\nelse\n    go to [back v] layer\n    clear graphic effects\n    set size to (110) %\n    go to x: (0) y: (0)\n    switch costume to (outro v)\nend\n\nwhen I receive [outro v]\ngo to x: (0) y: (-25)\nshow\nset [sine v] to [0]\nswitch costume to (logo v)\nset [intro v] to [No]\ncreate clone of (_myself_ v)\nforever\n    change [sine v] by (7.5)\n    point in direction ((([sin v] of (sine) ) * (15)) + (90))\n    set size to ((([sin v] of ((sine) * (2)) ) * (25)) + (150)) %\nend\n\nwhen I receive [outro v]\nforever\n    play sound [Outro Music v] until done\nend\n\n@Spalsh\n\nwhen flag clicked\nhide\n\n