Pac-Man Platformer                                                                   #games #all

Instructions: Help Pac-Man find the cherry and collect pellets along the way. Avoid the ghosts, though! Can you collect all the pellets?\n\n★★★ Computer Controls ★★★\n<> WASD or Arrow Keys to move!\n<> Run against a wall and hold jump to wall jump!\n\n★★★ Mobile Controls ★★★\n<> Press and hold on the screen to use the analog stick! 

@Stage\n\nwhen flag clicked\nforever\n    switch backdrop to (level)\nend\n\nwhen flag clicked\nforever\n    play sound [\[Trap\] Pac Man Theme \(Trap Remix\) v] until done\nend\n\nwhen I receive [next level v]\nif <(level) = [14]> then\n    start sound [Goal Cheer v]\nend\n\n@Player\n\nwhen flag clicked\nset [air time v] to [0]\nset [max level v] to [1]\nset [level v] to [1]\nset [deaths v] to [0]\nRespawn [-200] [-100]\nforever\n    switch costume to (hitbox v)\n    change [air time v] by (1)\n    if <(air time) > [100]> then\n        set [air time v] to [100]\n    end\n    change [y speed v] by (-2)\n    Change Y (y speed)\n    if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <(yLengthWithinBounds) > ((slingMaxLength) / (2))>> and <(touching ground) = [1]>> then\n        set [y speed v] to [20]\n    end\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <(xLengthWithinBounds) > ((slingMaxLength) / (2))>> then\n        point in direction (90)\n        change [x speed v] by (2)\n    end\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <(xLengthWithinBounds) < (() - ((slingMaxLength) / (2)))>> then\n        point in direction (-90)\n        change [x speed v] by (-2)\n    end\n    if <(x speed) > [8]> then\n        set [x speed v] to [8]\n    else\n        if <(x speed) < [-8]> then\n            set [x speed v] to [-8]\n        end\n    end\n    Change X (x speed)\n    if <(x speed) > [0]> then\n        change [x speed v] by (-1)\n    else\n        if <(x speed) < [0]> then\n            change [x speed v] by (1)\n        end\n    end\n    if <<(x position) > [239]> and <not <(level) = [16]>>> then\n        if <not <(level) = (max level)>> then\n            Respawn [-210] [0]\n            set [deaths v] to [0]\n            change [level v] by (1)\n        end\n    end\n    if <<touching (rising lava v)?> or <touching (spikes v)?>> then\n    switch costume to (red pac-man v)\nend\n\ndefine Change X (x speed)\nset [slope v] to [0]\nif <(touching ground) = [1]> then\n    set [max slope v] to [15]\nelse\n    set [max slope v] to [1]\nend\nchange x by (x speed)\nif <touching (platforms v)?> then\n    repeat until <<not <touching (platforms v)?>> or <(slope) = (max slope)>>\n        change y by (1)\n        change [slope v] by (1)\n    end\nend\nif <(slope) = (max slope)> then\n    change y by (() - (slope))\n    set [x speed v] to [0]\n    if <(x speed) > [0]> then\n        repeat until <not <touching (platforms v)?>>\n            change x by (-1)\n        end\n        if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <(yLengthWithinBounds) > ((slingMaxLength) / (2))>> and <(air time) > [5]>> then\n            set [y speed v] to [15]\n            set [x speed v] to [-10]\n            broadcast (Skid Effect v)\n            start sound [Basketball Bounce v]\n        end\n    else\n        repeat until <not <touching (platforms v)?>>\n            change x by (1)\n        end\n        if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <(yLengthWithinBounds) > ((slingMaxLength) / (2))>> and <(air time) > [5]>> then\n            set [y speed v] to [15]\n            set [x speed v] to [10]\n            broadcast (Skid Effect v)\n            start sound [Basketball Bounce v]\n        end\n    end\nend\nif <(touching ground) = [1]> then\n    change y by (-15)\n    if <touching (platforms v)?> then\n        repeat until <not <touching (platforms v)?>>\n            change y by (1)\n        end\n    else\n        change y by (15)\n    end\nend\n\nwhen flag clicked\nset [ghost v] effect to (100)\n\nwhen flag clicked\npoint in direction (90)\n\ndefine block\n\ndefine Respawn (x) (y)\nset [x speed v] to [0]\nset [y speed v] to [0]\ngo to x: (x) y: (y)\n\ndefine Change Y (y speed)\nchange y by (y speed)\nset [touching ground v] to [0]\nif <touching (platforms v)?> then\n    set [y speed v] to [0]\n    if <<(y speed) > [0]> or <(y speed) = [0]>> then\n        repeat until <not <touching (platforms v)?>>\n            change y by (-1)\n        end\n    else\n        set [touching ground v] to [1]\n        set [air time v] to [0]\n        repeat until <not <touching (platforms v)?>>\n            change y by (1)\n        end\n    end\nend\n\nwhen flag clicked\nset rotation style [left-right v]\ngo to [front v] layer\nforever\n    if <<<<<touching (sprite1 v)?> or <touching (sprite4 v)?>> or <touching (sprite6 v)?>> or <touching (sprite5 v)?>> or <(y position) < [-180]>> then\n        start sound [Pac-Man Death - Sound Effect \(HD\) v]\n        change [deaths v] by (1)\n        Respawn [-200] [100]\n        set y to (10)\n    end\n    if <<touching (sprite10 v)?> and <(level) < [14]>> then\n        change [level v] by (1)\n        Respawn [-200] [100]\n        set y to (10)\n        broadcast (Next Level v)\n    end\nend\n\nwhen flag clicked\nforever\n\nwhen I receive [skip v]\nchange [level v] by (1)\nRespawn [-200] [100]\nset y to (10)\n\n@Platforms\n\nwhen flag clicked\nset [level v] to [1]\nforever\n    switch costume to (level)\nend\n\nset [level v] to [13]\n\nwhen flag clicked\nforever\n    if <(level) = [14]> then\n        start sound [Crowd Gasp v]\n        wait until <not <(level) = [14]>>\n    end\n    if <(level) = [15]> then\n        start sound [Goal Cheer v]\n        wait until <not <(level) = [15]>>\n    end\nend\n\n@Exit\n\n@Sprite2\n\nwhen flag clicked\nforever\n    broadcast (Go to v)\nend\n\nwhen I receive [go to v]\ngo to (player v)\n\nwhen flag clicked\nset rotation style [left-right v]\nforever\n    point in direction ([direction v] of [player v])\nend\n\nwhen flag clicked\nforever\n    next costume\n    wait (0.04) seconds\nend\n\nwhen flag clicked\npoint in direction (90)\n\n@Sprite3\n\nwhen I receive [next level v]\nif <<(Clone?) = [0]> and <(level) = [2]>> then\n    Create PacManCoin At X [-37] Y: [-78]\n    Create PacManCoin At X [3] Y: [-78]\n    Create PacManCoin At X [45] Y: [-78]\nelse\n    if <<(Clone?) = [0]> and <(level) = [4]>> then\n        Create PacManCoin At X [-22] Y: [-112]\n        Create PacManCoin At X [43] Y: [-112]\n        Create PacManCoin At X [11] Y: [-112]\n    else\n        if <<(Clone?) = [0]> and <(level) = [6]>> then\n            Create PacManCoin At X [125] Y: [154]\n            Create PacManCoin At X [178] Y: [154]\n            Create PacManCoin At X [125] Y: [112]\n            Create PacManCoin At X [178] Y: [112]\n        else\n            if <<(Clone?) = [0]> and <(level) = [7]>> then\n                Create PacManCoin At X [91] Y: [90]\n                Create PacManCoin At X [91] Y: [50]\n            else\n                if <<(Clone?) = [0]> and <(level) = [10]>> then\n                    Create PacManCoin At X [-26] Y: [99]\n                    Create PacManCoin At X [64] Y: [99]\n                    Create PacManCoin At X [19] Y: [99]\n                else\n                    if <<(Clone?) = [0]> and <(level) = [11]>> then\n                        Create PacManCoin At X [-69] Y: [-112]\n                        Create PacManCoin At X [-27] Y: [-112]\n                        Create PacManCoin At X [14] Y: [-112]\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Create PacManCoin At X (x) Y: (y)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\n\nwhen flag clicked\nset [clone? v] to [0]\nhide\n\nwhen I start as a clone\nset [clone? v] to [1]\nset size to (200) %\nshow\n\nwhen I receive [next level v]\nhide\ndelete this clone\n\nwhen flag clicked\nset [pellets v] to [0]\n\nwhen I start as a clone\nforever\n    if <touching (player v)?> then\n        start sound [Pacman Wakawaka - Sound Effect2 v]\n        change [pellets v] by (1)\n        delete this clone\n    end\nend\n\n@Sprite1\n\nwhen flag clicked\nforever\n    switch costume to (level)\nend\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    repeat (10)\n        change y by (0.2)\n    end\n    repeat (10)\n        change y by (-0.2)\n    end\nend\n\n@Sprite4\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    repeat (10)\n        change y by (0.2)\n    end\n    repeat (10)\n        change y by (-0.2)\n    end\nend\n\nwhen flag clicked\nforever\n    switch costume to (level)\nend\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    repeat (68)\n        change x by (-2)\n    end\n    repeat (68)\n        change x by (2)\n    end\nend\n\n@Sprite5\n\nwhen flag clicked\nforever\n    repeat (10)\n        change y by (0.2)\n    end\n    repeat (10)\n        change y by (-0.2)\n    end\nend\n\nwhen flag clicked\nforever\n    switch costume to (level)\nend\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    if <(level) = [9]> then\n        glide (4) secs to x: (-405) y: (0)\n    end\n    if <(level) = [9]> then\n        glide (4) secs to x: (0) y: (0)\n    end\nend\n\nwhen I receive [next level v]\ngo to x: (0) y: (0)\n\nbroadcast (Next Level v)\nchange [level v] by (1)\n\n@Sprite6\n\nwhen flag clicked\nforever\n    repeat (10)\n        change y by (0.2)\n    end\n    repeat (10)\n        change y by (-0.2)\n    end\nend\n\nwhen flag clicked\nforever\n    switch costume to (level)\nend\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    if <(level) = [10]> then\n        glide (2) secs to x: (-95) y: (0)\n        glide (2) secs to x: (0) y: (0)\n    end\n    if <(level) = [10]> then\nend\n\nwhen I receive [next level v]\ngo to x: (0) y: (0)\n\nbroadcast (Next Level v)\nchange [level v] by (1)\n\n@Sprite7\n\nwhen flag clicked\nhide\n\nwhen I receive [next level v]\nif <(level) = [13]> then\n    show\nend\n\nwhen flag clicked\nforever\n    if <(level) = [13]> then\n        if <touching (player v)?> then\n            start sound [Pacman Wakawaka - Sound Effect v]\n            hide\n            stop [this script v]\n        end\n    end\nend\n\nwhen I receive [next level v]\ngo to x: (149) y: (-68)\nif <(level) = [13]> then\n    forever\n        glide (1) secs to x: (2) y: (-68)\n        glide (1) secs to x: (149) y: (-68)\n    end\nelse\n    stop [this script v]\nend\n\nwhen I receive [next level v]\nforever\n    next costume\n    wait (0.2) seconds\nend\n\n@Sprite8\n\nwhen flag clicked\nhide\n\nwhen I receive [next level v]\nif <<(level) = [14]> and <(pellets) = [18]>> then\n    broadcast (You got all the Pellets! v)\nend\n\nwhen I receive [you got all the pellets! v]\nwait (2) seconds\ngo to x: (-15) y: (181)\nswitch costume to (you got them pellets v)\nshow\nrepeat (25)\n    change y by (-5)\nend\nwait (2) seconds\nstart sound [Cheer v]\nstart sound [Human Beatbox1 v]\nstart sound [Gong v]\nstart sound [Goal Cheer v]\nbroadcast (hide normal cherry v)\nswitch costume to (you got them pellets2 v)\n\n@Sprite9\n\nwhen flag clicked\nforever\n    switch costume to (level)\nend\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    repeat (10)\n        change y by (0.2)\n    end\n    repeat (10)\n        change y by (-0.2)\n    end\nend\n\nwhen flag clicked\nshow\n\nwhen I receive [hide normal cherry v]\nhide\n\n@Sprite10\n\nwhen flag clicked\nforever\n    go to x: (0) y: (0)\n    set [ghost v] effect to (100)\nend\n\n@Skip\n\nwhen flag clicked\nforever\n    if <(deaths) > [2]> then\n        show\n    else\n        hide\n    end\nend\n\nwhen this sprite clicked\nset [deaths v] to [0]\nhide\nbroadcast (Skip v)\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    repeat (20)\n        change y by (.5)\n    end\n    repeat (20)\n        change y by (-.5)\n    end\nend\n\nwhen I receive [skip v]\nchange [level v] by (1)\nbroadcast (Next Level v)\n\nwhen I receive [next level v]\nset [deaths v] to [0]\n\n@Sprite11\n\nwhen I receive [go to 2 v]\npoint in direction ([direction v] of [player v])\ngo to (player v)\n\nwhen flag clicked\nset rotation style [left-right v]\nforever\n    broadcast (go to 2 v)\nend\n\nwhen I receive [skid effect v]\nshow\nwait (0.1) seconds\nhide\n\nwhen flag clicked\nhide\n\n@Analog Stick by AzureLightning\n\nwhen flag clicked\ngo to [front v] layer\nset [analog to x input v] to [0]\nswitch costume to (stick v)\nset [ghost v] effect to (50)\ncreate clone of (_myself_ v)\nset [analog is clone v] to [0]\nset pen size to (5)\npen up\nerase all\nset [slingxorigin v] to [100]\nset [slingyorigin v] to [0]\nset [slingmaxlength v] to [30]\nset [drawmode v] to [1]\nforever\n    set [xlengthwithinbounds v] to [0]\n    set [ylengthwithinbounds v] to [0]\n    if <mouse down?> then\n        if <(holding) = [0]> then\n            set [slingxorigin v] to (mouse x)\n            set [slingyorigin v] to (mouse y)\n            set [candraw v] to [1]\n        end\n        set [holding v] to [1]\n        if <(canDraw) = [1]> then\n            calculateLength\n        end\n    else\n        set [holding v] to [0]\n        set [candraw v] to [0]\n    end\n    set [analog to x input v] to ((xLengthWithinBounds) / (slingMaxLength))\n    if <(canDraw) = [1]> then\n        go to x: ((xLengthWithinBounds) + (slingXOrigin)) y: ((yLengthWithinBounds) + (slingYOrigin))\n        show\n    else\n        hide\n    end\nend\n\ndefine drawSling\nif <(drawMode) = [1]> then\n    erase all\n    go to x: (slingXOrigin) y: (slingYOrigin)\n    set pen color to (#424242)\n    pen down\n    go to x: ((xLengthWithinBounds) + (slingXOrigin)) y: ((yLengthWithinBounds) + (slingYOrigin))\nelse\n    go to x: ((xLengthWithinBounds) + (slingXOrigin)) y: ((yLengthWithinBounds) + (slingYOrigin))\n    set pen color to (#cacaca)\n    pen down\nend\n\ndefine calculateLength\nset [xlength v] to ((mouse x) - (slingXOrigin))\nset [ylength v] to ((mouse y) - (slingYOrigin))\nset [lengthofhypotenuse v] to ([sqrt v] of (((xLength) * (xLength)) + ((yLength) * (yLength))) )\nif <(lengthOfHypotenuse) > (slingMaxLength)> then\n    set [hypotenuseratio v] to ((slingMaxLength) / (lengthOfHypotenuse))\n    set [xlengthwithinbounds v] to ((xLength) * (hypotenuseRatio))\n    set [ylengthwithinbounds v] to ((yLength) * (hypotenuseRatio))\nelse\n    set [xlengthwithinbounds v] to (xLength)\n    set [ylengthwithinbounds v] to (yLength)\nend\n\nwhen I start as a clone\nswitch costume to (origin v)\nset [analog is clone v] to [1]\nforever\n    if <(canDraw) = [1]> then\n        go to x: (slingXOrigin) y: (slingYOrigin)\n        show\n    else\n        hide\n    end\nend\n\ngo to [front v] layer\n\nforever\nend\n\n@Sprite12\n\nshow\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\nhide\n\n