Cloud Scrolling Platformer Engine
@Stage\n\n@Slides\n\nwhen I receive [tick v]\nif <<<<key (any v) pressed?> or <(username) = [Cloud-Multiplayer]>> or <mouse down?>> or <(Event) = [Full]>> then\n    set [i v] to [2000]\nend\nchange [i v] by (-1)\nif <(i) < [1]> then\n    set [event v] to [Boot]\n    broadcast (Event v) and wait\n    stop [all v]\nend\n\nwhen I receive [event v]\nif <(Event) = [Full]> then\n    switch costume to (full v)\n    wait (1) seconds\n    hide\nelse\n    if <(Event) = [Boot]> then\n        switch costume to (booted v)\n        show\n        go to [front v] layer\n    else\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n        hide\n    end\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 [tick v] to [0]\n\nwhen flag clicked\nbroadcast (Initialise  v) and wait\nGet Player Slot\nif <not <(PlayerSlot) > [0]>> then\n    set [event v] to [Full]\nend\nbroadcast (Event v)\nbroadcast (Start v)\nset [i v] to [2000]\nbroadcast (Play Game v)\n\ndefine Get Player Slot\nset [playerslot v] to [0]\nbroadcast (Get Data v) and wait\nset [i v] to [0]\ndelete all of [check v]\nrepeat (10)\n    change [i v] by (1)\n    add (item (((i) * (Cloud List Length)) - (0)) of [cloud list v]) to [check v]\nend\nwait (pick random (1.9) to (3.1)) seconds\nbroadcast (Get Data v) and wait\nset [i v] to [0]\nrepeat (10)\n    change [i v] by (1)\n    if <(item (i) of [check v]) = (item (((i) * (Cloud List Length)) - (0)) of [cloud list v])> then\n        set [playerslot v] to (i)\n        stop [this script v]\n    end\nend\n\n@Player\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\n\nwhen I receive [play game v]\nset [level v] to [1]\nforever\n    broadcast (Reset v) and wait\n    broadcast (Set Up v) and wait\n    Game On\n    repeat until <(EXIT) > []>\n        Tick\n        broadcast (Tick v) and wait\n        change [tick v] by (1)\n    end\n    if <(EXIT) = [win]> then\n        Game - Win\n    else\n        Game - Die\n    end\nend\n\ndefine Game On\ndelete all of [player buffer v]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nset [sy v] to [0]\nset [sx v] to [0]\nset [in air v] to [0]\nset [exit v] to []\ngo to [back v] layer\nset size to (100) %\nset [ghost v] effect to (0)\nshow\n\ndefine Tick\nif <<key (left arrow v) pressed?> or <<mouse down?> and <(x position) > (mouse x)>>> then\n    change [sx v] by (-2)\nend\nif <<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>> then\n    change [sx v] by (2)\nend\nset [sx v] to ((sx) * (0.8))\nif <([abs v] of (sx) ) > [0.9]> then\n    Change Player x by (round (sx))\nend\nif <<key (up arrow v) pressed?> or <<mouse down?> and <((mouse y) - (y position)) > [50]>>> then\n    if <(in air) < [4]> then\n        set [sy v] to [16]\n    end\nend\nif <(sy) > [-20]> then\n    change [sy v] by (-2)\nend\nChange Player y by (sy)\nTest - Die\nset [scroll x v] to (x)\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\nend\nchange [scroll y v] by (round (((y) - (SCROLL Y)) / (10)))\nif <(SCROLL Y) < [0]> then\n    set [scroll y v] to [0]\nend\nPosition\nif <(y) < [-180]> then\n    set [exit v] to [die]\nend\nthink (username)\nSave My Data\n\ndefine Change Player y by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nPosition\nrepeat until <not <touching (platforms v)?>>\n    if <(sy) > [0]> then\n        change [y v] by (-1)\n    else\n        change [y v] by (1)\n        set [in air v] to [0]\n    end\n    Position\n    set [sy v] to [0]\nend\n\ndefine Position\ngo to x: ((x) - (SCROLL X)) y: ((y) - (SCROLL Y))\n\ndefine Change Player x by (sx)\nchange [x v] by (sx)\nPosition\nif <touching (platforms v)?> then\n    repeat (12)\n        change [y v] by (1)\n        Position\n        if <not <touching (platforms v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-12)\n    if <<key (up arrow v) pressed?> or <<mouse down?> and <((mouse y) - (y position)) > [50]>>> then\n        if <(sx) > [0]> then\n            set [sx v] to [-16]\n        else\n            set [sx v] to [16]\n        end\n        set [in air v] to [0]\n    else\n        set [sx v] to [0]\n    end\n    repeat until <not <touching (platforms v)?>>\n        if <(sx) > [0]> then\n            change [x v] by (-1)\n        else\n            change [x v] by (1)\n        end\n        Position\n    end\nend\n\ndefine Game - Die\nset [exit v] to []\nrepeat (5)\n    hide\n    wait (0.1) seconds\n    show\n    wait (0.1) seconds\nend\nhide\nwait (0.5) seconds\n\ndefine Test - Die\nif <touching (danger v)?> then\n    set [exit v] to [die]\nend\nif <touching (boost v)?> then\n    set [sy v] to [30]\nend\n\ndefine Game - Win\nrepeat (50)\n    point towards (exit v)\n    turn right (65) degrees\n    move ((distance to [exit v]) / (2)) steps\n    change size by (-1)\n    change [ghost v] effect by (2)\nend\nhide\nchange [level v] by (1)\nwait (1) seconds\n\nwhen I receive [initialise  v]\nbroadcast (Reset v) and wait\nbroadcast (Green Flag v) and wait\ngo to x: (0) y: (0)\nhide\n\ndefine Save My Data\ndelete all of [my list v]\nadd (x) to [my list v]\nadd (y) to [my list v]\nadd (costume [number v]) to [my list v]\nadd (username) to [my list v]\nadd (Tick) to [my list v]\nset [cloud list length v] to (length of [my list v])\n\n@Cloud Players\n\nwhen I receive [initialise  v]\nhide\nset [clone id v] to [0]\nrepeat (10)\n    change [clone id v] by (1)\n    create clone of (_myself_ v)\nend\n\nwhen I receive [tick v]\nPlayer (Clone ID)\n\ndefine Player (id)\nif <<(item (id) of [active check v]) = [False]> or <(id) = (PlayerSlot)>> then\n    hide\nelse\n    show\n    think (item (((id) * (Cloud List Length)) - (1)) of [cloud list v])\n    set x to ((item (((id) * (Cloud List Length)) - (4)) of [cloud list v]) - (SCROLL X))\n    set y to ((item (((id) * (Cloud List Length)) - (3)) of [cloud list v]) - (SCROLL Y))\n    if <<<(x position) > [237]> or <(x position) < [-237]>> or <<(y position) > [177]> or <(y position) < [-177]>>> then\n        switch costume to (nothing v)\n    else\n        switch costume to (item (((id) * (Cloud List Length)) - (2)) of [cloud list v])\n    end\nend\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) * (Cloud List Length)) - (0)) 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 <(item (Player List) of [check v]) = (item (((Player List) * (Cloud List Length)) - (0)) of [cloud list v])> then\n                replace item (Player List) of [active check v] with [False]\n            else\n                replace item (Player List) of [active check v] with [True]\n            end\n        end\n    end\nend\n\nwhen I receive [initialise  v]\ndelete all of [active check v]\nrepeat (10)\n    add [False] 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)\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\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@Platforms\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [set up v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 1 v)\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [0] y: [180]\n    Clone at x: [-360] y: [0]\n    Clone at x: [-360] y: [0]\n    Clone at x: [-360] y: [0]\nend\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\n@Danger\n\nwhen I receive [green flag v]\ngo to [back v] layer\nhide\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [set up v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 1 v)\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [0] y: [180]\n    Clone at x: [-360] y: [0]\n    Clone at x: [-360] y: [0]\n    Clone at x: [-360] y: [0]\nend\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\n@Boost\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [set up v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 1 v)\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [0] y: [180]\n    Clone at x: [-360] y: [0]\n    Clone at x: [-360] y: [0]\n    Clone at x: [-360] y: [0]\nend\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\n
Left/Right/Up Arrow keys to move \nMobile supported\n\nThe newest engine, Cloud Scrolling Platformer Engine allows you to create your own multidirectional platformer that scrolls and allows up to ten players. \n\nWARNING: There may be some errors I need to correct and this is not fully made so expect some glitches. \n\nCredits:\n\n@griffpatch for his great scrolling platformer tutorial on Youtube.