Scratch Platformer 2

Instructions: INSTRUCTIONS:\n\nArrow keys to move. 1 to switch to Gobo, 2 to switch to Polly [when unlocked], 3 to switch to Rex [when unlocked], 4 to switch to Pengu [when unlocked], and 5 to switch to Gobi [when unlocked].\n\nGobo - Gobo is an all around character with nothing too special.\nPolly - Polly jumps the highest but is the slowest.\nRex - Rex runs the fastest but jumps the lowest.\nPengu - Pengu jumps at normal height but has the slowest gravity.\nGobi - Gobi is Gobo's twin brother and is slightly faster than Gobo and jumps a little higher than him.

@Stage\n\nwhen flag clicked\nforever\n    play sound [Dr. Wily Stage 1 & 2 \(Mega Man 2\) - Super Smash Bros. for Wii U Music Extended.mp3 v] until done\nend\n\n@Player\n\nwhen flag clicked\nbroadcast (hide all v) and wait\nhide\nswitch backdrop to (1 v)\nset size to (50) %\ngo to x: (0) y: (0)\npoint in direction (90)\ndelete (all) of [characters v]\nadd [gobo] to [characters v]\nset [level v] to [1]\nset [costume# v] to [1]\nset [got character? v] to [1]\nreset\n\ndefine None\nchange [px v] by (x)\nchange [py v] by (y)\nposition\nif <not <touching (platform v)?>> then\n    set [ground? v] to [0]\n    stop [this script v]\nend\nif <(x) = [0]> then\n    set [yv v] to [0]\nend\nrepeat (15)\n    change [py v] by (1)\n    position\n    if <not <touching (platform v)?>> then\n        set [ground? v] to [1]\n        stop [this script v]\n    end\nend\nchange [px v] by ((0) - (x))\nchange [py v] by ((-10) - (y))\n\ndefine position\ngo to x: ((px) - (cx)) y: ((py) - (cy))\n\ndefine tick\nswitch costume to (hitbox v)\nif <key (left arrow v) pressed?> then\n    point in direction (-90)\n    if <<(costume#) = [1]> or <(costume#) = [4]>> then\n        set [xv v] to [-7]\n    else\n        if <(costume#) = [2]> then\n            set [xv v] to [-3.75]\n        else\n            if <(costume#) = [3]> then\n                set [xv v] to [-12.5]\n            else\n                if <(costume#) = [5]> then\n                    set [xv v] to [-8]\n                else\n                end\n            end\n        end\n    end\nelse\n    if <key (right arrow v) pressed?> then\n        point in direction (90)\n        if <<(costume#) = [1]> or <(costume#) = [4]>> then\n            set [xv v] to [7]\n        else\n            if <(costume#) = [2]> then\n                set [xv v] to [3.75]\n            else\n                if <(costume#) = [3]> then\n                    set [xv v] to [12.5]\n                else\n                    if <(costume#) = [5]> then\n                        set [xv v] to [8]\n                    else\n                    end\n                end\n            end\n        end\n    else\n        set [xv v] to [0]\n    end\nend\nif <key (up arrow v) pressed?> then\n    if <(ground?) = [1]> then\n        if <(costume#) = [1]> then\n            set [yv v] to [15]\n        else\n            if <(costume#) = [2]> then\n                set [yv v] to [21.5]\n            else\n                if <(costume#) = [3]> then\n                    set [yv v] to [9.25]\n                else\n                    if <(costume#) = [4]> then\n                        set [yv v] to [8]\n                    else\n                        if <(costume#) = [5]> then\n                            set [yv v] to [15.5]\n                        else\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nmove (xV) (0)\nif <(costume#) = [4]> then\n    change [yv v] by (-0.55)\nelse\n    change [yv v] by (-1.5)\nend\nmove (0) (yV)\nset [cx v] to (round ((((xscroll) * (7)) + (px)) / (8)))\nset [cy v] to (round ((((yscroll) * (7)) + (py)) / (8)))\nposition\nif <<(yscroll) < [-1500]> or <touching (zombie v)?>> then\n    reset\nend\ncostumes\n\ndefine reset\nerase all\nset [cx v] to [0]\nset [cy v] to [0]\nset [px v] to [0]\nset [py v] to [0]\nset [xscroll v] to [0]\nset [yscroll v] to [0]\nset [xv v] to [0]\nset [yv v] to [0]\nset [ground? v] to [0]\ngo to x: (0) y: (0)\n\nwhen I receive [start v]\nshow\nforever\n    tick\n    broadcast (position character v)\n    broadcast (position v) and wait\n    broadcast (position diamond v) and wait\n    if <(Level) = [16]> then\n        hide\n        broadcast (end hide v) and wait\n        switch backdrop to (win v)\n        stop [all v]\n    end\nend\n\ndefine costumes\nif <<key (1 v) pressed?> and <[characters v] contains [gobo]?>> then\n    set [costume# v] to [1]\nend\nif <<key (2 v) pressed?> and <[characters v] contains [polly]?>> then\n    set [costume# v] to [2]\nend\nif <<key (3 v) pressed?> and <[characters v] contains [rex]?>> then\n    set [costume# v] to [3]\nend\nif <<key (4 v) pressed?> and <[characters v] contains [pengu]?>> then\n    set [costume# v] to [4]\nend\nif <<key (5 v) pressed?> and <[characters v] contains [gobi]?>> then\n    set [costume# v] to [5]\nend\nswitch costume to (costume#)\n\nwhen I receive [next level v]\nreset\n\n@Platform\n\nwhen I receive [position v]\nset [xscroll v] to (cx)\nset [yscroll v] to (cy)\nswitch costume to (Level)\nposition (() - (xscroll)) (() - (yscroll))\n\nwhen I receive [setup v]\nhide\n\nwhen I receive [start v]\nswitch backdrop to (2 v)\nshow\n\nwhen I receive [hide all v]\nhide\n\ndefine None\ngo to x: (round (x)) y: (round (y))\nif <<(round (x)) = (x position)> and <(round (y)) = (y position)>> then\n    show\nelse\n    hide\nend\n\nset size to (200) %\n\nwhen I receive [end hide v]\nhide\n\n@Logo\n\nwhen flag clicked\ngo to x: (0) y: (70)\npoint in direction (90)\nshow\nset [i v] to [0]\nforever\n    change y by ([sin v] of (i) )\n    change [i v] by (6)\nend\n\nwhen I receive [start v]\nhide\n\n@Play\n\nwhen flag clicked\ngo to x: (0) y: (-68)\nset size to (100) %\nshow\nforever\n    if <touching (mouse-pointer v)?> then\n        switch costume to (costume2 v)\n    else\n        switch costume to (costume1 v)\n    end\nend\n\nwhen flag clicked\nforever\n    wait until <<mouse down?> and <touching (mouse-pointer v)?>>\n    wait until <not <mouse down?>>\n    hide\n    broadcast (setup v) and wait\n    broadcast (start v)\nend\n\n@Goal\n\ndefine None\ngo to x: (round (x)) y: (round (y))\nif <<(round (x)) = (x position)> and <(round (y)) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [position diamond v]\nposition ((() - (xscroll)) + (item (Level) of [goal x v])) ((() - (yscroll)) + (25))\nif <<touching (player v)?> and <(got character?) = [1]>> then\n    change [level v] by (1)\n    broadcast (next level v) and wait\nend\n\nwhen I receive [hide all v]\nhide\n\nwhen I receive [end hide v]\nhide\n\n@Characters\n\ndefine None\ngo to x: (round (x)) y: (round (y))\nif <<(round (x)) = (x position)> and <(round (y)) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [hide all v]\nhide\n\nset [level v] to [8]\nadd [polly] to [characters v]\n\nwhen I receive [position character v]\nhide\nif <(Level) = [5]> then\n    if <not <[characters v] contains [polly]?>> then\n        set [got character? v] to [0]\n        switch costume to (polly v)\n        show\n        repeat until <<(Level) = [6]> or <touching (player v)?>>\n            position (((0) - (xscroll)) + (500)) (((0) - (yscroll)) + (-35))\n            if <touching (player v)?> then\n                hide\n                add [polly] to [characters v]\n                set [got character? v] to [1]\n                stop [this script v]\n            end\n        end\n    end\nelse\n    if <(Level) = [8]> then\n        if <not <[characters v] contains [rex]?>> then\n            set [got character? v] to [0]\n            switch costume to (rex v)\n            show\n            repeat until <<(Level) = [9]> or <touching (player v)?>>\n                position (((0) - (xscroll)) + (500)) (((0) - (yscroll)) + (-35))\n                if <touching (player v)?> then\n                    hide\n                    add [rex] to [characters v]\n                    set [got character? v] to [1]\n                    stop [this script v]\n                end\n            end\n        end\n    else\n        if <(Level) = [11]> then\n            if <not <[characters v] contains [pengu]?>> then\n                set [got character? v] to [0]\n                switch costume to (pengu v)\n                show\n                repeat until <<(Level) = [12]> or <touching (player v)?>>\n                    position (((0) - (xscroll)) + (500)) (((0) - (yscroll)) + (-35))\n                    if <touching (player v)?> then\n                        hide\n                        add [pengu] to [characters v]\n                        set [got character? v] to [1]\n                        stop [this script v]\n                    end\n                end\n            end\n        else\n            if <(Level) = [14]> then\n                if <not <[characters v] contains [gobi]?>> then\n                    set [got character? v] to [0]\n                    switch costume to (gobi v)\n                    show\n                    repeat until <<(Level) = [15]> or <touching (player v)?>>\n                        position (((0) - (xscroll)) + (500)) (((0) - (yscroll)) + (-35))\n                        if <touching (player v)?> then\n                            hide\n                            add [gobi] to [characters v]\n                            set [got character? v] to [1]\n                            stop [this script v]\n                        end\n                    end\n                end\n            else\n            end\n        end\n    end\nend\n\nwhen I receive [end hide v]\nhide\n\n@Thumb\n\nwhen I receive [hide all v]\nhide\n\ngo to x: (0) y: (0)\ngo to [front v] layer\nshow\n\n