Stranded 3 | Scrolling Platformer

Instructions: Gobo's world ✦ Multiplayer cloud scrolling platformer\n> comment down _gobo_\n\nif the "play" button doesn't disappear, press green flag again\n\nRESHARED 03/24/2020\n\n✦ INSTRUCTIONS: (readme)\narrow keys or tap to move\nt to chat\nn to toggle other players name\nr to restart\n\nThere are 4 hidden stations. How many of them could you find?\nCould you finish the whole game?\n\n✦ INFORMATION: You are playing as Gobo and are travelling through different biomes. On your way there are 4 hidden stations where you can change your player into another member of the "Scratch family" (Nano, Giga etc). \n\nIf you choose "Multiplayer", you can see other players playing and you are able to chat with them. If you choose "Singleplayer", you can't see other players (and other players can't see you) and you can't chat with them.\n\n✦ FAQ\n(frequently asked questions)\n\nQ: Can I chat on mobile?\nA: Sorry but no\n\nQ: Can I use turbo mode?\nA: Of course no\n\nQ: I can't see anyone\nA: Only you are playing or you chose "Singleplayer" or you're still a New Scratcher\n\nQ: Can you check out my game?\nA: Please don't advertise (lol)\n\nmade of 2500+ blocks\n\nCredits ©\nMusic: @-xaf- Plugged and @-xaf- Kaled FOLLOW HIM! He makes awesome music\nMusic: Tobu Candyland\nMusic: Some sounds are borrowed from @Lucasliu9595\nGobo / Nano / Giga / Tera art from Scratch Sprite Library\nAll other art by me\nGobo walk animation in the beginning by @yukss\nBasic multiplayer cloud engine by @cloud-mutliplayer\nThanks to @griffpatch's scrolling platformer tutorial on YouTube\nAll other code by me\n\nEnjoy!

