The Cave || Scrolling Platformer || Mobile Friendly
@Stage\n\nwhen I receive [end intro v]\nbroadcast (Play v)\nforever\n    play sound [trap king v] until done\nend\n\n@Nothing...\n\nwhen [s v] key pressed\nchange [level v] by (1)\nset [x v] to [1000]\nset [y v] to [-300]\nset [xv v] to [0]\nset [yv v] to [0]\nset [camx v] to [1000]\nset [camy v] to [-300]\nbroadcast (Transition v) and wait\n\n@Decor\n\nwhen I receive [message1 v]\ngo to x: (((Clone id) * (1440)) - (camx)) y: (() - (camy))\nswitch costume to (join (Level) (join [ ] (Clone id)))\n\nchange [camx v] by (10)\n\nwhen flag clicked\nhide\nswitch costume to (costume1 v)\nset size to (300) %\nset [clone id v] to [1]\ncreate clone of (_myself_ v)\nset [clone id v] to [2]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\ngo to [front v] layer\n\nset [x v] to [0]\n\n@Ground\n\nwhen I receive [message1 v]\ngo to x: (((Clone id) * (1440)) - (camx)) y: (() - (camy))\nswitch costume to (join (Level) (join [ ] (Clone id)))\n\nwhen flag clicked\nhide\nswitch costume to (costume1 v)\nset size to (300) %\nset [clone id v] to [1]\ncreate clone of (_myself_ v)\nset [clone id v] to [2]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\nset [ghost v] effect to (100)\n\n@Danger\n\nwhen I receive [message1 v]\ngo to x: (((Clone id) * (1440)) - (camx)) y: (() - (camy))\nswitch costume to (join (Level) (join [ ] (Clone id)))\n\nwhen flag clicked\nhide\nswitch costume to (costume1 v)\nset size to (300) %\nset [clone id v] to [1]\ncreate clone of (_myself_ v)\nset [clone id v] to [2]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\nset [ghost v] effect to (100)\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) * (3)) ) * (2))\n    go to [back v] layer\nend\n\nwhen I receive [play 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@Sprite1\n\nwhen flag clicked\ngo to [back v] layer\ncreate clone of (_myself_ v)\nforever\n    turn right (3) degrees\n    Position\nend\n\nwhen I start as a clone\nforever\n    turn right (-2) degrees\n    Position\nend\n\ndefine Position\nswitch costume to (costume2 v)\nif <(Level) = [1]> then\n    go to x: ((3300) - (camx)) y: ((-100) - (camy))\nend\nif <(Level) = [2]> then\n    go to x: ((3300) - (camx)) y: ((-100) - (camy))\nend\nif <(Level) = [3]> then\n    go to x: ((3300) - (camx)) y: ((100) - (camy))\nend\nswitch costume to (costume1 v)\nset size to (75) %\n\n@Goal light\n\nwhen flag clicked\nswitch costume to (costume2 v)\nshow\nset [size v] to [90]\nforever\n    change [size v] by (5)\n    go to (sprite1 v)\n    set size to ((110) + (([cos v] of (size) ) * (20))) %\nend\n\n@Player\n\nwhen I start as a clone\nswitch costume to (costume2 v)\ngo [forward v] (1) layers\nforever\n    go to x: ([x position v] of [player v]) y: ([y position v] of [player v])\n    set size to ([size v] of [player v]) %\n    change x by (xv)\n    point in direction ([direction v] of [player v])\nend\n\nset [xv v] to [0]\n\nwhen I receive [play v]\nshow\ncreate clone of (_myself_ v)\nswitch costume to (costume1 v)\nset [level v] to [1]\nset [x v] to [1000]\nset [y v] to [-300]\nset [yv v] to [0]\nset [xv v] to [0]\nforever\n    go to x: ((x) - (camx)) y: ((y) - (camy))\n    if <(wall) < [0]> then\n        if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < [-50]>>> then\n            change [xv v] by (-2)\n        end\n        if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <[50] < (mouse x)>>> then\n            change [xv v] by (2)\n        end\n    end\n    change x by (xv)\n    change [x v] by (xv)\n    if <touching (ground v)?> then\n        change y by (1)\n        change [y v] by (1)\n        if <touching (ground v)?> then\n            change y by (1)\n            change [y v] by (1)\n            if <touching (ground v)?> then\n                change y by (1)\n                change [y v] by (1)\n                if <touching (ground v)?> then\n                    change y by (1)\n                    change [y v] by (1)\n                    if <touching (ground v)?> then\n                        change y by (1)\n                        change [y v] by (1)\n                        if <touching (ground v)?> then\n                            change y by (-5)\n                            change [y v] by (-5)\n                            change x by (() - (xv))\n                            change [x v] by (() - (xv))\n                            if <not <(xv) = [0]>> then\n                                if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <[50] < (mouse y)>>> then\n                                    set [yv v] to [13]\n                                    if <(xv) > [0]> then\n                                        set [xv v] to [-15]\n                                    else\n                                        set [xv v] to [15]\n                                    end\n                                    set [wall v] to [15]\n                                else\n                                    set [xv v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (yv)\n    change [y v] by (yv)\n    if <touching (ground v)?> then\n        change y by (() - (yv))\n        change [y v] by (() - (yv))\n        set [yv v] to [0]\n    end\n    change [yv v] by (-0.5)\n    if <key (down arrow v) pressed?> then\n        change [yv v] by (-1)\n    end\n    change y by (-5)\n    if <touching (ground v)?> then\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <[50] < (mouse y)>>> then\n            set [yv v] to [13]\n        end\n    end\n    change y by (5)\n    if <(wall) < [0]> then\n        set [xv v] to ((xv) * (0.8))\n    else\n        set [xv v] to ((xv) * (0.95))\n    end\n    change [wall v] by (-1)\n    change [camx v] by (((x) - (camx)) / (5))\n    change [camy v] by (((y) - (camy)) / (5))\n    if <touching (danger v)?> then\n        set [x v] to [1000]\n        set [y v] to [-300]\n        set [yv v] to [0]\n        set [xv v] to [0]\n    end\n    if <touching (sprite1 v)?> then\n        set [camx v] to [1000]\n        set [camy v] to [-300]\n        set [x v] to [1000]\n        set [y v] to [-300]\n        set [yv v] to [0]\n        set [xv v] to [0]\n        change [level v] by (1)\n    end\n    broadcast (message1 v)\nend\n\nwhen flag clicked\nhide\n\n@Particoiles\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\npoint in direction (pick random (1) to (360))\nset [color v] effect to (pick random (1) to (200))\nrepeat (20)\n    move (5) steps\n    change [ghost v] effect by (5)\nend\ndelete this clone\n\nwhen I receive [play v]\nshow\nclear graphic effects\nforever\n    go to (player v)\n    create clone of (_myself_ v)\nend\n\n@Intro\n\nwhen I start as a clone\nshow\nif <(costume [number v]) = [1]> then\n    go to x: (-100) y: (-100)\n    repeat (150)\n        change y by (2.5)\n        change x by (3)\n    end\nend\nif <(costume [number v]) = [2]> then\n    go to x: (0) y: (0)\n    go to [back v] layer\n    set size to (100) %\n    repeat (100)\n        change size by (0.5)\n    end\nend\nif <(costume [number v]) = [3]> then\n    go to x: (0) y: (0)\n    go to [front v] layer\n    set size to (100) %\n    repeat (100)\n        change size by (0.5)\n    end\nend\n\nwhen I receive [start intro v]\nclear graphic effects\nclear sound effects\nstart sound [Appear-KP-1137861048 v]\nset volume to (100) %\nset [pan left/right v] effect to (70)\nhide\nswitch costume to (costume1 v)\ncreate clone of (_myself_ v)\nswitch costume to (untitled \(3\) v)\ncreate clone of (_myself_ v)\nswitch costume to (costume2 v)\ncreate clone of (_myself_ v)\nrepeat (35)\n    change [pan left/right v] effect by (-1)\nend\nwait (3) seconds\nbroadcast (End intro v)\n\nwhen I receive [end intro v]\nrepeat (20)\n    change [ghost v] effect by (5)\n    change volume by (-5)\nend\ndelete this clone\n\nwhen flag clicked\nif <(Intro?) = [0]> then\n    broadcast (Start intro v)\n    set [intro? v] to [1]\nelse\n    broadcast (End intro v)\nend\n\nif  then\nend\n\n@Sprite2\n\n@Thumb\n\nwhen flag clicked\nset [ghost v] effect to (100)\nset [level v] to [1]\nforever\n    go to [front v] layer\n    if <(Level) = [4]> then\n        repeat (10)\n            change [ghost v] effect by (-10)\n        end\n        stop [all v]\n    end\nend\n\n