Cloud Platformer Engine
@Stage\n\n@Players\n\ndefine Movement (id)\nshow\nthink (Bubble)\nswitch costume to (hitbox v)\nif <<(speed y) < [4]> or <key (up arrow v) pressed?>> then\n    change [speed y v] by (-1)\nelse\n    change [speed y v] by (-2)\nend\nchange y by (speed y)\nTouch Ground <(speed y) > [0]>\nif <(wall jump) > [0]> then\n    change [wall jump v] by (-1)\nelse\n    set [speed x v] to ((speed x) * (0.7))\n    if <key (left arrow v) pressed?> then\n        change [speed x v] by (-1.5)\n    end\n    if <key (right arrow v) pressed?> then\n        change [speed x v] by (1.5)\n    end\nend\nif <(speed x) < [-0.5]> then\n    Walk (-90) (speed x)\nelse\n    if <(speed x) > [0.5]> then\n        Walk (90) (speed x)\n    else\n        set [frame v] to [0]\n    end\nend\nif <key (up arrow v) pressed?> then\n    if <<(jump key) = [0]> and <(falling?) < [3]>> then\n        set [speed y v] to [14]\n        set [falling? v] to [6]\n        set [jump key v] to [1]\n    end\nelse\n    set [jump key v] to [0]\nend\nSet Costume\nSave My Data\n\nwhen I receive [initialise  v]\nset rotation style [left-right v]\nset [speed y v] to [0]\nset [falling? v] to [10]\nhide\nset [bubble v] to (username)\nset [clone id v] to [0]\nrepeat (11)\n    change [clone id v] by (1)\n    create clone of (_myself_ v)\nend\n\nwhen I receive [tick v]\nTick\n\ndefine Player (id) (length)\nif <not <(id) = [11]>> then\n    if <(item (id) of [active check v]) = [Off]> then\n        hide\n    else\n        if <(item (((id) * (length)) - (0)) of [cloud list v]) = (Ground Costume)> then\n            show\n            think (item (((id) * (length)) - (3)) of [cloud list v])\n            go to x: (item (((id) * (length)) - (6)) of [cloud list v]) y: (item (((id) * (length)) - (5)) of [cloud list v])\n            switch costume to (item (((id) * (length)) - (2)) of [cloud list v])\n            point in direction (item (((id) * (length)) - (1)) of [cloud list v])\n        else\n            hide\n        end\n    end\nelse\n    hide\nend\n\ndefine Save My Data\ndelete all of [my list v]\nadd (x position) to [my list v]\nadd (y position) to [my list v]\nadd (pick random (9999) to (999999)) to [my list v]\nadd (Bubble) to [my list v]\nadd (costume [number v]) to [my list v]\nadd (direction) to [my list v]\nadd (Ground Costume) to [my list v]\n\ndefine Tick\nif <(Clone ID) = (@PlayerSlot)> then\n    Movement (Clone ID)\nelse\n    Player (Clone ID) [7]\nend\n\ndefine Touch Ground <up?>\nchange [falling? v] by (1)\nrepeat until <not <touching (ground v)?>>\n    if <up?> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [falling? v] to [0]\n    end\n    set [speed y v] to [0]\nend\n\ndefine Walk (direction) (speed)\npoint in direction (direction)\nchange x by (speed)\nset [slope v] to [0]\nrepeat until <<(slope) = [8]> or <not <touching (ground v)?>>>\n    change y by (1)\n    change [slope v] by (1)\nend\nif <(slope) = [8]> then\n    change x by ((0) - (speed))\n    change y by ((0) - (slope))\n    if <<key (up arrow v) pressed?> and <([abs v] of (speed) ) > [3]>> then\n        if <(wall jump) = [0]> then\n            set [speed x v] to ((-1.2) * (speed))\n            set [speed y v] to [11]\n            set [falling? v] to [6]\n            set [wall jump v] to [15]\n        end\n    else\n        set [speed x v] to [0]\n    end\nend\nif <(speed) < [0]> then\n    change [frame v] by ((speed) / (-8))\nelse\n    change [frame v] by ((speed) / (8))\nend\n\ndefine Set Costume\nif <(falling?) < [6]> then\n    if <(frame) = [0]> then\n        switch costume to (stand_1 v)\n    else\n        switch costume to ([floor v] of ((4) + ((frame) mod (8))) )\n    end\nelse\n    if <(speed y) > [0]> then\n        switch costume to (jump_1 v)\n    else\n        switch costume to (fall_1 v)\n    end\nend\n\nwhen [any v] key pressed\nif <key (1 v) pressed?> then\n    set [bubble v] to (item (1) of [messages v])\nelse\n    if <key (2 v) pressed?> then\n        set [bubble v] to (item (2) of [messages v])\n    end\nend\nwait (2) seconds\nset [bubble v] to (username)\n\n@Cloud\n\ndefine Decode (data)\ndelete all of [cloud list v]\nset [output v] to []\nset [i v] to [0]\nrepeat ((length of (data)) / (2))\n    change [i v] by (2)\n    switch costume to (join (letter ((I) - (1)) of (data)) (letter (I) of (data)))\n    if <(costume [name v]) = [~]> then\n        add (Output) to [cloud list v]\n        set [output v] to []\n    else\n        set [output v] to (join (Output) (costume [name v]))\n    end\nend\n\ndefine Encode\nset [output v] to []\nset [n v] to [0]\nrepeat (length of [my list v])\n    set [i v] to [0]\n    change [n v] by (1)\n    repeat (length of (item (n) of [my list v]))\n        change [i v] by (1)\n        switch costume to (letter (I) of (item (n) of [my list v]))\n        if <(costume [number v]) < [10]> then\n            set [output v] to (join (Output) (join [0] (costume [number v])))\n        else\n            set [output v] to (join (Output) (costume [number v]))\n        end\n    end\n    set [output v] to (join (Output) [53])\nend\n\ndefine Update Players List (id)\nif <(id) = [1]> then\n    set [player list v] to [0]\n    delete all of [check v]\n    repeat (10)\n        change [player list v] by (1)\n        add (item (((Player List) * (7)) - (4)) of [cloud list v]) to [check v]\n    end\nelse\n    if <(id) = [2]> then\n        set [player list v] to [0]\n        repeat (10)\n            change [player list v] by (1)\n            if <not <(@PlayerSlot) = (Player List)>> then\n                if <(item (Player List) of [check v]) = (item (((Player List) * (7)) - (4)) of [cloud list v])> then\n                    replace item (Player List) of [active check v] with [Off]\n                else\n                    replace item (Player List) of [active check v] with [On]\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [initialise  v]\ndelete all of [active check v]\nrepeat (10)\n    add [off] to [active check v]\nend\n\nwhen I receive [start v]\nforever\n    Update Players List [1]\n    wait (1) seconds\n    Update Players List [2]\nend\n\nwhen I receive [get data v]\nDecode Data\n\ndefine Save Data (id)\nEncode\nif <(id) = [1]> then\n    set [☁ p1 v] to (Output)\nelse\n    if <(id) = [2]> then\n        set [☁ p2 v] to (Output)\n    else\n        if <(id) = [3]> then\n            set [☁ p3 v] to (Output)\n        else\n            if <(id) = [4]> then\n                set [☁ p4 v] to (Output)\n            else\n                if <(id) = [5]> then\n                    set [☁ p5 v] to (Output)\n                else\n                    if <(id) = [6]> then\n                        set [☁ p6 v] to (Output)\n                    else\n                        if <(id) = [7]> then\n                            set [☁ p7 v] to (Output)\n                        else\n                            if <(id) = [8]> then\n                                set [☁ p8 v] to (Output)\n                            else\n                                if <(id) = [9]> then\n                                    set [☁ p9 v] to (Output)\n                                else\n                                    if <(id) = [10]> then\n                                        set [☁ p10 v] to (Output)\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [tick v]\nDecode Data\nSave Data (@PlayerSlot)\nDetermine Players\n\ndefine Decode Data\nDecode (join (☁ P1) (join (☁ P2) (join (☁ P3) (join (☁ P4) (join (☁ P5) (join (☁ P6) (join (☁ P7) (join (☁ P8) (join (☁ P9) (☁ P10))))))))))\n\ndefine Determine Players\nset [players v] to [1]\nset [i v] to [0]\nrepeat (10)\n    change [i v] by (1)\n    if <(item (I) of [active check v]) = [On]> then\n        change [players v] by (1)\n    end\nend\n\nwhen I receive [do thingy v]\nDecode Data\nUpdate Players List [1]\nwait (1) seconds\nDecode Data\nUpdate Players List [2]\n\n@Ground\n\nwhen I receive [tick v]\nset [ground costume v] to (costume [number v])\n\n@Banners\n\ndefine Turbo mode detector\nreset timer\nrepeat (10)\n    move (0) steps\nend\nif <(timer) > [0.1]> then\n    set [turbo mode? v] to [false]\nelse\n    set [turbo mode? v] to [true]\n    broadcast (Turbo Mode v) and wait\nend\n\nwhen I receive [start v]\nif <(Full?) = [True]> then\n    repeat (10)\n        change [brightness v] effect by (-10)\n    end\n    switch costume to (full v)\n    repeat (10)\n        change [brightness v] effect by (10)\n    end\n    clear graphic effects\n    wait (1) seconds\n    hide\nelse\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    hide\nend\n\nwhen I receive [initialise  v]\nswitch costume to (connecting v)\nshow\nclear graphic effects\ngo to x: (0) y: (0)\ngo to [front v] layer\nset [full? v] to [False]\nset [kick v] to [False]\nset [moved? v] to [800]\n\nwhen I receive [you have been booted. v]\nswitch costume to (booted v)\nshow\nclear graphic effects\ngo to x: (0) y: (0)\ngo to [front v] layer\n\nwhen I receive [tick v]\nif <<<<key (any v) pressed?> or <(username) = [Cloud-Multiplayer]>> or <mouse down?>> or <(Full?) = [True]>> then\n    set [moved? v] to [800]\nend\nchange [moved? v] by (-1)\nCheck (username)\nif <(Moved?) < [1]> then\n    broadcast (You have been booted. v)\n    stop [all v]\nend\n\nwhen flag clicked\nbroadcast (Initialise  v) and wait\nGet Player Slot\nset [moved? v] to [600]\nif <not <(@PlayerSlot) > [0]>> then\n    set [full? v] to [True]\nend\nbroadcast (start v)\nforever\n    broadcast (Tick v) and wait\nend\n\ndefine Get Player Slot\nset [@playerslot v] to [0]\nbroadcast (Get Data v) and wait\nset [moved? v] to [0]\ndelete all of [check v]\nrepeat (10)\n    change [moved? v] by (1)\n    add (item (((Moved?) * (7)) - (4)) of [cloud list v]) to [check v]\nend\nwait (2) seconds\nbroadcast (Get Data v) and wait\nset [moved? v] to [0]\nrepeat (10)\n    change [moved? v] by (1)\n    if <(item (Moved?) of [check v]) = (item (((Moved?) * (7)) - (4)) of [cloud list v])> then\n        set [@playerslot v] to (Moved?)\n        stop [this script v]\n    end\nend\n\nwhen I receive [turbo mode v]\ngo to [front v] layer\nclear graphic effects\nswitch costume to (turbo mode v)\nshow\nstop [all v]\n\nwhen I receive [start v]\nforever\n    Turbo mode detector\nend\n\ndefine Check (username)\nset [i v] to [0]\ndelete all of [other check v]\nrepeat (10)\n    change [i v] by (1)\n    if <<not <(i) = (@PlayerSlot)>> and <not <(item (i) of [active check v]) = [Off]>>> then\n        add (item ((i) * (4)) of [cloud list v]) to [other check v]\n    end\nend\nset [i v] to [0]\nrepeat (length of [other check v])\n    change [i v] by (1)\n    if <<(item (i) of [other check v]) = (username)> and <(@PlayerSlot) < (i)>> then\n        set [@playerslot v] to [0]\n    end\nend\n\nif << (Other check) contains (username)?> and <(@PlayerSlot) < (i)>> then\n    set [@playerslot v] to [0]\nend\n\n@Thumbnail\n\nwhen I receive [initialise  v]\nclear graphic effects\nset size to (100) %\ngo to [front v] layer\nset [ghost v] effect to (100)\ngo to x: (0) y: (0)\n\n