Destiny - A Platformer
@Stage\n\n@Player\n\nwhen flag clicked\nswitch costume to (costume1 v)\nshow\nset [y velocity v] to [0]\nset [x velocity v] to [0]\ngo to x: (-210) y: (-90)\nforever\n    if <<key (right arrow v) pressed?> or <<(mouse x) > (x position)> and <mouse down?>>> then\n        change [x velocity v] by (1)\n    end\n    if <<key (left arrow v) pressed?> or <<(mouse x) < (x position)> and <mouse down?>>> 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 <<(mouse y) > (y position)> and <mouse down?>>> 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 <<(mouse y) > (y position)> and <mouse down?>>> then\n            change [y velocity v] by (15)\n        end\n    end\n    change y by (1)\n    if <(x position) > [240]> then\n        go to x: (-210) y: (-90)\n        change [level v] by (1)\n        set [x velocity v] to [0]\n        set [y velocity v] to [0]\n        broadcast (next level v)\n    end\nend\n\nwhen flag clicked\nset size to (100) %\nforever\n    set [ghost v] effect to (0)\n    if <touching (bad v)?> then\n        broadcast (died v)\n        repeat (4)\n            change [ghost v] effect by (25)\n        end\n        go to x: (-210) y: (-90)\n    end\nend\n\nwhen flag clicked\nforever\n    if <key (r v) pressed?> then\n        go to x: (-210) y: (-90)\n    end\nend\n\nwhen flag clicked\nhide variable [level v]\n\nwhen flag clicked\nforever\n    set drag mode [not draggable v]\nend\n\n@Level\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\nset [level v] to [0]\n\nwhen I receive [next level v]\nchange [level v] by (1)\nnext costume\n\nwhen flag clicked\nforever\n    if <(costume [number v]) = [9]> then\n        broadcast (cave v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(costume [number v]) = [16]> then\n        broadcast (no cave v)\n    end\nend\n\n@Background\n\nwhen flag clicked\nswitch costume to (costume1 v)\ngo to x: (0) y: (0)\ngo to [back v] layer\n\nwhen I receive [cave v]\nswitch costume to (costume2 v)\n\nwhen I receive [no cave v]\nswitch costume to (costume1 v)\n\nwhen flag clicked\nforever\n    play sound [most-beautiful-music-ever-everdream-by-epic-soul-factory-youtubemp3free v] until done\nend\n\n@Bad\n\nwhen flag clicked\nswitch costume to (costume2 v)\nshow\ngo to x: (0) y: (0)\n\nwhen I receive [next level v]\nnext costume\ngo to [front v] layer\n\n@Shadow\n\nwhen flag clicked\nforever\n    go to (player v)\nend\n\nwhen I receive [died v]\nhide\nwait (0.1) seconds\nshow\n\n@Thumbnail\n\nwhen flag clicked\nforever\n    go to x: (0) y: (0)\n    show\n    go to [front v] layer\n    set [ghost v] effect to (100)\nend\n\n