Caved || A Mobile Platformer
@Stage\n\nwhen flag clicked\nswitch backdrop to (intro v)\n\nwhen I receive [outside v]\nswitch backdrop to (outside v)\n\nwhen I receive [before start v]\nswitch backdrop to (backdrop1 v)\nrepeat (10)\n    play sound [Airway v] until done\nend\n\n@Player\n\nwhen flag clicked\nhide\n\ndefine fast\nrepeat (6)\n    if <touching (cave hitbox v)?> then\n        change y by (1)\n    end\nend\n\ndefine xcoll\nrepeat until <not <touching (cave hitbox v)?>>\n    if <(x) > [0]> then\n        change x by (-1)\n    else\n        change x by (1)\n    end\nend\n\ndefine ycoll\nrepeat until <not <touching (cave hitbox v)?>>\n    if <(y) > [0]> then\n        change y by (-1)\n    else\n        change y by (1)\n    end\nend\n\nwhen I start as a clone\ngo to (player v)\ngo [forward v] (1) layers\nswitch costume to (eye v)\nforever\n    point towards (player v)\n    move ((distance to [player v]) / (0.7)) steps\n    if <<(distance to [player v]) > [3]> and <touching (_edge_ v)?>> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [done v]\ngo to (player v)\n\nwhen I receive [ded v]\ngo to (player v)\n\nwhen I receive [before start v]\nshow\ngo to [back v] layer\nswitch costume to (guy v)\ncreate clone of (_myself_ v)\nset [y v] to [0]\nset [x v] to [0]\npoint in direction (90)\ngo to x: (-220) y: (-80)\nset rotation style [left-right v]\nforever\n    change [y v] by (-1)\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n        change [x v] by (1)\n    end\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(x position) > (mouse x)>>> then\n        change [x v] by (-1)\n    end\n    set [x v] to ((x) * (0.9))\n    change x by (x)\n    if <touching (cave hitbox v)?> then\n        fast\n        if <touching (cave hitbox v)?> then\n            change y by (-6)\n            xcoll\n            if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> then\n                set [y v] to [12]\n                if <([abs v] of (x) ) = (x)> then\n                    set [x v] to [-8]\n                else\n                    set [x v] to [8]\n                end\n            else\n                set [x v] to [0]\n            end\n        end\n    end\n    change y by (y)\n    if <touching (cave hitbox v)?> then\n        ycoll\n        if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> and <(y) < [0]>> then\n            set [y v] to [14]\n        else\n            set [y v] to [0]\n        end\n    end\n    if <<<(x position) > [240]> or <key (p v) pressed?>> and <not <([costume # v] of [cave hitbox v]) = [18]>>> then\n        wait until <not <key (p v) pressed?>>\n        broadcast (done v)\n        set [x v] to [0]\n        set [y v] to [0]\n        go to x: (-220) y: (-80)\n    end\n    if <<<touching (spikes v)?> or <touching (goo v)?>> or <(y position) < [-180]>> then\n        broadcast (ded v)\n        start sound [Crunch v]\n        wait (0) seconds\n        set [x v] to [0]\n        set [y v] to [0]\n        go to x: (-220) y: (-80)\n    end\nend\n\n@Player Light\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nshow\nswitch costume to (Clone #)\nforever\n    change [size v] by (5)\n    go to (player v)\n    set size to ((100) + (([cos v] of (size) ) * (10))) %\n    set [brightness v] effect to ([sin v] of ((size) * (5)) )\n    go to [back v] layer\nend\n\nwhen I receive [outside v]\nhide\n\nwhen I receive [before start v]\nhide\nset [size v] to [0]\nset [clone # v] to [1]\ncreate clone of (_myself_ v)\nset [size v] to [22]\nset [clone # v] to [2]\ncreate clone of (_myself_ v)\nset [size v] to [45]\nset [clone # v] to [3]\ncreate clone of (_myself_ v)\nset [size v] to [67]\nset [clone # v] to [4]\ncreate clone of (_myself_ v)\n\n@Cave Graphics\n\nwhen flag clicked\nhide\n\nwhen I receive [done v]\nnext costume\nif <(costume [number v]) = [18]> then\n    broadcast (outside v)\nend\n\nwhen I receive [before start v]\nshow\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\ngo to [back v] layer\ngo [forward v] (1) layers\n\n@Cave Hitbox\n\nwhen flag clicked\nhide\n\nwhen I receive [done v]\nnext costume\n\nwhen I receive [before start v]\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\nset [ghost v] effect to (100)\nshow\n\n@Spikes\n\nwhen flag clicked\nhide\n\nwhen I receive [done v]\nnext costume\n\nwhen I receive [before start v]\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\ngo to [back v] layer\nshow\n\n@Goo\n\nwhen flag clicked\nhide\n\nwhen I receive [done v]\nnext costume\n\nwhen I receive [before start v]\nswitch costume to (costume1 v)\ngo to x: (0) y: (0)\nset [kine v] to [0]\ngo to [back v] layer\nshow\nforever\n    change [kine v] by (1)\n    set y to ((5) + (([sin v] of ((kine) * (5)) ) * (3)))\nend\n\n@Text\n\nwhen flag clicked\nhide\n\nwhen I receive [done v]\nnext costume\nset size to (50) %\nset [ghost v] effect to (100)\nrepeat until <(round (size)) = [100]>\n    change size by (((100) - (size)) / (4))\n    change [ghost v] effect by (((0) - (size)) / (4))\nend\n\nwhen I receive [before start v]\nforever\n    if <touching (player v)?> then\n        set [ghost v] effect to (70)\n    else\n        set [ghost v] effect to (0)\n    end\nend\n\nwhen I receive [before start v]\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\nset size to (50) %\nset [ghost v] effect to (100)\nshow\ngo to [front v] layer\nrepeat until <(round (size)) = [100]>\n    change size by (((100) - (size)) / (4))\n    change [ghost v] effect by (((0) - (size)) / (10))\nend\n\n@Goo Particles\n\nwhen flag clicked\nhide\nwait (1) seconds\nwait until <([costume # v] of [cave hitbox v]) = [4]>\nrepeat until <not <([costume # v] of [cave hitbox v]) = [4]>>\n    Particle at (pick random (-60) to (60)) [-160]\n    wait (0.1) seconds\nend\nwait until <([costume # v] of [cave hitbox v]) = [6]>\nrepeat until <not <([costume # v] of [cave hitbox v]) = [6]>>\n    Particle at (pick random (-30) to (60)) [-160]\n    wait (0.1) seconds\nend\nwait until <([costume # v] of [cave hitbox v]) = [11]>\nrepeat until <not <([costume # v] of [cave hitbox v]) = [11]>>\n    Particle at (pick random (-50) to (80)) [60]\n    wait (0.05) seconds\nend\nwait until <([costume # v] of [cave hitbox v]) = [12]>\nrepeat until <not <([costume # v] of [cave hitbox v]) = [12]>>\n    Particle at (pick random (10) to (80)) [-160]\n    wait (0.1) seconds\nend\nwait until <([costume # v] of [cave hitbox v]) = [13]>\nrepeat until <not <([costume # v] of [cave hitbox v]) = [13]>>\n    Particle at (pick random (-40) to (0)) [-40]\n    wait (0.05) seconds\n    Particle at (pick random (-240) to (-220)) [90]\n    wait (0.05) seconds\nend\n\ndefine Particle at (x) (y)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nset size to (pick random (60) to (80)) %\ngo to [back v] layer\nset [brightness v] effect to (pick random (-40) to (0))\nshow\nrepeat (20)\n    change [ghost v] effect by (5)\n    if <key (p v) pressed?> then\n        delete this clone\n    end\nend\ndelete this clone\n\nwhen I receive [done v]\nrepeat (10)\n    delete this clone\nend\n\nwhen I start as a clone\nglide (pick random (0.6) to (1)) secs to x: ((x position) + (pick random (-15) to (15))) y: ((y position) + (80))\n\n@Background Particles\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\ngo to [back v] layer\nset [speed v] to (pick random (3) to (5))\nshow\nset size to (pick random (60) to (150)) %\nset [ghost v] effect to (pick random (70) to (90))\ngo to (random position v)\nset x to (260)\npoint in direction (pick random (-60) to (-105))\nrepeat until <<(x position) < [-239]> or <(y position) > [179]>>\n    move (speed) steps\n    turn right (pick random (-1) to (1.0)) degrees\nend\ndelete this clone\n\nwhen I receive [outside v]\nstop [other scripts in sprite v]\ndelete this clone\n\nwhen I receive [before start v]\nforever\n    create clone of (_myself_ v)\n    hide\nend\n\n@Skip Button\n\nwhen flag clicked\nhide\n\nwhen I receive [before start v]\nshow\nset size to (100) %\nset [zine v] to [0]\ngo to x: (-180) y: (-155)\nforever\n    change [zine v] by (1)\n    point in direction ((90) + (([sin v] of ((zine) * (8)) ) * (3)))\n    if <touching (mouse-pointer v)?> then\n        change size by (((110) - (size)) / (2))\n    else\n        change size by (((100) - (size)) / (4))\n    end\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        repeat until <<not <touching (mouse-pointer v)?>> or <not <mouse down?>>>\n            change [zine v] by (1)\n            point in direction ((90) + (([sin v] of ((zine) * (5)) ) * (3)))\n            change size by (((90) - (size)) / (2))\n        end\n        set size to (100) %\n        wait (0) seconds\n        if <<touching (mouse-pointer v)?> and <not <([costume # v] of [stages v]) = [20]>>> then\n            broadcast (done v)\n        end\n    end\n    if <([costume # v] of [cave hitbox v]) = [18]> then\n        go to x: (4598234759234) y: (32453245234)\n        hide\n        stop [this script v]\n    else\n        go to x: (-180) y: (-155)\n        show\n    end\nend\n\n@Intro\n\nwhen I start as a clone\nif <(introCloneID) = [2]> then\n    go to x: (0) y: (10)\n    switch costume to (name v)\n    set [ghost v] effect to (100)\n    set size to (100) %\n    go to [front v] layer\n    show\n    repeat (5)\n        change [ghost v] effect by (-20)\n    end\n    wait (0.5) seconds\n    repeat (10)\n        wait (0) seconds\n        change [ghost v] effect by (10)\n    end\nend\n\nwhen flag clicked\nwait until <mouse down?>\nwait until <not <mouse down?>>\nstop all sounds\nstart sound [Skip v]\nhide\nbroadcast (before start v)\nstop [other scripts in sprite v]\n\nwhen flag clicked\ngo to x: (-240) y: (0)\npoint in direction (-150)\nswitch costume to (icon v)\nset [ghost v] effect to (100)\ngo to [front v] layer\nset size to (30) %\nshow\nstart sound [IntroMusic v]\nset [introvel v] to [30]\nrepeat (15)\n    change x by (introVel)\n    turn right (introVel) degrees\n    change [ghost v] effect by ((introVel) * (-0.5))\n    change size by ((introVel) / (6))\n    change [introvel v] by (-2)\nend\nset [introcloneid v] to [1]\ncreate clone of (_myself_ v)\nset [introcloneid v] to [2]\ncreate clone of (_myself_ v)\nset [introbounce v] to [0]\nrepeat (15)\n    set [introbounce v] to (((introBounce) * (0.7)) + ((80) - (size)))\n    change size by (introBounce)\nend\nset size to (80) %\nwait (0.2) seconds\nset [introsine v] to [0]\nrepeat (15)\n    point in direction ((90) + (([tan v] of ((introSine) * (8)) ) * (10)))\nend\nset [introsizevel v] to [18]\nrepeat (9)\n    change [introsizevel v] by (-2)\n    change size by (introSizeVel)\n    turn left ((introSizeVel) * (4)) degrees\nend\nrepeat until <(x position) < [0]>\n    set x to (([tan v] of ((introSine) * (8)) ) * (20))\n    turn right (([tan v] of ((introSine) * (8)) ) * (20)) degrees\nend\nrepeat until <(x position) > [0]>\n    set x to (([tan v] of ((introSine) * (8)) ) * (20))\n    turn right (((90) - (direction)) / (3)) degrees\nend\nrepeat (9)\n    change [introsizevel v] by (-2)\n    change size by ((introSizeVel) * (0.8))\n    turn left ((introSizeVel) * (4)) degrees\nend\ngo to x: (0) y: (0)\npoint in direction (90)\nwait (0.5) seconds\nset [introcloneid v] to [3]\ncreate clone of (_myself_ v)\nwait (0.9) seconds\nhide\nwait (0.9) seconds\nbroadcast (before start v)\nstop [other scripts in sprite v]\n\nwhen I start as a clone\nif <(introCloneID) = [3]> then\n    set [introclonesizevel v] to [30]\n    go to x: (0) y: (0)\n    set size to (30) %\n    go to [front v] layer\n    show\n    repeat (30)\n        switch costume to (sizebypass v)\n        change size by (introCloneSizeVel)\n        switch costume to (disappeareffect v)\n        change [introclonesizevel v] by (-1)\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nif <(introCloneID) = [1]> then\n    set size to (100) %\n    go to [front v] layer\n    switch costume to (poof-1 v)\n    repeat (9)\n        wait (0.05) seconds\n        next costume\n    end\n    delete this clone\nend\n\nwhen flag clicked\nforever\n    change [introsine v] by (1)\nend\n\nwhen I start as a clone\nforever\n    if <mouse down?> then\n        wait until <not <mouse down?>>\n        delete this clone\n    end\nend\n\n@Thumb\n\nwhen flag clicked\nforever\n    go to x: (0) y: (0)\n    go to [front v] layer\n    set [ghost v] effect to (100)\n    show\nend\n\n
[Arrow Keys] or [WASD] - Move