Scratch cat's Platformer MMO
@Stage\n\nwhen I receive [change scene v]\nif <<(SCENE #) > [33]> and <(SCENE #) < [40]>> then\n    switch backdrop to (backdrop2 v)\nelse\n    switch backdrop to (backdrop1 v)\nend\nif <<(SCENE #) > [40]> and <(SCENE #) < [70]>> then\n    set [resistance v] to [0.97]\nelse\n    set [resistance v] to [0.86]\nend\n\n@Cloud Player\n\ndefine Write Number (val) to encoded string\nset [val v] to (round (val))\nif <(val) < [0]> then\n    set [val v] to (join [0] ([abs v] of (val) ))\nend\nset [encoded string v] to (join (encoded string) (join (length of (val)) (val)))\n\ndefine val = READ NUMBER from "encoded string"\nset [val v] to []\nrepeat (letter (encoded idx) of (encoded string))\n    change [encoded idx v] by (1)\n    set [val v] to (join (val) (letter (encoded idx) of (encoded string)))\nend\nchange [encoded idx v] by (1)\nif <(letter (1) of (val)) = [0]> then\n    set [val v] to ((0) - (val))\nend\n\nwhen I receive [cloud - setup v]\nhide\nset [cloud tick v] to [0]\nset [player # v] to []\ndelete all of [player uids v]\ndelete all of [player data v]\ndelete all of [cloud values v]\ndelete all of [my values to send v]\nadd (join [c] (☁ CLOUD 1)) to [cloud values v]\nadd (join [c] (☁ CLOUD 2)) to [cloud values v]\nadd (join [c] (☁ CLOUD 3)) to [cloud values v]\nadd (join [c] (☁ CLOUD 4)) to [cloud values v]\nadd (join [c] (☁ CLOUD 5)) to [cloud values v]\nadd (join [c] (☁ CLOUD 6)) to [cloud values v]\nadd (join [c] (☁ CLOUD 7)) to [cloud values v]\nadd (join [c] (☁ CLOUD 8)) to [cloud values v]\nset [my player uid v] to (pick random (1) to (9999999))\n\nwhen I receive [cloud - tick v]\nif <(player #) > []> then\n    Player Clone tick\n    stop [this script v]\nend\nchange [cloud tick v] by (1)\nProcess cloud [1] value (join [c] (☁ CLOUD 1))\nProcess cloud [2] value (join [c] (☁ CLOUD 2))\nProcess cloud [3] value (join [c] (☁ CLOUD 3))\nProcess cloud [4] value (join [c] (☁ CLOUD 4))\nProcess cloud [5] value (join [c] (☁ CLOUD 5))\nProcess cloud [6] value (join [c] (☁ CLOUD 6))\nProcess cloud [7] value (join [c] (☁ CLOUD 7))\nProcess cloud [8] value (join [c] (☁ CLOUD 8))\nSend my Cloud Data after [4] ticks\n\ndefine Send my Cloud Data after (count) ticks\nif <((CLOUD TICK) mod (count)) > [0]> then\n    stop [this script v]\nend\nset [encoded string v] to []\nWrite Number (MY PLAYER UID) to encoded string\nrepeat (length of [my values to send v])\n    Write Number (item (1) of [my values to send v]) to encoded string\n    delete (1) of [my values to send v]\nend\nset [my channel v] to (pick random (1) to (length of [cloud values v]))\nif <(MY CHANNEL) < [5]> then\n    if <(MY CHANNEL) < [3]> then\n        if <(MY CHANNEL) < [2]> then\n            set [☁ cloud 1 v] to (encoded string)\n        else\n            set [☁ cloud 2 v] to (encoded string)\n        end\n    else\n        if <(MY CHANNEL) < [4]> then\n            set [☁ cloud 3 v] to (encoded string)\n        else\n            set [☁ cloud 4 v] to (encoded string)\n        end\n    end\nelse\n    if <(MY CHANNEL) < [7]> then\n        if <(MY CHANNEL) < [6]> then\n            set [☁ cloud 5 v] to (encoded string)\n        else\n            set [☁ cloud 6 v] to (encoded string)\n        end\n    else\n        if <(MY CHANNEL) < [8]> then\n            set [☁ cloud 7 v] to (encoded string)\n        else\n            set [☁ cloud 8 v] to (encoded string)\n        end\n    end\nend\n\ndefine Process cloud (which?) value (new value)\nif <(new value) = (item (which?) of [cloud values v])> then\n    stop [this script v]\nend\nreplace item (which?) of [cloud values v] with (new value)\nset [encoded string v] to (new value)\nset [encoded idx v] to [2]\nval = READ NUMBER from "encoded string"\nif <<(val) < [1]> or <(val) = (MY PLAYER UID)>> then\n    stop [this script v]\nend\nset [player # v] to (item # of (val) in [player uids v])\nif <(player #) = [0]> then\n    set [player # v] to (item # of [] in [player uids v])\n    if <(player #) = [0]> then\n        add (val) to [player uids v]\n        add [] to [player data v]\n        set [player # v] to (length of [player data v])\n        create clone of (_myself_ v)\n    else\n        replace item (player #) of [player uids v] with (val)\n    end\nend\nreplace item (player #) of [player data v] with (new value)\nset [player # v] to []\n\ndefine Player Clone tick\nset [color v] effect to (90)\nset rotation style [left-right v]\nif <(encoded idx) > (length of (encoded string))> then\n    Get next Data Packet\n    if <(encoded string) = []> then\n        change [inactive v] by (1)\n        if <(inactive) > [150]> then\n            replace item (player #) of [player uids v] with []\n            hide\n        end\n        stop [this script v]\n    end\n    show\nend\nset [inactive v] to [0]\nval = READ NUMBER from "encoded string"\nset x to (val)\nval = READ NUMBER from "encoded string"\nset y to (val)\nval = READ NUMBER from "encoded string"\nswitch costume to (val)\nval = READ NUMBER from "encoded string"\nset [cloud scene # v] to (val)\nval = READ NUMBER from "encoded string"\npoint in direction (val)\nif <not <(CLOUD SCENE #) = (SCENE #)>> then\n    switch costume to (offscreen v)\n    if <(CLOUD SCENE #) < (SCENE #)> then\n        set x to (-233)\n    else\n        set x to (233)\n    end\nend\n\ndefine Get next Data Packet\nset [encoded string v] to (item (player #) of [player data v])\nreplace item (player #) of [player data v] with []\nset [encoded idx v] to [2]\nval = READ NUMBER from "encoded string"\n\nwhen I receive [lose life v]\nset [st time v] to [1]\nwait until <([abs v] of (round ([sx v] of [player v])) ) > [0.1]>\nset [st time v] to [0]\n\nwhen I receive [init time v]\nset [time v] to [0.000]\nset [st time v] to [1]\nwait until <([abs v] of (round ([sx v] of [player v])) ) > [0.1]>\nset [st time v] to [0]\n\nwhen I receive [tick - first v]\nif <(st time) < [1]> then\n    change [time v] by (0.033)\nend\n\nwhen I receive [stop time v]\nset [st time v] to [1]\n\n@Player\n\ndefine Squish (force)\nrepeat (14)\n    change [fisheye v] effect by ((speed y) * (-2.5))\n    change [speed y v] by ((force) / (14))\nend\nstart sound [Boing v]\nset [fisheye v] effect to (-20)\n\nwhen flag clicked\nset [gravity v] to [ -1.3]\nset [resistance v] to [0.86]\nset [jump force v] to [15]\nset [acceleration v] to [1]\nset [jump duration v] to [6]\nbroadcast (Setup v) and wait\nset [spawn scene v] to [1]\nset [spawn x v] to [-150]\nset [spawn y v] to [55]\nReset and begin level\nbroadcast (init time v)\nbroadcast (Cloud - Setup v) and wait\n\ndefine Cloud - Tick\nadd (x position) to [my values to send v]\nadd (y position) to [my values to send v]\nadd (costume [number v]) to [my values to send v]\nadd (SCENE #) to [my values to send v]\nadd (direction) to [my values to send v]\nbroadcast (Cloud - Tick v)\n\ndefine move in steps (steps)\nchange [falling v] by (1)\nrepeat (steps)\n    set [last value v] to (x position)\n    change x by ((sx) / (steps))\n    Check touching solid\n    if <(touching) > [0]> then\n        Collide X - Slope or Wall\n    end\n    set [last value v] to (y position)\n    change y by ((sy) / (steps))\n    Check touching solid\n    if <(touching) > [0]> then\n        Collide Y - Ceiling or Floor \n    end\nend\n\ndefine Check touching solid\nif  then\n    set [touching v] to [1]\nelse\n    set [touching v] to [0]\nend\n\nwhen I receive [tick - player v]\nControls - Up and down\nControls - Left and Right\nmove in steps (([abs v] of (sy) ) + ([abs v] of (sx) ))\nSet Costume\nCloud - Tick\n\ndefine Controls - Up and down\nif <([speed jump v] of [contols v]) > [0]> then\n    change [sy v] by (-0.5)\nend\nif <([up v] of [contols v]) > [0]> then\n    if <<(wall slide) > [0]> and <(jumping) = [0]>> then\n        set [jumping v] to [1]\n        set [falling v] to [3]\n        set [wall slide v] to [0]\n        turn right (180) degrees\n        set [sx v] to (((direction) / (90)) * (7))\n        set [long jump v] to [12]\n    end\n    if <(falling) < [3]> then\n        set [jumping v] to [1]\n        set [falling v] to [3]\n    end\n    if <<(jumping) > [0]> and <(jumping) < (JUMP DURATION)>> then\n        change [jumping v] by (1)\n        set [sy v] to (JUMP FORCE)\n    end\nelse\n    set [jumping v] to [0]\nend\nchange [sy v] by (GRAVITY)\nif <(wall slide) > [0]> then\n    Check can Wall slide\n    if <(sy) < [0]> then\n        set [sy v] to ((sy) * (0.7))\n    end\nend\n\ndefine Controls - Left and Right\nif <([speed jump v] of [contols v]) > [0]> then\n    set [sx v] to (((direction) / (11.5)) + ((sx) / (2)))\nend\nif <(long jump) > [0]> then\n    change [long jump v] by (-1)\n    stop [this script v]\nend\nset [key x v] to (([right v] of [contols v]) - ([left v] of [contols v]))\nif <(KEY X) = [0]> then\n    if <<(falling) > [2]> and <(wall slide) < [1]>> then\n        set [sx v] to ((sx) * (0.97))\n        stop [this script v]\n    end\n    if <([abs v] of (sx) ) < [1]> then\n        set [frame v] to [0]\n        set [sx v] to [0]\n    else\n        change [frame v] by (0.5)\n    end\nelse\n    if <([down v] of [contols v]) < [1]> then\n        change [sx v] by ((KEY X) * (ACCELERATION))\n        point in direction ((KEY X) * (90))\n        change [frame v] by (1)\n    end\nend\nset [sx v] to ((sx) * (RESISTANCE))\n\ndefine Reset and begin level\nset [sx v] to [0]\nset [sy v] to [0]\nset [falling v] to [99]\nset [scene # v] to [1]\nset [wall slide v] to [0]\nset [jumping v] to [0]\nset [long jump v] to [0]\npoint in direction (90)\nset size to (47) %\nBegin Scene # (SPAWN SCENE) go to x, y: (SPAWN X) (SPAWN Y)\n\nwhen I receive [game loop v]\nset [ghost v] effect to (0)\nforever\n    broadcast (Tick - First v)\n    broadcast (Tick - Player v)\n    broadcast (Tick - Last v)\nend\n\nwhen I receive [tick - last v]\nif <(x position) > [235]> then\n    Begin Scene # ((SCENE #) + (1)) go to x, y: [-235] []\nend\nif <(x position) < [-235]> then\n    Begin Scene # ((SCENE #) + (-1)) go to x, y: [235] []\nend\n\ndefine Begin Scene # (scene #) go to x, y: (x) (y)\nset [scene # v] to (scene #)\nif <(x) > []> then\n    set x to (x)\nend\nif <(y) > []> then\n    set y to (y)\nend\nbroadcast (Change Scene v)\nstop [other scripts in sprite v]\nwait (0) seconds\nswitch costume to (hitbox v2 v)\nset rotation style [don't rotate v]\nif <(x) > []> then\n    Fix collision in direction [0]\nelse\n    Fix collision in direction [90]\nend\nSet Costume\nbroadcast (Game loop v)\n\ndefine Fix collision in direction (dir )\nset [temp v] to (direction)\nset [distance v] to [1]\npoint in direction (dir )\nrepeat (128)\n    Check touching solid\n    if <(touching) < [1]> then\n        point in direction (temp)\n        stop [this script v]\n    end\n    move (distance) steps\n    turn right (180) degrees\n    change [distance v] by (1)\nend\n\nwhen I receive [tick - first v]\nswitch costume to (hitbox v2 v)\nset rotation style [don't rotate v]\nif <touching (danger v)?> then\n    broadcast (Lose Life v)\nend\n\ndefine Set Costume\nset rotation style [left-right v]\nif <(wall slide) > [0]> then\n    switch costume to (hangon01 v)\n    stop [this script v]\nend\nif <([speed jump v] of [contols v]) > [0]> then\n    switch costume to (glide v)\n    stop [this script v]\nend\nif <(roll) > [0]> then\n    change [roll frame v] by (1)\n    switch costume to ((39) + (([floor v] of (roll frame) ) mod (4)))\n    if <(roll frame) < [7]> then\n        change [sx v] by ((direction) / (9))\n    end\n    if <(roll frame) > [20]> then\n        set [roll v] to [0]\n    end\n    stop [this script v]\nend\nif <([held key down v] of [contols v]) > [0]> then\n    if <([held key down v] of [contols v]) = [1]> then\n        set [crouch v] to [5]\n    end\n    if <(crouch) > [1]> then\n        switch costume to (join [crouch] ([ceiling v] of (crouch) ))\n        change [crouch v] by (-0.7)\n    end\n    if <(crouch) < [1]> then\n        set [crouch v] to [0]\n        if <key (down arrow v) pressed?> then\n            switch costume to (crouch1 v)\n        else\n            set [crouch v] to [0]\n        end\n    end\n    if <([roll v] of [contols v]) > [0]> then\n        if <(roll frame) = [0]> then\n            set [roll v] to [1]\n            set [roll frame v] to [0]\n        end\n    else\n        set [roll v] to [0]\n    end\n    stop [this script v]\nend\nif <(falling) > [1]> then\n    if <(sy) > [0]> then\n        switch costume to (jump01 v)\n    else\n        switch costume to (run_j2 v)\n    end\n    stop [this script v]\nend\nif <(frame) > [0]> then\n    switch costume to ((1) + (([floor v] of (frame) ) mod (16)))\nelse\n    switch costume to (hit angle 0 v)\n    repeat (5)\n        Check touching solid\n        if <(touching) < [1]> then\n            switch costume to ((costume [number v]) + (5))\n            stop [this script v]\n        end\n        next costume\n    end\n    switch costume to (stand v)\nend\n\ndefine Collide X - Slope or Wall\nCheck can Wall slide\nchange y by (1)\nCheck touching solid\nif <(touching) > [0]> then\n    change y by (1)\n    Check touching solid\n    if <(touching) > [0]> then\n        change y by (-2)\n        set x to (last value)\n        set [sx v] to [0]\n        stop [this script v]\n    end\n    set [sx v] to ((sx) * (0.9))\nend\nset [sx v] to ((sx) * (0.94))\nSlip\n\ndefine Collide Y - Ceiling or Floor \nset y to (last value)\nif <(sy) > [0]> then\n    set [sy v] to [0]\n    stop [this script v]\nend\nif <(falling) > [0]> then\n    set [falling v] to [0]\n    Slip\nend\nset [sy v] to ((sy) * (0.85))\n\ndefine Slip\nchange y by (-2)\nchange x by (1)\nCheck touching solid\nif <(touching) < [1]> then\n    set [falling v] to [9]\n    change [sx v] by (1)\n    stop [this script v]\nend\nchange x by (-2)\nCheck touching solid\nif <(touching) < [1]> then\n    set [falling v] to [9]\n    change [sx v] by (-1)\n    stop [this script v]\nend\nchange y by (2)\nchange x by (1)\n\ndefine Check can Wall slide\nif <(falling) < [2]> then\n    set [wall slide v] to [0]\n    stop [this script v]\nend\nswitch costume to (hitbox wallslide v)\nset rotation style [left-right v]\nCheck touching solid\nset [wall slide v] to (touching)\nswitch costume to (hitbox v2 v)\nset rotation style [don't rotate v]\n\nwhen I receive [lose life v]\nset [sx v] to [0]\nstop [other scripts in sprite v]\nrepeat (10)\n    change [ghost v] effect by (10)\n    change size by (10)\nend\nwait (0.5) seconds\nReset and begin level\n\nSquish ((-2) * (speed y))\n\n@Level\n\ndefine Stamp outline\nset rotation style [don't rotate v]\nset [brightness v] effect to (-100)\nrepeat (8)\n    move (4) steps\n    stamp\n    move (-4) steps\n    turn right (45) degrees\nend\nclear graphic effects\n\ndefine Stamp Shadow\nset [brightness v] effect to (-100)\nset [ghost v] effect to (75)\nchange y by (-20)\nstamp\nchange y by (20)\nclear graphic effects\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [back v] layer\n\nwhen I receive [change scene v]\nswitch costume to (join [Scene] (SCENE #))\nerase all\nStamp Shadow\nStamp outline\n\n@Joystick\n\nwhen flag clicked\ngo to [front v] layer\nset [base sprite v] to [Joystick]\nset size to (140) %\nset [max stick v] to ((size) / (4))\nswitch costume to (base v)\nset [ghost v] effect to (60)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nswitch costume to (stick v)\ngo [forward v] (1) layers\nset [ghost v] effect to (25)\nforever\n    set [stick power v] to []\n    set [stick x v] to [0]\n    set [stick y v] to [0]\n    repeat until <mouse down?>\n        go to (base sprite)\n    end\n    if <(distance to [mouse-pointer v]) < ((size) * (0.6))> then\n        stick drag\n    else\n        wait until <not <mouse down?>>\n    end\nend\n\ndefine stick drag\nrepeat until <not <mouse down?>>\n    go to (mouse-pointer v)\n    point towards (base sprite)\n    turn right (180) degrees\n    set [stick direction v] to (direction)\n    set [stick power v] to (distance to [(base sprite) v])\n    if <(STICK POWER) > (MAX STICK)> then\n        move ((MAX STICK) - (STICK POWER)) steps\n        set [stick power v] to (MAX STICK)\n    end\n    set [stick power v] to ((STICK POWER) / (MAX STICK))\n    set [stick x v] to ((STICK POWER) * ([sin v] of (STICK DIRECTION) ))\n    set [stick y v] to ((STICK POWER) * ([cos v] of (STICK DIRECTION) ))\nend\n\n@Contols\n\nwhen I receive [tick - first v]\nset [right v] to <<key (right arrow v) pressed?> or <(STICK X) > [0.3]>>\nset [left v] to <<key (left arrow v) pressed?> or <(STICK X) < [-0.3]>>\nset [up v] to <<<key (up arrow v) pressed?> or <(STICK Y) > [0.3]>> or <key (w v) pressed?>>\nset [down v] to <<key (down arrow v) pressed?> or <(STICK Y) < [-0.3]>>\nif <(down) > [0]> then\n    change [held key down v] by (1)\n    if <(held key down) > [30]> then\n        set [roll v] to [1]\n    end\nelse\n    set [roll v] to [0]\n    set [held key down v] to [0]\nend\nlong jump ([jumping v] of [player v])\n\ndefine long jump (jumping)\nif <([wall slide v] of [player v]) < [1]> then\n    if <(jumping) > [0]> then\n        set [s1 v] to [1]\n    end\n    if <<(jumping) = [0]> and <(s1) = [1]>> then\n        set [s2 v] to [1]\n    end\n    if <<<key (space v) pressed?> > [0]> and <(s2) = [1]>> then\n        if <(space) < [8]> then\n            set [speed jump v] to [1]\n        else\n            set [speed jump v] to [0]\n            if <not <key (space v) pressed?>> then\n                set [space v] to [0]\n            end\n        end\n    else\n        set [speed jump v] to [0]\n        if <([falling v] of [player v]) < [2]> then\n            set [s2 v] to [0]\n            set [s1 v] to [0]\n        end\n    end\nend\nif <(speed jump) > [0]> then\n    change [space v] by (1)\nend\nif <(space) = [8]> then\n    if <not <key (space v) pressed?>> then\n        set [space v] to [0]\n    end\nend\n\nwhen flag clicked\nhide\nset [space v] to [0]\n\nwhen [t v] key pressed\nif <(username) = [madescr_test]> then\n    ask [What Scene Would you Like to teleport to? ] and wait\n    set [scene # v] to (answer)\n    broadcast (Change Scene v)\n    broadcast (Teleport v)\nend\n\n@Splash\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\nforever\n    set [ghost v] effect to (100)\n    go to [front v] layer\nend\n\n@Danger\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [back v] layer\n\nwhen I receive [change scene v]\nswitch costume to (blank v)\nswitch costume to (join [Scene] (SCENE #))\nforever\n    set y to ((5) * ([sin v] of ((timer) * (180)) ))\nend\n\n@Collectables \n\nwhen I receive [change scene v]\nif <(SCENE #) = (my scene)> then\n    show\nelse\n    hide\nend\n\nwhen I start as a clone\nrepeat until <touching (player v)?>\n    change y by ((0.7) * ([sin v] of (frame) ))\n    change [frame v] by (5)\nend\nset [my scene v] to []\nif <(costume [name v]) = [Green Flag]> then\n    set [spawn scene v] to (SCENE #)\n    set [spawn x v] to ([x position v] of [player v])\n    set [spawn y v] to ([y position v] of [player v])\nelse\n    broadcast (win v)\n    broadcast (stop time v)\nend\nrepeat (20)\n    change y by (2)\n    change [ghost v] effect by (5)\nend\nhide\n\nwhen I receive [setup v]\nset [frame v] to [0]\nhide\nPlace [Green Flag] scene [5] x, y [53] [-58]\nPlace [Green Flag] scene [7] x, y [-191] [-58]\nPlace [Green Flag] scene [13] x, y [62] [101]\nPlace [Green Flag] scene [32] x, y [101] [-64]\nPlace [Win Flag] scene [41] x, y [0] [0]\n\ndefine Place (costume name) scene (scene) x, y (x) (y)\nset [my scene v] to (scene)\nswitch costume to (costume name)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\nset [my scene v] to []\n\n
Use the arrow keys to move, or you can use the joystick. \n\nThanks to @griffpatch for the platformer tutorial and the MMO tutorial.  \n\nBring Back Blue!\n\nPlay my friend's game: https://scratch.mit.edu/projects/859507723\n\n\n\n#platformer #scratchcat #all #art #multiplayer #trending\n#mobile #griffpatch #madescr_test  #games\n\n\nDon't scroll down any further...\n\n\n\n\n\n\n\n\n\n\nI told you not to!!!\n\n\n\n\n\n\n\n\n\n\nWhy are you still here >:(\n\n\n\n\n\n\n\n\n\nDO NOT GO DOWN ONE MORE INCH...\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nNothing!   hahahahahahahaha bu don scroll further \n\n\n\n\n\n\n\n\n\n\n\n\n@madescr @lolezzzzzzzzze @95048460\n@TheNinja106 @madescr_test @griffpatch @1peyton2 @golden_retriever3225\n\n\n\n\n\n\nPlay my friend's game: https://scratch.mit.edu/projects/859507723