Colors: A platformer


@Stage\n\nwhen flag clicked\nswitch backdrop to (1 v)\nforever\n    play sound [Polargeist v] until done\nend\n\nwhen I receive [next level v]\nnext backdrop\n\n@You\n\nwhen I receive [next level v]\ngo to x: (-216) y: (-125)\nset [change in x v] to [0]\nset [change in y v] to [0]\n\ndefine Side Collsion\nif <touching color (#000000)?> then\n    change y by (1)\n    if <touching color (#000000)?> then\n        change y by (1)\n        if <touching color (#000000)?> then\n            change y by (1)\n            if <touching color (#000000)?> then\n                change y by (1)\n                if <touching color (#000000)?> then\n                    change y by (1)\n                    if <touching color (#000000)?> then\n                        change x by ((Change in x) * (-1))\n                        change y by (-5)\n                        if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n                            if <(Change in x) > [0]> then\n                                set [change in x v] to [-5]\n                            else\n                                set [change in x v] to [5]\n                            end\n                            set [change in y v] to [10]\n                        else\n                            set [change in x v] to [0]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Gravity\nchange [change in y v] by (-1)\nchange y by (change in y)\nif <touching color (#000000)?> then\n    change y by ((-1) * (change in y))\n    set [change in y v] to [0]\nend\nchange y by (-1)\nif <touching color (#000000)?> then\n    if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n        set [change in y v] to [15]\n    end\nend\nchange y by (1)\n\nwhen flag clicked\nset [level v] to [1]\npoint in direction (90)\ngo to x: (-216) y: (-100)\nset [change in y v] to [0]\nset [change in x v] to [0]\nforever\n    if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n        change [change in x v] by (1)\n    end\n    if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n        change [change in x v] by (-1)\n    end\n    set [change in x v] to ((Change in x) * (0.9))\n    change x by (Change in x)\n    Side Collsion\n    Gravity\n    if <[235] < (x position)> then\n        switch costume to (black v)\n        broadcast (next level v)\n        change [level v] by (1)\n    end\nend\n\nswitch costume to (black v)\nchange [level v] by (1)\n\nbroadcast (next level v)\n\nwhen flag clicked\nshow\n\nhide\n\nwhen flag clicked\nforever\n    if <touching color (#0500ff)?> then\n        set [change in y v] to [0]\n        set [change in x v] to [0]\n        wait (0.01) seconds\n        change [change in y v] by (20)\n    end\n    if <touching (redportal v)?> then\n        switch costume to (red v)\n    end\n    if <touching (greenportal v)?> then\n        switch costume to (green v)\n    end\nend\n\nwhen flag clicked\nswitch costume to (black v)\nforever\n    if <<touching color (#ff0000)?> and <not <(costume [number v]) = [2]>>> then\n        switch costume to (black v)\n        go to x: (-216) y: (-125)\n        set [change in x v] to [0]\n        set [change in y v] to [0]\n    end\n    if <touching color (#bb00ff)?> then\n        go to x: (-216) y: (-125)\n        switch costume to (black v)\n        set [change in x v] to [0]\n        set [change in y v] to [0]\n    end\n    if <<touching color (#51af2e)?> and <not <(costume [number v]) = [3]>>> then\n        change [change in y v] by (1.7)\n    end\n    if <(backdrop [name v]) = [cutscene]> then\n        hide\n        broadcast (cutscene v)\n        stop [other scripts in sprite v]\n        stop [this script v]\n    end\nend\n\nwhen [r v] key pressed\ngo to x: (-216) y: (-125)\nset [change in x v] to [0]\nset [change in y v] to [0]\n\n@RedPortal\n\nwhen flag clicked\nhide\nforever\n    if <(level) = [4]> then\n        go to x: (-131) y: (-101)\n        show\n    end\n    if <(level) = [5]> then\n        set size to (75) %\n        go to x: (61) y: (-51)\n        show\n    end\n    if <(level) = [7]> then\n        go to x: (-103) y: (113)\n        show\n    end\n    if <(backdrop [name v]) = [10]> then\n        set size to (75) %\n        go to x: (-76) y: (140)\n        show\n    end\n    if <(backdrop [name v]) = [11]> then\n        set size to (75) %\n        go to x: (-89) y: (-112)\n        show\n    end\nend\n\nwhen I receive [next level v]\nhide\nset size to (100) %\n\n@GreenPortal\n\nwhen flag clicked\nhide\nforever\n    if <(level) = [9]> then\n        go to x: (195) y: (50)\n        show\n    end\n    if <(backdrop [name v]) = [10]> then\n        set size to (75) %\n        go to x: (83) y: (136)\n        show\n    end\nend\n\nwhen I receive [next level v]\nhide\nset size to (100) %\n\n@YouInCutscene\n\nwhen flag clicked\nhide\n\nwhen I receive [cutscene v]\nwait (1) seconds\nshow\ngo to x: (-150) y: (-113)\nglide (2) secs to x: (25) y: (-113)\nglide (1) secs to x: (69) y: (-74)\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nnext backdrop\nhide\n\n@Thumbnail\n\nwhen flag clicked\ngo to x: (0) y: (0)\nclear graphic effects\nset [ghost v] effect to (100)\n\n@Flash Effect\n\ngo to x: (0) y: (0)\n\nwhen flag clicked\nhide\n\nwhen I receive [cutscene v]\nshow\nclear graphic effects\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nset [ghost v] effect to (100)\nhide\n\n