Balloonacy: A Classic Platformer

Instructions: - - -- - - -Mine a Multiplayer Scrolling Platformer - - - - - \nHow to play\n➡ Use Arrow keys, WASD, or tap to use (Mobile)\n➡ Watch out for spikes, lava, and saws\n➡ Press the chat button to open the chat and press space to close it\n➡ Press the shop button to open the shop and press space to close it\n\nIf laggy use Turbo wrap --  https://turbowarp.org/588729334\n\nOther info\n➡ New Scratchers Can not Play online.\n➡ Collect coins to buy skins and powerups from the\nshop.\n➡ Total collectable coins is 32\n➡ @x_PlatformMaker_x loved and faved\n➡ @Nethula_manumitha loved\n➡ @Weirdify loved and faved\n

@Stage\n\nwhen flag clicked\nforever\n    switch backdrop to (level)\nend\n\nwhen flag clicked\nforever\n    play sound [Green Trill Zone - Sonic Remix v] until done\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        start sound (pick random (1) to (3))\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        if <<(level) = [11]> or <(level) = [15]>> then\n            change [deaths on hard level v] by (1)\n        end\n        Respawn [-210] [0]\n    end\n    switch costume to (angry bird v)\nend\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 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            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            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\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]\n\nset size to (100) %\n\nwhen flag clicked\ngo to [front v] layer\nforever\n    if <<touching (sprite1 v)?> or <(y position) < [-180]>> then\n        broadcast (knucks v)\n        start sound [Sonic Scream2 v]\n        Respawn [-200] [100]\n        change [deaths v] by (1)\n    end\nend\n\nwhen flag clicked\nforever\n    if <<(x position) > [240]> and <not <(level) = [12]>>> then\n        change [level v] by (1)\n        broadcast (Next Level v) and wait\n        Respawn [-200] [100]\n    end\nend\n\nwhen I receive [skip v]\nRespawn [-210] [0]\nchange [level v] by (1)\n\n@Platforms\n\nwhen flag clicked\nset [level v] to [1]\nforever\n    switch costume to (level)\nend\n\nset [level v] to [1]\n\n@Exit\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\nwhen I receive [knucks v]\nif <<<(level) = [4]> or <(level) = [7]>> or <(level) = [12]>> then\n    play sound [_Do I look like I need YOUR Power__2 v] until done\nend\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@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\n@Sprite2\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\nhide\n\nshow\n\n