Pusheen Platformer


@Stage\n\n@dot\n\nwhen flag clicked\nerase all\nset size to (75) %\nhide\ngenerate\nforever\n    broadcast (tick v)\nend\n\nwhen I start as a clone\ngo to (random position v)\npoint in direction (pick random (0) to (360))\nshow\nset [ghost v] to [0]\n\ndefine generate\nrepeat (300)\n    create clone of (_myself_ v)\nend\n\nwhen flag clicked\nset [bg v] to [1]\nforever\n    if <(mouse y) > [130]> then\n        show variable [bg v]\n    else\n        hide variable [bg v]\n    end\nend\n\nwhen I receive [tick v]\nswitch costume to (BG)\nif <touching (player v)?> then\n    set [ghost v] to [-100]\nelse\n    if <touching (danger v)?> then\n        change [ghost v] by (-25)\n        if <[0] > (ghost)> then\n            set [ghost v] to [0]\n        end\n        set [color v] effect to (80)\n    else\n        set [color v] effect to (0)\n        if <touching (ground v)?> then\n            change [ghost v] by (-25)\n            if <[0] > (ghost)> then\n                set [ghost v] to [0]\n            end\n        else\n            change [ghost v] by (25)\n            if <(ghost) > [80]> then\n                set [ghost v] to [80]\n            end\n        end\n    end\nend\nset [brightness v] effect to ((ghost) + (pick random (-5) to (5)))\nmove (4) steps\nif on edge, bounce\nstamp\n\n@ground\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\nshow\nswitch costume to (costume1 v)\n\nwhen I receive [next level v]\nnext costume\n\nwhen [space v] key pressed\nrepeat until <not <key (space v) pressed?>>\n    set [ghost v] effect to (50)\nend\nset [ghost v] effect to (100)\n\nwhen [z v] key pressed\nif <<(username) = [04tmoody]> or <(username) = [04tmoody-collab]>> then\n    hide\nend\n\n@danger\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\nswitch costume to (costume1 v)\nset [ghost v] effect to (100)\n\nwhen I receive [next level v]\nnext costume\n\nwhen [space v] key pressed\nrepeat until <not <key (space v) pressed?>>\n    set [ghost v] effect to (50)\nend\nset [ghost v] effect to (100)\n\nwhen [z v] key pressed\nif <<(username) = [04tmoody]> or <(username) = [04tmoody-collab]>> then\n    hide\nend\n\n@player\n\nwhen flag clicked\ngo to x: (-200) y: (-50)\nset [xv v] to [0]\nset [yv v] to [0]\nset [ghost v] effect to (100)\nshow\nforever\n    physics\n    if <(x position) > [235]> then\n        go to x: (-200) y: (-50)\n        set [xv v] to [0]\n        set [yv v] to [0]\n        broadcast (next level v)\n    end\n    if <<[-175] > (y position)> or <<touching (danger v)?> or <key (r v) pressed?>>> then\n        go to x: (-200) y: (-50)\n        set [xv v] to [0]\n        set [yv v] to [0]\n    end\nend\n\ndefine physics\nif <<key (left arrow v) pressed?> or <<(mouse x) < [0]> and <mouse down?>>> then\n    change [xv v] by (-2)\nend\nif <<key (right arrow v) pressed?> or <<[0] < (mouse x)> and <mouse down?>>> then\n    change [xv v] by (2)\nend\nset [xv v] to ((xv) * (0.8))\nchange x by (xv)\nif <touching (ground v)?> then\n    repeat until <not <touching (ground v)?>>\n        change x by (([abs v] of (xv) ) / (() - (xv)))\n    end\n    set [xv v] to [0]\nend\nchange [yv v] by (-1)\nif <<<key (up arrow v) pressed?> or <<[0] < (mouse y)> and <mouse down?>>> and <(can jump?) = [1]>> then\n    set [yv v] to [15]\nend\nchange y by (yv)\nset [can jump? v] to [0]\nif <touching (ground v)?> then\n    repeat until <not <touching (ground v)?>>\n        change y by (([abs v] of (yv) ) / (() - (yv)))\n    end\n    if <(yv) < [0]> then\n        set [can jump? v] to [1]\n    end\n    set [yv v] to [0]\nend\n\nwhen [space v] key pressed\nrepeat until <not <key (space v) pressed?>>\n    set [ghost v] effect to (50)\nend\nset [ghost v] effect to (100)\n\nwhen [z v] key pressed\nif <<(username) = [04tmoody]> or <(username) = [04tmoody-collab]>> then\n    hide\nend\n\n