Cave Platformer 2
@Stage\n\n@Background\n\nwhen flag clicked\nshow\nswitch costume to (blank v)\nset size to (105) %\nswitch costume to (scrolling2 v)\ngo to x: (140) y: (0)\nrepeat (12)\n    go to x: (140) y: (0)\n    repeat (13)\n        change x by (-10)\n    end\nend\nhide\n\n@Circles\n\nwhen flag clicked\nhide\nset size to (100) %\ngo to x: (0) y: (0)\nswitch costume to (1 v)\nwait (1.5) seconds\nrepeat (6)\n    create clone of (_myself_ v)\n    wait (0.5) seconds\n    next costume\nend\n\nwhen I start as a clone\nshow\nset [ghost v] effect to (0)\nrepeat (100)\n    change size by (10)\n    change [ghost v] effect by (2)\nend\n\n@Emblem\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset size to (100) %\npoint in direction (75)\nshow\nset [counter v] to [3]\nrepeat (15)\n    turn right (1) degrees\n    change size by (Counter)\n    change [counter v] by (-1)\nend\nset [counter v] to [1]\nrepeat (12)\n    change [counter v] by (2)\n    turn right (2) degrees\n    change size by (Counter)\nend\nwait (0.3) seconds\nset [counter v] to [1]\nrepeat (15)\n    turn right (-3) degrees\n    change [counter v] by (-2)\n    change size by (Counter)\nend\nhide\n\n@Cover\n\nwhen flag clicked\nswitch costume to (1 v)\nset [brightness v] effect to (0)\ngo to x: (0) y: (366)\ngo to [front v] layer\nhide\nwait (5) seconds\ngo to [front v] layer\nshow\nrepeat (30)\n    Smooth Glide to (-40)\nend\nwait (0.5) seconds\nnext costume\nbroadcast (Game v)\nrepeat (30)\n    Smooth Glide to (590)\nend\nhide\n\nwhen flag clicked\nset volume to (30) %\nwait (5.4) seconds\nrepeat (20)\n    change volume by (-5)\nend\nstop all sounds\nrepeat (20)\n    change volume by (5)\nend\n\nwhen flag clicked\nplay sound [Intro Song v] until done\nforever\n    play sound [Main Theme v] until done\nend\n\ndefine None\nchange y by (((y) - (y position)) / (8))\n\nwhen I receive [cover v]\nswitch costume to (1 v)\ngo to x: (0) y: (366)\ngo to [front v] layer\nshow\nrepeat (30)\n    Smooth Glide to (-10)\nend\nwait (0.2) seconds\nnext costume\nrepeat (30)\n    Smooth Glide to (660)\nend\nhide\n\nwhen flag clicked\nforever\n    go to [front v] layer\nend\n\n@Title Page\n\nwhen flag clicked\nset [game v] to [0]\nhide\ngo to x: (0) y: (0)\nswitch costume to (cave v)\ncreate clone of (_myself_ v)\ngo to [front v] layer\nswitch costume to (cave2 v)\ncreate clone of (_myself_ v)\nswitch costume to (cave4 v)\ncreate clone of (_myself_ v)\ngo to [front v] layer\nswitch costume to (title v)\ngo to [front v] layer\nset [counter v] to [0]\nforever\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        create clone of (_myself_ v)\n        wait until <not <mouse down?>>\n        wait (0.5) seconds\n    end\nend\n\nwhen I start as a clone\nif <(costume [number v]) = [5]> then\n    forever\n        repeat (20)\n            change y by (-0.2)\n            switch costume to (cave4 v)\n            go [backward v] (1) layers\n        end\n        repeat (20)\n            change y by (0.2)\n            switch costume to (cave4 v)\n            go [backward v] (1) layers\n        end\n    end\nend\nif <(costume [number v]) = [1]> then\n    set [counter v] to [8]\n    repeat (20)\n        change [ghost v] effect by (6)\n        change y by (Counter)\n        change [counter v] by (-1)\n        change size by (-4)\n    end\n    delete this clone\nend\n\nwhen I receive [game v]\nshow\n\nwhen I receive [start v]\nwait (1) seconds\nif <(costume [number v]) = [1]> then\n    switch costume to (cave3 v)\n    repeat until <(Level) = [13]>\n        go [backward v] (25) layers\n    end\n    switch costume to (cave5 v)\nelse\n    hide\n    delete this clone\nend\n\nwait until \n\n@Button\n\nwhen flag clicked\ngo to x: (0) y: (-50)\nhide\nrepeat (10)\n    go to [front v] layer\nend\n\ndefine size_change (size)\nchange size by (((size) - (size)) / (4))\n\nwhen I receive [game v]\nshow\nset size to (100) %\nwait (1) seconds\nforever\n    if <touching (mouse-pointer v)?> then\n        if <not <(size) = [120]>> then\n            size_change (120)\n        end\n        if <mouse down?> then\n            change [game v] by (1)\n            broadcast (start v)\n            broadcast (cover v)\n            repeat until <(size) = [10]>\n                size_change (10)\n            end\n            hide\n            stop [other scripts in sprite v]\n            stop [this script v]\n        end\n    else\n        if <not <(size) = [100]>> then\n            size_change (100)\n        end\n    end\nend\n\nwhen I start as a clone\nchange [ghost v] effect by (50)\nset size to (120) %\nrepeat (10)\n    size_change (180)\n    change [ghost v] effect by (5)\nend\n\nwhen I receive [game v]\nforever\n    if <touching (mouse-pointer v)?> then\n        create clone of (_myself_ v)\n        wait (1) seconds\n    end\nend\n\n@You\n\nwhen flag clicked\nset [level v] to [1]\nhide\n\nwhen I receive [start v]\ngo to [front v] layer\nwait (1) seconds\ngo to x: (item (((Level) * (2)) - (1)) of [spawnpoints v]) y: (item ((Level) * (2)) of [spawnpoints v])\nshow\nset [y v] to [0]\nset [x v] to [0]\nset [hurt v] to [0]\nset size to (130) %\npoint in direction (90)\nset [fails v] to [0]\nforever\n    if <touching (boss v)?> then\n        if <(Hurt) = [1]> then\n            change [lives v] by (-1)\n            repeat (20)\n                Glide (item (((Level) * (2)) - (1)) of [spawnpoints v]) (item ((Level) * (2)) of [spawnpoints v])\n            end\n            set [x v] to [0]\n            set [y v] to [0]\n        else\n            change [fails v] by (1)\n            set [counter v] to [8]\n            repeat (30)\n                change [counter v] by (-1)\n                change y by (Counter)\n                change size by (-5)\n                change [ghost v] effect by (5)\n            end\n            go to x: (item (((Level) * (2)) - (1)) of [spawnpoints v]) y: (item ((Level) * (2)) of [spawnpoints v])\n            point in direction (90)\n            set size to (130) %\n            set [ghost v] effect to (0)\n            set [x v] to [0]\n            set [y v] to [0]\n        end\n    end\n    if <<touching (lava v)?> or <<<(x) = [0]> and <(y) = [0]>> and <touching (level safe v)?>>> then\n        change [fails v] by (1)\n        set [counter v] to [10]\n        repeat (30)\n            if <(x) > [0.1]> then\n                move (2) steps\n                turn right (3) degrees\n            else\n                if <(x) < [-0.1]> then\n                    move (-2) steps\n                    turn right (-3) degrees\n                else\n                    move (0) steps\n                end\n            end\n            change [counter v] by (-1)\n            change y by (Counter)\n            change size by (-5)\n            change [ghost v] effect by (5)\n        end\n        go to x: (item (((Level) * (2)) - (1)) of [spawnpoints v]) y: (item ((Level) * (2)) of [spawnpoints v])\n        point in direction (90)\n        set size to (130) %\n        set [ghost v] effect to (0)\n        set [x v] to [0]\n        set [y v] to [0]\n    end\n    if <<<<touching (still lazers v)?> or <touching (flashing lazers v)?>> or <touching (moving dangers v)?>> or <touching (bullets v)?>> then\n        change [fails v] by (1)\n        set [counter v] to [8]\n        repeat (30)\n            change [counter v] by (-1)\n            change y by (Counter)\n            change size by (-5)\n            change [ghost v] effect by (5)\n        end\n        go to x: (item (((Level) * (2)) - (1)) of [spawnpoints v]) y: (item ((Level) * (2)) of [spawnpoints v])\n        point in direction (90)\n        set size to (130) %\n        set [ghost v] effect to (0)\n        set [x v] to [0]\n        set [y v] to [0]\n    end\n    if <(x position) > [235]> then\n        broadcast (Cover v)\n        wait (1) seconds\n        if <(Level) = [11]> then\n            change [level v] by (1)\n            broadcast (Boss v)\n        else\n            change [level v] by (1)\n        end\n        go to x: (item (((Level) * (2)) - (1)) of [spawnpoints v]) y: (item ((Level) * (2)) of [spawnpoints v])\n        point in direction (90)\n        set size to (130) %\n        set [ghost v] effect to (0)\n        set [x v] to [0]\n        set [y v] to [0]\n    end\n    change [y v] by (-0.5)\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        change [x v] by (1)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change [x v] by (-1)\n    end\n    set [x v] to ((x) * (0.85))\n    change x by (x)\n    if <touching (level safe v)?> then\n        change y by (1)\n        if <touching (level safe v)?> then\n            change y by (1)\n            if <touching (level safe v)?> then\n                change y by (1)\n                if <touching (level safe v)?> then\n                    change y by (1)\n                    if <touching (level safe v)?> then\n                        change y by (1)\n                        if <touching (level safe v)?> then\n                            change y by (1)\n                            if <touching (level safe v)?> then\n                                change y by (-6)\n                                if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n                                    set [y v] to [10]\n                                    if <(x) > [0]> then\n                                        set [x v] to [-10]\n                                    else\n                                        set [x v] to [10]\n                                    end\n                                else\n                                    change x by ((x) * (-1))\n                                    set [x v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (y)\n    if <touching (level safe v)?> then\n        change y by ((y) * (-1))\n        set [y v] to [0]\n    end\n    change y by (-0.5)\n    if <<touching (level safe v)?> and <<key (w v) pressed?> or <key (up arrow v) pressed?>>> then\n        set [y v] to [8.5]\n    end\n    change y by (0.5)\n    if <(Level) = [13]> then\n        go to x: (-199) y: (-74)\n        stop [this script v]\n    end\nend\n\ndefine None\nchange x by (((x) - (x position)) / (4))\nchange y by (((y) - (y position)) / (4))\n\n@Level Safe\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\nhide\n\nwhen I receive [start v]\nwait (1) seconds\nshow\nforever\n    Front-1\n    switch costume to (Level)\nend\n\ndefine Front-1\ngo to [front v] layer\ngo [backward v] (2) layers\n\n@Lava\n\nwhen I receive [start v]\nwait (1) seconds\nshow\nforever\n    repeat (20)\n        change y by (-0.2)\n        switch costume to (Level)\n    end\n    repeat (20)\n        change y by (0.2)\n        switch costume to (Level)\n    end\nend\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\nhide\n\n@Still Lazers\n\nwhen I receive [start v]\nwait (1) seconds\nshow\nforever\n    Front-1\n    switch costume to (Level)\nend\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\nhide\n\ndefine Front-1\ngo to [front v] layer\ngo [backward v] (11) layers\n\n@Thumbnail\n\nwhen flag clicked\nhide\n\nwhen [t v] key pressed\nset [counter v] to [1]\nif <(username) = [CrystalKeeper7]> then\n    wait until <key (h v) pressed?>\n    wait until <key (u v) pressed?>\n    wait until <key (m v) pressed?>\n    wait until <key (b v) pressed?>\n    wait until <key (n v) pressed?>\n    wait until <key (a v) pressed?>\n    wait until <key (i v) pressed?>\n    wait until <key (l v) pressed?>\n    broadcast (thumb v)\nend\n\nwhen I receive [thumb v]\ngo to x: (0) y: (0)\ngo to [front v] layer\nshow\nstop [all v]\n\n@Particle Effects\n\ndefine None\nset y to (y)\nswitch costume to (pick random (1) to (3))\nset x to (pick random (x) to (x2))\nset size to (pick random (60) to (80)) %\nhide\ncreate clone of (_myself_ v)\n\nwhen I receive [game v]\nset size to (50) %\nrepeat until <(Game) = [1]>\n    Fumes (-240) to (240) With Y: (-115)\n    Fumes (-240) to (240) With Y: (-115)\n    Fumes (-240) to (240) With Y: (-115)\n    Fumes (-240) to (240) With Y: (-115)\nend\nwait (0.5) seconds\nforever\n    if <(Level) = [1]> then\n        Fumes (-116) to (68) With Y: (-64)\n    else\n        if <(Level) = [2]> then\n            Fumes (-50) to (100) With Y: (-90)\n            Fumes (140) to (230) With Y: (-55)\n        else\n            if <(Level) = [3]> then\n                Fumes (-100) to (124) With Y: (-98)\n            else\n                if <(Level) = [4]> then\n                    Fumes (-100) to (124) With Y: (-104)\n                else\n                    if <(Level) = [5]> then\n                        Fumes (-125) to (117) With Y: (-104)\n                    else\n                        if <(Level) = [6]> then\n                            Fumes (-151) to (-23) With Y: (43)\n                        else\n                            if <(Level) = [7]> then\n                                Fumes (-87) to (198) With Y: (-123)\n                                Fumes (-87) to (198) With Y: (-123)\n                            else\n                                if <(Level) = [8]> then\n                                    Fumes (-200) to (-61) With Y: (75)\n                                    Fumes (-17) to (119) With Y: (45)\n                                    Fumes (-240) to (-113) With Y: (-123)\n                                else\n                                    if <(Level) = [9]> then\n                                        Fumes (-151) to (-87) With Y: (-129)\n                                        Fumes (-9) to (70) With Y: (-129)\n                                        Fumes (100) to (193) With Y: (-139)\n                                    else\n                                        if <(Level) = [10]> then\n                                            Fumes (-132) to (152) With Y: (-117)\n                                            Fumes (-132) to (152) With Y: (-117)\n                                        else\n                                            if <(Level) = [11]> then\n                                                Fumes (-185) to (-105) With Y: (-58)\n                                                Fumes (-60) to (0) With Y: (-79)\n                                                Fumes (107) to (178) With Y: (-132)\n                                            else\n                                                if <(Level) = [12]> then\n                                                    Fumes (-96) to (114) With Y: (-100)\n                                                    Fumes (-96) to (114) With Y: (-100)\n                                                else\n                                                    Fumes (-74) to (203) With Y: (-74)\n                                                    Fumes (-74) to (203) With Y: (-74)\n                                                end\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I start as a clone\ngo [backward v] (5000) layers\nshow\nrepeat (20)\n    change [ghost v] effect by (5)\n    change y by (1)\n    change size by (-3)\nend\ndelete this clone\n\nwhen flag clicked\nhide\n\n@LevelNumbers\n\nwhen flag clicked\nhide\n\nwhen I receive [back to menu v]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [start v]\nswitch costume to (10 v)\ngo to x: (-180) y: (163)\nshow\ncreate clone of (_myself_ v)\nchange x by (12)\nrepeat until <(Level) = [13]>\n    if <(letter (2) of (Level)) = []> then\n        hide\n    else\n        show\n    end\n    switch costume to ((letter (2) of (Level)) + (1))\nend\ngo to x: (105) y: (89)\nif <(Fails) > [99]> then\n    set [fails v] to [99]\nend\nset [fails v] to ((100) - (Fails))\nset [counter2 v] to [1]\nhide\nrepeat (length of (Fails))\n    switch costume to ((letter (Counter2) of (Fails)) + (1))\n    change [counter2 v] by (1)\n    stamp\n    change x by (12)\nend\n\nwhen I start as a clone\nrepeat until <(Level) = [13]>\n    if <(letter (1) of (Level)) = []> then\n        hide\n    else\n        show\n    end\n    switch costume to ((letter (1) of (Level)) + (1))\nend\ndelete this clone\n\n@Moving Dangers\n\nwhen I receive [start v]\nwait (1) seconds\nset size to (100) %\nforever\n    Front-1\n    if <(Level) = [3]> then\n        show\n        switch costume to (first v)\n        go to x: (-20) y: (50)\n        turn right (3) degrees\n    else\n        if <(Level) = [6]> then\n            show\n            switch costume to (first v)\n            go to x: (-90) y: (10)\n            turn right (3) degrees\n        else\n            if <(Level) = [8]> then\n                show\n                switch costume to (lazers4 v)\n                point in direction (90)\n                go to x: (0) y: (13)\n                repeat (30)\n                    change y by (-2)\n                    Front-1\n                    if <(Level) = [9]> then\n                        hide\n                    end\n                end\n                repeat (30)\n                    change y by (2)\n                    Front-1\n                    if <(Level) = [9]> then\n                        hide\n                    end\n                end\n            else\n                if <(Level) = [11]> then\n                    show\n                    switch costume to (first v)\n                    go to x: (240) y: (-60)\n                    turn right (2) degrees\n                else\n                    hide\n                    go to x: (0) y: (0)\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nhide\n\ndefine Front-1\ngo to [front v] layer\ngo [backward v] (18) layers\n\n@Buttons\n\nwhen flag clicked\nhide\n\n@Flashing Lazers\n\nwhen I receive [start v]\nwait (1) seconds\nreset timer\nforever\n    if <(Level) < [6]> then\n        hide\n    else\n        if <(Level) = [6]> then\n            switch costume to (6 v)\n            go to x: (0) y: (0)\n            if <((round (timer)) mod (4)) < [2]> then\n                show\n            else\n                hide\n            end\n        else\n            if <(Level) = [7]> then\n                show\n                go to x: (0) y: (0)\n                if <((round (timer)) mod (4)) < [2]> then\n                    switch costume to (7 v)\n                else\n                    switch costume to (8 v)\n                end\n            else\n                if <(Level) = [8]> then\n                    show\n                    go to x: (0) y: (0)\n                    if <((round (timer)) mod (4)) < [2]> then\n                        switch costume to (2 v)\n                    else\n                        switch costume to (3 v)\n                    end\n                else\n                    if <(Level) = [9]> then\n                        show\n                        go to x: (0) y: (0)\n                        if <((round (timer)) mod (4)) < [2]> then\n                            switch costume to (4 v)\n                        else\n                            switch costume to (5 v)\n                        end\n                    else\n                        if <(Level) = [10]> then\n                            show\n                            go to x: (0) y: (0)\n                            if <((round (timer)) mod (4)) < [2]> then\n                                switch costume to (9 v)\n                            else\n                                switch costume to (10 v)\n                            end\n                        else\n                            if <(Level) = [11]> then\n                                show\n                                go to x: (0) y: (0)\n                                if <((round (timer)) mod (4)) < [2]> then\n                                    switch costume to (11 v)\n                                else\n                                    switch costume to (12 v)\n                                end\n                            else\n                                hide\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nhide\n\n@Boss\n\nwhen I start as a clone\nset [brightness v] effect to (0)\nswitch costume to (lazer v)\npoint towards (you v)\nrepeat (5)\n    move (10) steps\nend\nrepeat until <touching (_edge_ v)?>\n    move (10) steps\nend\nmove (10) steps\ndelete this clone\n\nwhen I receive [boss v]\nset [ghost v] effect to (0)\ngo to x: (147) y: (-32)\nshow\nwait (2) seconds\nset [lives v] to [4]\nrepeat until <(Lives) = [0]>\n    switch costume to (cave2 v)\n    show\n    set [brightness v] effect to (0)\n    set [hurt v] to [0]\n    repeat ((7) - (Lives))\n        if <(pick random (1) to (3)) = [1]> then\n            repeat (5)\n                wait (0.2) seconds\n                create clone of (bullets v)\n            end\n        else\n            repeat (5)\n                wait (0.3) seconds\n                repeat (20)\n                    change [brightness v] effect by (1)\n                end\n                create clone of (bullets v)\n                repeat (5)\n                    change [brightness v] effect by (-4)\n                end\n            end\n        end\n    end\n    change [hurt v] by (1)\n    set [brightness v] effect to (-10)\n    wait (4) seconds\nend\n\nwhen flag clicked\nset size to (100) %\nhide\nset [lives v] to [4]\nwait until <(Lives) = [0]>\nstop [other scripts in sprite v]\nset [counter v] to [8]\nrepeat (30)\n    change [counter v] by (-1)\n    change y by (Counter)\n    change size by (-5)\n    change [ghost v] effect by (5)\nend\nbroadcast (cover v)\nwait (1) seconds\nchange [level v] by (1)\n\n@Bullets\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\ngo [backward v] (15) layers\nshow\nset [brightness v] effect to (0)\nswitch costume to (lazer v)\ngo to (boss v)\npoint towards (you v)\nrepeat (5)\n    move ((14) - (Lives)) steps\nend\nrepeat until <touching (_edge_ v)?>\n    move ((14) - (Lives)) steps\nend\nmove ((14) - (Lives)) steps\ndelete this clone\n\n