Cave- A Platformer

Instructions: ~~~~~~~~~~~Cave- a Platformer~~~~~~~~~~~~~~~~\nPass ten levels to escape and get home!\n\nDouble click the green flag just in case.\n\nHow to play:\n-Press w or up arrow key to jump\n-Press a or left arrow key to move left\n-Press d or right arrow key to move right\n-Press r to restart the level\n-Press on the Skip button in the bottom left corner to skip a level\n-For level 6, look closely at the ground if you don't know how to pass it. You will spot a different shade of grey. I know it's hard to see.\n\nEnjoy and have fun!\n\nI might make another platformer if this project gets more than 40 views!

@Stage\n\nwhen flag clicked\nswitch backdrop to (cave v) and wait\nforever\n    play sound [Tobu & Itro - Sunburst v] until done\nend\n\nwhen I receive [change background v]\nswitch backdrop to (sky v)\n\n@Player\n\nwhen flag clicked\nshow\nset [x velocity v] to [0]\nset [y velocity v] to [0]\ngo to x: (-214) y: (10)\nforever\n    create clone of (_myself_ v)\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        change [x velocity v] by (1)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change [x velocity v] by (-1)\n    end\n    set [x velocity v] to ((X Velocity) * (.9))\n    change x by (X Velocity)\n    if <touching (level v)?> then\n        change y by (1)\n        if <touching (level v)?> then\n            change y by (1)\n            if <touching (level v)?> then\n                change y by (1)\n                if <touching (level v)?> then\n                    change y by (1)\n                    if <touching (level v)?> then\n                        change y by (1)\n                        if <touching (level v)?> then\n                            change x by ((X Velocity) * (-1))\n                            change y by (-5)\n                            if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                                if <(X Velocity) > [0]> then\n                                    set [x velocity v] to [-5]\n                                else\n                                    set [x velocity v] to [5]\n                                end\n                                set [y velocity v] to [10]\n                            else\n                                set [x velocity v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [y velocity v] by (-1)\n    change y by (Y Velocity)\n    if <touching (level v)?> then\n        change y by ((Y Velocity) * (-1))\n        set [y velocity v] to [0]\n    end\n    change y by (-1)\n    if <touching (level v)?> then\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            change [y velocity v] by (15)\n        end\n    end\n    change y by (1)\n    if <(x position) > [230]> then\n        change [level v] by (1)\n        set [y velocity v] to [0]\n        set [x velocity v] to [0]\n        go to x: (-214) y: (10)\n    end\n    if <<touching (spikes v)?> or <<touching (spikes 2 v)?> or <<touching (spikes 3 v)?> or <<touching (spikes 4 v)?> or <touching (spikes 5 v)?>>>>> then\n        repeat (15)\n            change [ghost v] effect by (5)\n            change size by (.3)\n            change [pixelate v] effect by (20)\n        end\n        clear graphic effects\n        set size to (100) %\n        go to x: (-214) y: (10)\n    end\n    if <<touching (trampoline v)?> or <<touching (trampoline 2 v)?> or <touching (trampoline 3 v)?>>> then\n        set [y velocity v] to [20]\n    end\n    if <key (r v) pressed?> then\n        go to x: (-214) y: (10)\n    end\n    if <touching (gap v)?> then\n        go to x: (-214) y: (10)\n    end\nend\n\nwhen I start as a clone\nrepeat (8)\n    change [ghost v] effect by (15)\n    change size by (-7)\nend\ndelete this clone\n\nwhen I receive [skip v]\ngo to x: (-214) y: (10)\n\n@Level\n\nwhen flag clicked\ngo to x: (0) y: (-5)\nset [level v] to [1]\nforever\n    switch costume to (Level)\n    if <(costume [number v]) = [2]> then\n        broadcast (text v)\n    end\n    if <(costume [number v]) = [3]> then\n        broadcast (Spike v)\n    else\n        broadcast (Spikes Disappear v)\n    end\n    if <(costume [number v]) = [4]> then\n        broadcast (Trampoline v)\n    else\n        broadcast (Disappear Trampoline v)\n    end\n    if <(costume [number v]) = [5]> then\n        broadcast (Trampoline 2nd time v)\n    else\n        broadcast (Disappear Trampoline 2 v)\n        broadcast (Spikes Disappear 2 v)\n    end\n    if <(costume [number v]) = [6]> then\n        broadcast (Spikes 3 v)\n    else\n        broadcast (Disappear Spike 3 v)\n    end\n    if <(costume [number v]) = [7]> then\n        broadcast (text 2 v)\n    end\n    if <(costume [number v]) = [8]> then\n        broadcast (Spikes 4 v)\n    else\n        broadcast (Disappear Spike 4 v)\n    end\n    if <(costume [number v]) = [9]> then\n        broadcast (Spikes 5 v)\n    else\n        broadcast (Disappear Spike 5 v)\n    end\n    if <(costume [number v]) = [10]> then\n        broadcast (Trampoline 3 v)\n    else\n        broadcast (Disappear Trampoline 3 v)\n    end\n    if <(costume [number v]) = [11]> then\n        broadcast (Change background v)\n    else\n        switch backdrop to (cave v)\n    end\nend\n\nwhen I receive [skip v]\nchange [level v] by (1)\n\n@Spikes\n\nwhen flag clicked\nhide\n\nwhen I receive [spike v]\nswitch costume to (level 3 spikes v)\ngo to x: (-26) y: (-107)\nshow\n\nwhen I receive [spikes disappear v]\nhide\n\n@Spikes 2\n\nwhen I receive [trampoline 2nd time v]\ngo to x: (4) y: (58)\nshow\n\nwhen I receive [spikes disappear 2 v]\nhide\n\nwhen flag clicked\nhide\n\n@Spikes 3\n\nwhen flag clicked\nhide\n\nwhen I receive [spikes 3 v]\ngo to x: (36) y: (28)\nshow\n\nwhen I receive [disappear spike 3 v]\nhide\n\n@Spikes 4\n\nwhen flag clicked\nhide\n\nwhen I receive [disappear spike 4 v]\nhide\n\nwhen I receive [spikes 4 v]\ngo to x: (105) y: (-66)\nshow\n\n@Spikes 5\n\nwhen flag clicked\nhide\n\nwhen I receive [spikes 5 v]\ngo to x: (38) y: (25)\nshow\n\nwhen I receive [disappear spike 5 v]\nhide\n\n@Trampoline\n\nwhen flag clicked\nhide\n\nwhen I receive [trampoline v]\ngo to x: (-14) y: (-96)\nshow\n\nwhen I receive [disappear trampoline v]\nhide\n\n@Trampoline 2\n\nwhen I receive [disappear trampoline 2 v]\nhide\n\nwhen I receive [trampoline 2nd time v]\ngo to x: (23) y: (-97)\nshow\n\nwhen flag clicked\nhide\n\n@Trampoline 3\n\nwhen flag clicked\nhide\n\nwhen I receive [disappear trampoline 3 v]\nhide\n\nwhen I receive [trampoline 3 v]\ngo to x: (0) y: (-49)\nshow\n\n@Trick\n\nwhen flag clicked\nhide\n\nwhen I receive [spikes 3 v]\ngo to [back v] layer\ngo to x: (-6) y: (-3)\nshow\n\nwhen I receive [disappear spike 3 v]\nhide\n\n@Sprite1\n\nwhen flag clicked\nhide\n\nwhen I receive [trampoline 3 v]\ngo to [front v] layer\ngo to x: (36) y: (28)\nshow\n\nwhen I receive [disappear trampoline 3 v]\nhide\n\n@Text\n\nwhen flag clicked\ngo to x: (0) y: (27)\nswitch costume to (costume1 v)\n\nwhen I receive [text v]\ngo to x: (-6) y: (86)\nswitch costume to (costume2 v)\n\nwhen I receive [spike v]\ngo to x: (1) y: (18)\nswitch costume to (costume3 v)\n\nwhen I receive [trampoline v]\ngo to x: (1) y: (30)\nswitch costume to (costume4 v)\n\nwhen I receive [spikes 3 v]\ngo to x: (2) y: (-2)\nswitch costume to (costume6 v)\n\nwhen I receive [text 2 v]\ngo to x: (1) y: (58)\nswitch costume to (costume7 v)\n\nwhen I receive [spikes 4 v]\ngo to x: (4) y: (9)\nswitch costume to (costume8 v)\n\nwhen I receive [spikes 5 v]\ngo to x: (76) y: (-78)\nswitch costume to (costume9 v)\n\nwhen I receive [trampoline 2nd time v]\ngo to x: (2) y: (-2)\nswitch costume to (costume5 v)\n\nwhen I receive [trampoline 3 v]\ngo to x: (-12) y: (113)\nswitch costume to (costume10 v)\n\nwhen I receive [change background v]\ngo to x: (3) y: (2)\nswitch costume to (costume11 v)\n\n@Dots\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\nshow\nhide\ngo to [back v] layer\nrepeat (30)\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nshow\nforever\n    set [ghost v] effect to (10)\n    set size to (pick random (55) to (99)) %\n    go to x: (500) y: (pick random (-180) to (180))\n    glide (pick random (.7) to (5)) secs to x: (-240) y: (pick random (-180) to (180))\nend\n\nwhen I receive [change background v]\nswitch costume to (costume2 v)\n\n@Cover\n\nwhen flag clicked\nshow\ngo to [front v] layer\nset [ghost v] effect to (100)\n\n@Gap\n\nwhen flag clicked\nhide\n\nwhen I receive [text 2 v]\ngo to x: (43) y: (-79)\nshow\n\nwhen I receive [spikes 4 v]\nhide\n\n@Skip\n\nwhen flag clicked\ngo to x: (-188) y: (-145)\nshow\n\nwhen this sprite clicked\nbroadcast (Skip v)\n\nwhen I receive [change background v]\nhide\n\nwhen flag clicked\nforever\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (-10)\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\n