@Stage\n\nwhen flag clicked\nforever\n    play sound [Wallpaper v] until done\nend\n\n@Blank\n\n@Player\n\ndefine wall sensing bug\nif <<touching (ground v)?> or <touching (movin platformer v)?>> then\n    change y by (1)\nend\n\ndefine reset\nset [xvel v] to [0]\nset [yvel v] to [0]\ngo to x: (-216) y: (40)\n\nwhen I receive [next level v]\nreset\n\ndefine setup platformer\nset [health v] to [7]\nset [gravity v] to [10]\nset [jump force v] to [15]\nset [speed v] to [1.5]\nset [scene v] to [1]\n\nwhen I receive [run v]\nforever\n    Show Health (health) of [7] offset y [-40]\n    if <(health) < [1]> then\n        start sound [thump soft v]\n        broadcast (__Screen Wipe v)\n        set [scene v] to [1]\n        set [health v] to [7]\n    end\n    left and right controls\n    wall sensing bug\n    wall sensing bug\n    wall sensing bug\n    wall sensing bug\n    walljumping/sensing\n    wall sensing\n    jumping\n    if <(x position) > [239]> then\n        broadcast (__Screen Wipe v)\n        broadcast (Next Level v) and wait\n        change [scene v] by (1)\n    end\n    if <<touching (lava v)?> or <touching (spikes v)?>> then\n        start sound [Wood Tap v]\n        change [health v] by (-1)\n        reset\n    end\n    if <touching (trampoline v)?> then\n        start sound [jump1 v]\n        set [yvel v] to [20]\n    end\nend\n\ndefine left and right controls\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(x position) > (mouse x)>>> then\n    change [xvel v] by ((speed) - ((speed) * (2)))\n    set [direction v] to [-90]\nend\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n    change [xvel v] by (speed)\n    set [direction v] to [90]\nend\nset [xvel v] to ((xvel) * (0.85))\nchange x by (xvel)\n\ndefine walljumping/sensing\nif <<touching (ground v)?> or <touching (movin platformer v)?>> then\n    change y by (-4)\n    change x by ((xvel) * (-1))\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> then\n        if <(xvel) > ((gravity) + ((gravity) - ((gravity) * (2))))> then\n            set [xvel v] to (round ((gravity) - ((gravity) * (2))))\n        else\n            set [xvel v] to (round (gravity))\n        end\n        set [yvel v] to ((gravity) + ((gravity) - ((gravity) / (2))))\n    else\n        set [xvel v] to ((gravity) + ((gravity) - ((gravity) * (2))))\n    end\nend\n\ndefine wall sensing\nchange [yvel v] by ((((gravity) + ((gravity) - ((gravity) * (2)))) + (1)) * (-1))\nchange y by (yvel)\nif <<touching (ground v)?> or <touching (movin platformer v)?>> then\n    change y by ((yvel) - ((yvel) * (2)))\n    set [yvel v] to ((gravity) + ((gravity) - ((gravity) * (2))))\nend\nchange y by (-1)\n\ndefine jumping\nif <<<touching (ground v)?> or <touching (movin platformer v)?>> and <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n    start sound [jump1 v]\n    set [yvel v] to (jump force)\nend\nchange y by (1)\n\nwhen I receive [run v]\nforever\n    broadcast (forever loop v)\nend\n\nwhen I receive [forever loop v]\npoint in direction (direction)\nset [x v] to (round (x position))\nset [y v] to (round (y position))\n\ndefine Show Health (health) of (max) offset y (y)\nadd (x position) to [healths v]\nadd ((y position) + (y)) to [healths v]\nadd ((health) / (max)) to [healths v]\ncreate clone of (health bar v)\n\nwhen flag clicked\nforever\n    switch costume to ([costume name v] of [thanks v])\nend\n\nwhen I receive [reset v]\nreset\n\nwhen flag clicked\nshow\ndelete all of [healths v]\nset rotation style [left-right v]\nreset\nsetup platformer\nbroadcast (run v)\nbroadcast (Next Level v)\n\n@Ground\n\nwhen flag clicked\nshow\nforever\n    switch costume to (Scene)\nend\n\nwhen flag clicked\nforever\n    if <(costume [number v]) = [15]> then\n        broadcast (eliminate skip v)\n    end\nend\n\n@Spikes\n\nwhen flag clicked\nforever\n    switch costume to (Scene)\nend\n\n@Thanks\n\nwhen flag clicked\nhide\nwait (1) seconds\nwait until <(Actions \(love/fave\)) = [2]>\nwait (1) seconds\nshow\ngo to x: (0) y: (50)\nreset timer\ngo to [front v] layer\nswitch costume to (red v)\nset [ghost v] effect to (100)\nrepeat until <(timer) > [3.5]>\n    change y by ((y position) / (-15))\n    change [ghost v] effect by (-3)\nend\nswitch costume to (blue v)\nreset timer\nrepeat until <(timer) > [3.5]>\n    change y by (((y position) - (-100)) / (-15))\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen flag clicked\nswitch costume to (red v)\n\n@Detector\n\nwhen flag clicked\nshow\nset [ghost v] effect to (100)\nset [actions \(love/fave\) v] to [0]\nforever\n    set [touching v] to [none]\n    Detect [love] at [-201] [-220]\n    Detect [fave] at [-201] [-220]\nend\n\ndefine Detect (thing) at (x) (y)\nswitch costume to (empty v)\nset size to (27000) %\ngo to x: (x) y: (y)\nset size to (100) %\nswitch costume to (thing)\nif <touching (mouse-pointer v)?> then\n    set [touching v] to (costume [name v])\nend\n\nwhen flag clicked\nforever\n    wait until <(touching) = [love]>\n    wait (0.2) seconds\n    if <(touching) = [love]> then\n        change [actions \(love/fave\) v] by (1)\n        stop [this script v]\n    end\nend\n\nwhen flag clicked\nforever\n    wait until <(touching) = [fave]>\n    wait (0.2) seconds\n    if <(touching) = [fave]> then\n        change [actions \(love/fave\) v] by (1)\n        stop [this script v]\n    end\nend\n\n@Love and fave reminder\n\nwhen flag clicked\nwait (5) seconds\ngo to [front v] layer\n\nwhen flag clicked\nhide\nwait (1) seconds\nforever\n    if <(Actions \(love/fave\)) < [2]> then\n        switch costume to (costume1 v)\n        go to x: (0) y: (150)\n        show\n        go to [front v] layer\n        start sound [High Whoosh v]\n        repeat (11)\n            change y by (-6)\n        end\n        repeat (7)\n            change y by (3)\n        end\n        repeat (6)\n            change y by (-2)\n        end\n        wait (5) seconds\n        start sound [High Whoosh v]\n        repeat (17)\n            change y by (7)\n        end\n        hide\n        wait (pick random (10) to (20)) seconds\n    else\n        stop [this script v]\n    end\nend\n\n@Particles\n\nwhen I start as a clone\nrepeat until <touching (_edge_ v)?>\n    change x by (5)\n    change y by (5)\nend\ndelete this clone\n\nwhen flag clicked\nhide\n\nwhen I receive [eliminate skip v]\nshow\n\nwhen flag clicked\nforever\n    set size to (pick random (120) to (70)) %\n    go to x: (pick random (-233) to (40)) y: (pick random (-165) to (-90))\n    create clone of (_myself_ v)\nend\n\n@Health Bar\n\nwhen flag clicked\ngo [backward v] (213) layers\nhide\ndelete all of [healths v]\n\nwhen I start as a clone\nset x to (item (1) of [healths v])\nset y to (item (2) of [healths v])\nswitch costume to ((10) * (item (3) of [healths v]))\ndelete (1) of [healths v]\ndelete (1) of [healths v]\ndelete (1) of [healths v]\nif <not <touching (_edge_ v)?>> then\n    show\n    wait (0) seconds\nend\ndelete this clone\n\ndefine Show Health (health) of (max) offset y (y)\nadd (x position) to [healths v]\nadd ((y position) + (y)) to [healths v]\nadd ((health) / (max)) to [healths v]\ncreate clone of (health bar v)\n\nwhen flag clicked\ngo to [back v] layer\nwait (8) seconds\ngo to [front v] layer\n\nwhen flag clicked\nhide\n\nwhen I receive [eliminate skip v]\nhide\n\n@Thumbnail2\n\nwhen flag clicked\ngo to x: (0) y: (0)\nclear graphic effects\ngo to [front v] layer\nshow\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\n