(6th) The Cave -A Platformer

Instructions: Instructions:\nUse the arrow keys or WASD keys to move. Avoid spikes, lava & enemies. If you get stuck Press R. Press R to reset.\n\nNotes:\n-Hate comments will be REPORTED.\nThere will be a Part 2!! :)\n-Uh... that's it!\n\nCredits:\n-Most code and artwork is by me, @Sushi7777\n-Thank you to @--AwesomeCode-- for part of the player script! (Modified by me)\n-Thank you to @JTHEJET & StartfordJames for some artwork!\n-Music is called: Windfall \n\n\nTags:\n#all #games #art #sushi7777 #cave #platformer

@Stage\n\nwhen flag clicked\nforever\n    switch backdrop to (Level)\nend\n\nwhen flag clicked\nforever\n    set volume to (20) %\n    play sound [TheFatRat - Windfall v] until done\nend\n\n@Player\n\nwhen flag clicked\nhide variable [xv v]\nhide variable [yv v]\nhide variable [level v]\nset [level v] to [1]\nbroadcast (Reset v)\nforever\n    go to [front v] layer\n    if <not <<key (left arrow v) pressed?> or <key (right arrow v) pressed?>>> then\n        switch costume to (player v)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        switch costume to (player3 v)\n        change [xv v] by (-1.3)\n    end\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        switch costume to (player2 v)\n        change [xv v] by (1.3)\n    end\n    set [xv v] to ((XV) * (0.85))\n    change x by (XV)\n    if <touching (platform v)?> then\n        change y by (1)\n    end\n    if <touching (platform v)?> then\n        change y by (1)\n    end\n    if <touching (platform v)?> then\n        change y by (1)\n    end\n    if <touching (platform v)?> then\n        change y by (1)\n    end\n    if <touching (platform v)?> then\n        change y by (-4)\n        change x by ((XV) * (-1))\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            if <(XV) > [0]> then\n                set [xv v] to [-5]\n            else\n                set [xv v] to [5]\n            end\n            set [yv v] to [10]\n        else\n            set [xv v] to [0]\n        end\n    end\n    change [yv v] by (-1)\n    change y by (YV)\n    if <touching (platform v)?> then\n        change y by ((YV) - ((YV) * (2)))\n        set [yv v] to [0]\n    end\n    change y by (-1)\n    if <<touching (platform v)?> and <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n        set [yv v] to [15]\n    end\n    change y by (1)\n    if <(x position) > [239]> then\n        broadcast (Reset v) and wait\n        change [level v] by (1)\n    end\n    if <<touching (spikes v)?> or <<touching (lava v)?> or <<touching (enemy v)?> or <<touching (enemy2 v)?> or <touching (enemy3 v)?>>>>> then\n        broadcast (Reset v)\n        create clone of (_myself_ v)\n    end\nend\n\nwhen I start as a clone\nclear graphic effects\nrepeat (10)\n    change [ghost v] effect by (10)\n    change y by (4)\nend\ndelete this clone\n\nwhen I receive [reset v]\nset [xv v] to [0]\nset [yv v] to [0]\nif <not <(Level) = [21]>> then\n    go to x: (-216) y: (40)\nelse\n    if <(Level) = [21]> then\n        go to x: (-216) y: (-40)\n    end\nend\n\nwhen [r v] key pressed\nbroadcast (Reset v)\n\nbroadcast (Reset v) and wait\nchange [level v] by (1)\n\n@Platform\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    switch costume to (Level)\nend\n\n@Spikes\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    switch costume to (Level)\nend\n\n@Lava\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    switch costume to (Level)\nend\n\nwhen flag clicked\nforever\n    set y to (0)\n    repeat (10)\n        change y by (1)\n    end\n    repeat (20)\n        change y by (-1)\n    end\n    repeat (10)\n        change y by (1)\n    end\nend\n\n@Thumbnail\n\nwhen flag clicked\nshow\ngo to [front v] layer\ngo to x: (0) y: (-359)\nset [ghost v] effect to (100)\nforever\n    reset timer\nend\n\nwhen [timer v] > (0.000000000000001)\ngo to [front v] layer\ngo to x: (0) y: (-359)\nglide (0.2) secs to x: (0) y: (0)\n\n@Enemy\n\nwhen flag clicked\nbroadcast (Enemy v)\n\ndefine Glide X: (x) Y: (y) Speed (speed)\nrepeat until <<(round (x position)) = (round (x))> and <(round (y position)) = (round (y))>>\n    change x by (((x) - (x position)) / (speed))\n    change y by (((y) - (y position)) / (speed))\nend\n\nwhen flag clicked\nforever\n    if <<(Level) = [13]> or <<(Level) = [17]> or <<(Level) = [18]> or <(Level) = [19]>>>> then\n        show\n    else\n        hide\n    end\nend\n\nwhen I receive [enemy v]\nforever\n    if <(Level) = [13]> then\n        repeat until <not <(Level) = [13]>>\n            show\n            set size to (20) %\n            point in direction (-90)\n            go to x: (150) y: (-95)\n            Glide X: [-200] Y: [-95] Speed [10]\n            point in direction (90)\n            Glide X: [200] Y: [-95] Speed [10]\n        end\n    else\n        if <(Level) = [17]> then\n            repeat until <not <(Level) = [17]>>\n                show\n                set size to (30) %\n                point in direction (-90)\n                go to x: (150) y: (-95)\n                Glide X: [-200] Y: [-95] Speed [10]\n                point in direction (90)\n                Glide X: [200] Y: [-95] Speed [10]\n            end\n        else\n            if <(Level) = [18]> then\n                repeat until <not <(Level) = [18]>>\n                    show\n                    set size to (30) %\n                    point in direction (-90)\n                    go to x: (150) y: (-95)\n                    Glide X: [-200] Y: [-95] Speed [10]\n                    point in direction (90)\n                    Glide X: [200] Y: [-95] Speed [10]\n                end\n            else\n                if <(Level) = [19]> then\n                    repeat until <not <(Level) = [19]>>\n                        show\n                        set size to (30) %\n                        point in direction (-90)\n                        go to x: (150) y: (-95)\n                        Glide X: [-200] Y: [-95] Speed [7]\n                        point in direction (90)\n                        Glide X: [200] Y: [-95] Speed [7]\n                    end\n                else\n                    hide\n                end\n            end\n        end\n    end\nend\n\n@Enemy2\n\nwhen flag clicked\nforever\n    if <(Level) = [18]> then\n        repeat until <not <(Level) = [18]>>\n            show\n            set size to (30) %\n            point in direction (90)\n            go to x: (-150) y: (-95)\n            Glide X: [200] Y: [-95] Speed [10]\n            point in direction (-90)\n            Glide X: [-200] Y: [-95] Speed [10]\n        end\n    else\n        if <(Level) = [19]> then\n            repeat until <not <(Level) = [19]>>\n                show\n                set size to (30) %\n                point in direction (-95)\n                go to x: (-150) y: (-95)\n                Glide X: [-200] Y: [-95] Speed [7]\n                point in direction (90)\n                Glide X: [200] Y: [-95] Speed [7]\n            end\n        else\n            hide\n        end\n    end\nend\n\ndefine Glide X: (x) Y: (y) Speed (speed)\nrepeat until <<(round (x position)) = (round (x))> and <(round (y position)) = (round (y))>>\n    change x by (((x) - (x position)) / (speed))\n    change y by (((y) - (y position)) / (speed))\nend\n\nwhen flag clicked\nforever\n    if <<(Level) = [18]> or <(Level) = [19]>> then\n        show\n    else\n        hide\n    end\nend\n\n@Enemy3\n\nwhen flag clicked\nforever\n    if <(Level) = [19]> then\n        show\n        set size to (30) %\n        point in direction (-90)\n        go to x: (-75) y: (-95)\n        Glide X: [-200] Y: [-95] Speed [30]\n        point in direction (90)\n        Glide X: [200] Y: [-95] Speed [15]\n    else\n        hide\n    end\nend\n\ndefine Glide X: (x) Y: (y) Speed (speed)\nrepeat until <<(round (x position)) = (round (x))> and <(round (y position)) = (round (y))>>\n    change x by (((x) - (x position)) / (speed))\n    change y by (((y) - (y position)) / (speed))\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [19]> then\n        show\n    else\n        hide\n    end\nend\n\n@Light\n\nwhen flag clicked\nhide\nwait until <(Level) = [4]>\nshow\nclear graphic effects\nset size to (120) %\nforever\n    if <not <(Level) = [25]>> then\n        show\n        go to (player v)\n        go to [back v] layer\n        set [ghost v] effect to (3)\n        change [color v] effect by (0.0001)\n    else\n        hide\n    end\nend\n\nwhen flag clicked\nforever\n    repeat (10)\n        change size by (4)\n    end\n    wait (0.1) seconds\n    repeat (10)\n        change size by (-4)\n    end\nend\n\n@Clouds\n\nwhen flag clicked\nforever\n    if <<(Level) = [1]> or <<(Level) = [2]> or <<(Level) = [3]> or <(Level) = [25]>>>> then\n        show\n        set [ghost v] effect to (40)\n        go to x: (-300) y: (140)\n        glide (4) secs to x: (300) y: (140)\n    else\n        hide\n    end\nend\n\n