Adventure || A Platformer

Instructions: Click flag twice and fullscreen is not recommended\n[CHECKPOINTS ARE ONLY IN NORMAL MODE]\n\n~Story:\nYou're an astronaut on a space station orbiting a gas giant when suddenly a wormhole appears, it sends you to the super Saturn (J1407b). The station crashes, will you live another day, you are able to survive until a wormhole appears and whisks you away to another place in the universe.\n\n~ How to play: \nIt's a platformer so use WASD, ARROW, or TOUCH controls to move around. A checkpoint is present. [SPACE TO SKIP CUT SCENES]\n\n~ PART 1 OF STRANDED:\nhttps://scratch.mit.edu/projects/662389359/\n\n----------------- 》Credits《 -----------------\n- @thepugmen ~ for most of the art, code, and sound effects.\n- @Griffpatch ~ scrolling platformer code\n- @CrystalKeeper7 ~ Inspiration art for the cave section\n- @n_bonnie2 ~ text engine \n- Cryo Chamber (on youtube) ~ for all of the music used in-game\n\n----------------- 》Tags《 -----------------\n#platformer #All #Games #Art #story #space #mars #scrolling #mobile #explore #wormhole #blackhole

@Stage\n\nwhen flag clicked\nforever\n    play sound [Unlimited v] until done\nend\n\n@level\n\nwhen flag clicked\npoint in direction (90)\ngo to x: (-10) y: (-500)\nset [d vel v] to [0]\nset [y vel v] to [0]\nforever\n    change [y vel v] by (1)\n    if <<key (right arrow v) pressed?> or <<(mouse x) > (x position)> and <mouse down?>>> then\n        change [d vel v] by (-0.2)\n    end\n    if <<key (left arrow v) pressed?> or <<(x position) > (mouse x)> and <mouse down?>>> then\n        change [d vel v] by (0.2)\n    end\n    set [d vel v] to ((d vel) * (0.8))\n    turn right (d vel) degrees\n    if <touching (player v)?> then\n        change y by (-1)\n        if <touching (player v)?> then\n            change y by (-1)\n            if <touching (player v)?> then\n                change y by (-1)\n                if <touching (player v)?> then\n                    change y by (-1)\n                    if <touching (player v)?> then\n                        change y by (4)\n                        turn right ((d vel) * (-1)) degrees\n                        set [d vel v] to [0]\n                    end\n                end\n            end\n        end\n    end\n    change y by (y vel)\n    if <touching (player v)?> then\n        change y by ((y vel) * (-1))\n        set [y vel v] to [0]\n    end\n    change y by (1)\n    if <touching (player v)?> then\n        if <<key (up arrow v) pressed?> or <<(mouse y) > [50]> and <mouse down?>>> then\n            start sound [Jump v]\n            set [y vel v] to [-12]\n        end\n    end\n    change y by (-1)\nend\n\nwhen I receive [restart v]\npoint in direction (90)\ngo to x: (-10) y: (-500)\nset [d vel v] to [0]\nset [y vel v] to [0]\n\nwhen I receive [next level v]\npoint in direction (90)\ngo to x: (-10) y: (-500)\nset [d vel v] to [0]\nset [y vel v] to [0]\nnext costume\n\nwhen flag clicked\nforever\n    show\nend\n\n@Thumbnail\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    go to x: (0) y: (0)\n    go to [front v] layer\nend\n\n@detector\n\nwhen flag clicked\npoint in direction (90)\nhide\nset [clone id v] to [0]\ncreate clone of (_myself_ v)\nwait (0.2) seconds\nset [clone id v] to [1]\ncreate clone of (_myself_ v)\nwait until <<(LOVED__) = [1]> and <(FAVED___) = [1]>>\nwait (0.5) seconds\nshow\ngo to x: (0) y: (-100)\nreset timer\nswitch costume to (pick random (1) to (4))\nset [ghost v] effect to (100)\ngo [forward v] (2000) layers\nrepeat until <(timer) > [3.5]>\n    change y by ((y position) / (-15))\n    change [ghost v] effect by (-3)\nend\nreset timer\nrepeat until <(timer) > [3.5]>\n    change y by (((y position) - (-100)) / (-15))\n    change [ghost v] effect by (10)\nend\n\nwhen I start as a clone\nif <(clone id) = [0]> then\n    go to x: (-15) y: (0)\n    set [loved__ v] to [0]\n    switch costume to (love v)\n    forever\n        set [love? v] to <touching (mouse-pointer v)?>\n        if <touching (mouse-pointer v)?> then\n            wait (0.2) seconds\n            if <touching (mouse-pointer v)?> then\n                set [loved__ v] to [1]\n            end\n        end\n    end\nend\nif <(clone id) = [1]> then\n    go to x: (0) y: (0)\n    switch costume to (fave v)\n    set [faved___ v] to [0]\n    forever\n        set [fav v] to <touching (mouse-pointer v)?>\n        if <touching (mouse-pointer v)?> then\n            wait (0.2) seconds\n            if <touching (mouse-pointer v)?> then\n                set [faved___ v] to [1]\n            end\n        end\n    end\nend\n\n@Online Multiplayer Engine 2.0 by XShrunk\n\ndefine Init\ndelete all of [@players v]\ndelete all of [@ids v]\ndelete all of [@playeroffset v]\ndelete all of [#checkactive v]\ndelete all of [#checkvalue v]\ndelete all of [#cloudlist v]\ndelete all of [clouddata v]\nadd (join [=] (☁ Cloud1)) to [clouddata v]\nadd (join [=] (☁ Cloud2)) to [clouddata v]\nadd (join [=] (☁ Cloud3)) to [clouddata v]\nadd (join [=] (☁ Cloud4)) to [clouddata v]\nadd (join [=] (☁ Cloud5)) to [clouddata v]\nadd (join [=] (☁ Cloud6)) to [clouddata v]\nadd (join [=] (☁ Cloud7)) to [clouddata v]\nadd (join [=] (☁ Cloud8)) to [clouddata v]\nset [@id v] to (([floor v] of ((days since 2000) * (100000000)) ) mod (1000))\nset [sending v] to [0]\n\ndefine Process Cloud (id) (var)\nif <(var) = (item (id) of [clouddata v])> then\n    stop [this script v]\nend\nreplace item (id) of [clouddata v] with (var)\nDecode (var)\nif <<(item (2) of [decoded v]) = (username)> and <(item (5) of [decoded v]) = (@ID)>> then\n    stop [this script v]\nend\nFind Player (item (2) of [decoded v]) (item (5) of [decoded v])\nif <(~i) = [0]> then\n    set [~i v] to (item # of [] in [@players v])\n    if <(~i) = [0]> then\n        New Player\n    else\n        replace item (~i) of [@players v] with (item (2) of [decoded v])\n        replace item (~i) of [@ids v] with (item (5) of [decoded v])\n    end\nend\nset [~j v] to [1]\nrepeat (length of [decoded v])\n    replace item ((((~i) - (1)) * (&MaxElements)) + (~j)) of [#cloudlist v] with (item (~j) of [decoded v])\n    change [~j v] by (1)\nend\n\ndefine Read Cloud\nProcess Cloud [1] (join [=] (☁ Cloud1))\nProcess Cloud [2] (join [=] (☁ Cloud2))\nProcess Cloud [3] (join [=] (☁ Cloud3))\nProcess Cloud [4] (join [=] (☁ Cloud4))\nProcess Cloud [5] (join [=] (☁ Cloud5))\nProcess Cloud [6] (join [=] (☁ Cloud6))\nProcess Cloud [7] (join [=] (☁ Cloud7))\nProcess Cloud [8] (join [=] (☁ Cloud8))\n\ndefine Decode (clouddata)\ndelete all of [decoded v]\nset [~temp v] to []\nset [~i v] to [2]\nrepeat (((length of (clouddata)) - (1)) / (2))\n    switch costume to (join (letter (~i) of (clouddata)) (letter ((~i) + (1)) of (clouddata)))\n    if <(costume [number v]) = [1]> then\n        add (~temp) to [decoded v]\n        set [~temp v] to []\n    else\n        set [~temp v] to (join (~temp) (costume [name v]))\n    end\n    change [~i v] by (2)\nend\n\ndefine Encode\nset [~temp v] to []\nset [~i v] to [1]\nrepeat (length of [#playerlist v])\n    set [~j v] to [1]\n    repeat (length of (item (~i) of [#playerlist v]))\n        switch costume to (letter (~j) of (item (~i) of [#playerlist v]))\n        if <(costume [number v]) < [10]> then\n            set [~temp v] to (join (~temp) (join [0] (costume [number v])))\n        else\n            set [~temp v] to (join (~temp) (costume [number v]))\n        end\n        change [~j v] by (1)\n    end\n    set [~temp v] to (join (~temp) [01])\n    change [~i v] by (1)\nend\n\ndefine SaveToCloud (playerid)\nSavePlayer\nEncode\nif <(playerid) < [6]> then\n    if <(playerid) < [3]> then\n        if <(playerid) = [1]> then\n            set [☁ cloud1 v] to (~temp)\n        else\n            set [☁ cloud2 v] to (~temp)\n        end\n    else\n        if <(playerid) = [3]> then\n            set [☁ cloud3 v] to (~temp)\n        else\n            if <(playerid) = [4]> then\n                set [☁ cloud4 v] to (~temp)\n            else\n                set [☁ cloud5 v] to (~temp)\n            end\n        end\n    end\nelse\n    if <(playerid) < [8]> then\n        if <(playerid) = [6]> then\n            set [☁ cloud6 v] to (~temp)\n        else\n            set [☁ cloud7 v] to (~temp)\n        end\n    else\n        if <(playerid) = [8]> then\n            set [☁ cloud8 v] to (~temp)\n        end\n    end\nend\n\nwhen I receive [update v]\nUpdatePlayersList [1]\nRead Cloud\nSaveToCloud (pick random (1) to (length of [clouddata v]))\nUpdatePlayersList [0]\nCountPlayers\n\ndefine CountPlayers\nset [#playersonline v] to [1]\nset [~i v] to [1]\nrepeat (length of [@players v])\n    if <(item (~i) of [#checkactive v]) = [1]> then\n        change [#playersonline v] by (1)\n    end\n    change [~i v] by (1)\nend\nif <(#PlayersOnline) > [1]> then\n    hide\nelse\n    if <(username) = []> then\n        switch costume to (log in v)\n    else\n        if <(☁ Online) = [0]> then\n            switch costume to (new v)\n        else\n            switch costume to (alone v)\n        end\n    end\n    show\nend\ngo to [front v] layer\nif <(☁ Online) < [0]> then\n    switch costume to (offline v)\n    show\n    stop [all v]\nend\nif <<not <(Version) = (☁ Online)>> and <(☁ Online) > [0]>> then\n    switch costume to (update v)\n    show\n    stop [all v]\nend\n\nwhen I receive [init v]\nInit\n\ndefine UpdatePlayersList (first)\nif <(first) = [1]> then\n    set [~c v] to [0]\n    repeat (length of [@players v])\n        if <not <<(item (((~c) * (&MaxElements)) + (2)) of [#cloudlist v]) = (username)> and <(item (((~c) * (&MaxElements)) + (5)) of [#cloudlist v]) = (@ID)>>> then\n            if <(item ((~c) + (1)) of [@playeroffset v]) = [0]> then\n                replace item ((~c) + (1)) of [#checkvalue v] with (item (((~c) * (&MaxElements)) + (1)) of [#cloudlist v])\n            end\n            replace item ((~c) + (1)) of [@playeroffset v] with ((item ((~c) + (1)) of [@playeroffset v]) + (1))\n        end\n        change [~c v] by (1)\n    end\nelse\n    set [~c v] to [0]\n    repeat (length of [@players v])\n        if <not <<(item (((~c) * (&MaxElements)) + (2)) of [#cloudlist v]) = (username)> and <(item (((~c) * (&MaxElements)) + (5)) of [#cloudlist v]) = (@ID)>>> then\n            if <<not <(item ((~c) + (1)) of [#checkvalue v]) = (item (((~c) * (&MaxElements)) + (1)) of [#cloudlist v])>> or <(item ((~c) + (1)) of [@playeroffset v]) > [99]>> then\n                if <<(item ((~c) + (1)) of [#checkvalue v]) = (item (((~c) * (&MaxElements)) + (1)) of [#cloudlist v])> or <(item (((~c) * (&MaxElements)) + (5)) of [#cloudlist v]) = [X]>> then\n                    replace item ((~c) + (1)) of [#checkactive v] with [0]\n                    replace item ((~c) + (1)) of [@players v] with []\n                    replace item ((~c) + (1)) of [@ids v] with []\n                else\n                    replace item ((~c) + (1)) of [#checkactive v] with [1]\n                end\n                replace item ((~c) + (1)) of [@playeroffset v] with [0]\n            end\n        end\n        change [~c v] by (1)\n    end\nend\n\ndefine EmptyCloud\nset [☁ cloud1 v] to [0]\nwait (0.1) seconds\nset [☁ cloud2 v] to [0]\nwait (0.1) seconds\nset [☁ cloud3 v] to [0]\nwait (0.1) seconds\nset [☁ cloud4 v] to [0]\nwait (0.1) seconds\nset [☁ cloud5 v] to [0]\nwait (0.1) seconds\nset [☁ cloud6 v] to [0]\nwait (0.1) seconds\nset [☁ cloud7 v] to [0]\nwait (0.1) seconds\nset [☁ cloud8 v] to [0]\n\nwhen flag clicked\nInit\nhide\nset [version v] to [1]\nif <(username) = [arlfifa]> then\n    wait (0.1) seconds\n    set [☁ online v] to (Version)\nend\nif <(#PlayersOnline) > [0]> then\n    replace item (5) of [#playerlist v] with [X]\n    repeat (10)\n        SaveToCloud (pick random (1) to (length of [clouddata v]))\n    end\nend\nset [#playersonline v] to [0]\nset [sending v] to [1]\n\ndefine SavePlayer\ndelete all of [#playerlist v]\nadd (~Tick) to [#playerlist v]\nadd (username) to [#playerlist v]\nadd ((round (([direction v] of [level v]) * (10))) / (10)) to [#playerlist v]\nadd ((round (([y position v] of [level v]) * (10))) / (10)) to [#playerlist v]\nadd (@ID) to [#playerlist v]\n\nset [&maxelements v] to [5]\n\nset [☁ online v] to [0]\n\ndefine New Player\nadd (item (2) of [decoded v]) to [@players v]\nadd (item (5) of [decoded v]) to [@ids v]\nadd [0] to [@playeroffset v]\nadd [0] to [#checkactive v]\nadd [0] to [#checkvalue v]\nrepeat (&MaxElements)\n    add [0] to [#cloudlist v]\nend\ncreate clone of (playersonline v)\n\ndefine Find Player (name) (id)\nset [~i v] to [0]\nrepeat (length of [@players v])\n    change [~i v] by (1)\n    if <<(item (~i) of [@players v]) = (name)> and <(item (~i) of [@ids v]) = (id)>> then\n        stop [this script v]\n    end\nend\nset [~i v] to [0]\n\n@Player\n\nwhen flag clicked\ngo to x: (0) y: (0)\n\nwhen I receive [respawn v]\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\nwhen flag clicked\nforever\n    change y by (-5)\n    if <touching color (#ff0000)?> then\n        broadcast (Restart v)\n    end\n    change y by (5)\nend\n\nwhen flag clicked\nif <touching color (#00ff9c)?> then\n    broadcast (you won v)\nend\n\n