Danger Run || A Scrolling Platformer
@Stage\n\nwhen flag clicked\nforever\n    play sound [y2mate v] until done\nend\n\n@opponents\n\ndefine Decode chat (chat)\nif <(chat) = [0]> then\n\ndefine begin decode of (encode)\nset [opponents: encodied v] to (encode)\nset [opponents: letter # v] to [1]\n\ndefine value=read from encode\nset [opponents: value v] to []\nforever\n    set [opponents: idx v] to (join (letter (opponents: letter #) of (opponents: encodied)) (letter ((opponents: letter #) + (1)) of (opponents: encodied)))\n    change [opponents: letter # v] by (2)\n    if <(opponents: idx) < [1]> then\n        stop [this script v]\n    end\n    set [opponents: value v] to (join (opponents: value) (item (opponents: idx) of [code v]))\nend\n\ndefine setup players\nset [color v] effect to (90)\nset [opponents: offline v] to [100]\nhide\nset [opponents: player # v] to [1]\nrepeat ((MAX PLAYERS) - (1))\n    create clone of (_myself_ v)\n    change [opponents: player # v] by (1)\nend\n\nwhen I receive [begin v]\nforever\n    if <(My Player #) = (opponents: player #)> then\n        hide\n        set [opponents: offline v] to [100]\n    else\n        tick\n    end\n    go to [back v] layer\nend\n\ndefine value=Cloud # (player)\nif <(player) = [1]> then\n    set [opponents: value v] to (☁ P1)\nelse\n    if <(player) = [2]> then\n        set [opponents: value v] to (☁ P2)\n    else\n        if <(player) = [3]> then\n            set [opponents: value v] to (☁ P3)\n        else\n            if <(player) = [4]> then\n                set [opponents: value v] to (☁ P4)\n            else\n                if <(player) = [5]> then\n                    set [opponents: value v] to (☁ P5)\n                else\n                    if <(player) = [6]> then\n                        set [opponents: value v] to (☁ P6)\n                    else\n                        if <(player) = [7]> then\n                            set [opponents: value v] to (☁ P7)\n                        else\n                            if <(player) = [8]> then\n                                set [opponents: value v] to (☁ P8)\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [setups v]\nsetup players\n\ndefine tick\nvalue=Cloud # (player #)\nif <(join [A] (opponents: value)) = (opponents: last value)> then\n    change [opponents: offline v] by (1)\n    if <(opponents: offline) = [100]> then\n        hide\n    end\nelse\n    set [opponents: last value v] to (join [A] (opponents: value))\n    if <(opponents: offline) > [99]> then\n        show\n    end\n    set [opponents: offline v] to [0]\nend\nbegin decode of (value)\nvalue=read from encode\nsay (join (opponents: player #) (join [:] (opponents: value)))\nvalue=read from encode\nvalue=read from encode\nset x to ((opponents: value) - (SCROLL X))\nvalue=read from encode\nset y to ((opponents: value) - (SCROLL Y))\nvalue=read from encode\nDecode chat (opponents: value)\n\nwhen I receive [join game v]\nvalue=Cloud # (player #)\nset [opponents: last value v] to (join [A] (opponents: value))\nwait (3) seconds\nvalue=Cloud # (opponents: player #)\nif <(join [A] (opponents: value)) = (opponents: last value)> then\n    set [my player # v] to (opponents: player #)\nend\n\nwhen I receive [decode chat v]\nDecode chat (opponents: value)\n\n@player\n\ndefine Chat\nif <(is the chat open) = [1]> then\n    if <key (1 v) pressed?> then\n        set [chat v] to [1]\n        say (item (Chat) of [chat v])\n        wait (2) seconds\n        say []\n        set [chat v] to [0]\n    else\n        if <key (2 v) pressed?> then\n            set [chat v] to [2]\n            say (item (Chat) of [chat v])\n            wait (2) seconds\n            say []\n            set [chat v] to [0]\n        else\n            if <key (3 v) pressed?> then\n                set [chat v] to [3]\n                say (item (Chat) of [chat v])\n                wait (2) seconds\n                say []\n                set [chat v] to [0]\n            else\n                if <key (4 v) pressed?> then\n                    set [chat v] to [4]\n                    say (item (Chat) of [chat v])\n                    wait (2) seconds\n                    say []\n                    set [chat v] to [0]\n                else\n                    if <key (5 v) pressed?> then\n                        set [chat v] to [5]\n                        say (item (Chat) of [chat v])\n                        wait (2) seconds\n                        say []\n                        set [chat v] to [0]\n                    else\n                        if <key (6 v) pressed?> then\n                            set [chat v] to [6]\n                            say (item (Chat) of [chat v])\n                            wait (2) seconds\n                            say []\n                            set [chat v] to [0]\n                        else\n                            if <key (7 v) pressed?> then\n                                set [chat v] to [7]\n                                say (item (Chat) of [chat v])\n                                wait (2) seconds\n                                say []\n                                set [chat v] to [0]\n                            else\n                                if <key (8 v) pressed?> then\n                                    set [chat v] to [8]\n                                    say (item (Chat) of [chat v])\n                                    wait (2) seconds\n                                    say []\n                                    set [chat v] to [0]\n                                else\n                                    if <key (9 v) pressed?> then\n                                        set [chat v] to [9]\n                                        say (item (Chat) of [chat v])\n                                        wait (2) seconds\n                                        say []\n                                        set [chat v] to [0]\n                                    else\n                                        set [chat v] to [0]\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Position\ngo to x: ((x) - (SCROLL X)) y: ((y) - (SCROLL Y))\n\nwhen flag clicked\nset [scroll y v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nset [scroll x v] to [0]\nshow list [chat v]\nbroadcast (GREEN FLAG v) and wait\nbroadcast (PLAY GAME v) and wait\n\ndefine CHANGE PLAYER Y BY (sy)\nchange [y v] by (sy)\nchange [inair v] by (1)\nPosition\nrepeat until <not <touching (platform v)?>>\n    if <(sy) > [0]> then\n        change [y v] by (-1)\n    else\n        change [y v] by (1)\n        set [inair v] to [0]\n    end\n    Position\n    set [sy v] to [0]\nend\n\ndefine GAME ON\nset [x v] to [0]\nset [y v] to [0]\nset [sy v] to [0]\nset [sx v] to [0]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset [inair v] to [0]\nset [exit v] to []\nset size to (100) %\nset [ghost v] effect to (0)\nshow\n\nwhen I receive [green flag v]\nhide\ngo [forward v] (1) layers\n\ngo to [front v] layer\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\ndefine TICK\nif <key (left arrow v) pressed?> then\n    change [sx v] by (-2)\nend\nif <key (right arrow v) pressed?> then\n    change [sx v] by (2)\nend\nset [sx v] to ((SX) * (0.8))\nif <[0.9] < ([abs v] of (SX) )> then\n    CHANGE PLAYER X By (round (SX))\nend\nif <key (up arrow v) pressed?> then\n    if <(inair) < [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\nchange [scroll x v] by (round (((x) - (SCROLL X)) / (8)))\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\nend\nif <[2649] < (SCROLL X)> then\n    set [scroll x v] to [2649]\nend\nchange [scroll y v] by (round (((y) - (SCROLL Y)) / (8)))\nif <(SCROLL Y) < [0]> then\n    set [scroll y v] to [0]\nend\nPosition\nif <(y) < [-175]> then\n    set [exit v] to [die]\nend\n\nwhen I receive [begin v]\nset [is the chat open v] to [0]\nshow list [chat v]\nforever\n    Chat\n    if <key (g v) pressed?> then\n        if <(is the chat open) = [1]> then\n            show list [chat v]\n            set [is the chat open v] to [0]\n        else\n            set [is the chat open v] to [1]\n            hide list [chat v]\n        end\n        wait until <not <key (g v) pressed?>>\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 (dangers  v)?> then\n    set [exit v] to [die]\nend\n\ndefine CHANGE PLAYER X By (sx)\nchange [x v] by (sx)\nPosition\nif <touching (platform v)?> then\n    repeat (18)\n        change [y v] by (1)\n        Position\n        if <not <touching (platform v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-18)\n    if <key (up arrow v) pressed?> then\n        if <(sx) > [0]> then\n            set [sx v] to [-16]\n        else\n            set [sx v] to [16]\n        end\n        set [inair v] to [0]\n    else\n        set [sx v] to [0]\n    end\n    repeat until <not <touching (platform 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\nwhen flag clicked\nset [max players v] to [4]\nset [my player # v] to [0]\nbroadcast (setups v) and wait\nbroadcast (joining v)\nbroadcast (join game v) and wait\nif <(My Player #) > [0]> then\n    start sound [Connect v]\n    broadcast (joined v)\nelse\n    start sound [Disconnect v]\n    broadcast (full v)\nend\nbroadcast (begin v)\n\ndefine write (val) to encoded\nset [player: letter # v] to [1]\nrepeat (length of (val))\n    set [player: encodied v] to (join (player: encodied) (item # of (letter (player: letter #) of (val)) in [code v]))\n    change [player: letter # v] by (1)\nend\nset [player: encodied v] to (join (player: encodied) [00])\n\nwhen I receive [begin v]\nset [level v] to [1]\nforever\n    broadcast (reset v) and wait\n    broadcast (SETUP v) and wait\n    GAME ON\n    repeat until <(EXIT) > []>\n        TICK\n        broadcast (tick v)\n        if <(My Player #) > [0]> then\n            send cloud data\n        end\n    end\n    if <(EXIT) = [win]> then\n        Game-Win\n    else\n        GAME - DIE\n    end\nend\n\ndefine set cloud # (player) to (value)\nif <(player) = [1]> then\n    set [☁ p1 v] to (value)\nelse\n    if <(player) = [2]> then\n        set [☁ p2 v] to (value)\n    else\n        if <(player) = [3]> then\n            set [☁ p3 v] to (value)\n        else\n            if <(player) = [4]> then\n                set [☁ p4 v] to [0]\n            else\n                if <(player) = [5]> then\n                    set [☁ p5 v] to (value)\n                else\n                    if <(player) = [6]> then\n                        set [☁ p6 v] to (value)\n                    else\n                        if <(player) = [7]> then\n                            set [☁ p7 v] to (value)\n                        else\n                            if <(player) = [8]> then\n                                set [☁ p8 v] to (value)\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine send cloud data\nset [player: encodied v] to []\nwrite (username) to encoded\nwrite (round ((timer) * (10))) to encoded\nwrite (x) to encoded\nwrite (y) to encoded\nwrite (Chat) to encoded\nset cloud # (My Player #) to (player: encodied)\n\nwhen I receive [begin v]\nwait (5) seconds\nswitch backdrop to (blank v)\n\nhide\n\nwhen flag clicked\nswitch costume to (costume3 v)\n\nwhen flag clicked\nadd [Hello!] to [chat v]\nadd [Watch out!] to [chat v]\nadd [Love and Fave?] to [chat v]\nadd [Yes!] to [chat v]\nadd [No.] to [chat v]\nadd [This way!] to [chat v]\nadd [Gotta go!] to [chat v]\nadd [Well Done!] to [chat v]\nadd [Bye!] to [chat v]\n\n@Sprite1\n\nwhen flag clicked\nhide\n\nwhen I receive [begin v]\nhide\n\nwhen I receive [joining v]\nswitch costume to (joining v)\nshow\n\nwhen I receive [joined v]\nswitch costume to (joined v)\nshow\n\nwhen I receive [full v]\nswitch costume to (joined2 v)\nshow\n\n@PLATFORM\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPOSTION ((x) - (my variable)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 3 2 v)\n    CLONE AT X [500] Y [0]\n    CLONE AT X [500] Y [0]\n    CLONE AT X [600] Y [0]\n    CLONE AT X [550] Y [0]\n    CLONE AT X [500] Y [0]\n    CLONE AT X [500] Y [0]\nelse\n    if <(LEVEL) = [2]> then\nend\n\ndefine POSTION (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\nwhen flag clicked\nforever\n    switch costume to (level 3 2 v)\nend\n\n@frame\n\nwhen flag clicked\nshow\nforever\n    go to [front v] layer\nend\n\nhide\n\nwhen flag clicked\ndelete all of [chat v]\n\nwhen I receive [joined v]\nadd [Hello!] to [chat v]\nadd [Watch Out!] to [chat v]\nadd [Love and Fave?] to [chat v]\nadd [Yes!] to [chat v]\nadd [No.] to [chat v]\nadd [This Way!] to [chat v]\nadd [Gotta go!] to [chat v]\nadd [Well done!] to [chat v]\nadd [Bye!] to [chat v]\n\n@DANGERs \n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\ngo to [back v] layer\nPOSTION ((x) - (my variable)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (3 \(1\) v)\n    CLONE AT X [500] Y [0]\n    CLONE AT X [600] Y [0]\n    CLONE AT X [500] Y [0]\n    CLONE AT X [500] Y [0]\n    CLONE AT X [500] Y [0]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (3 \(1\) v)\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3 1 v)\n        end\n    end\nend\n\ndefine POSTION (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@ clouds\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nset size to (pick random (50) to (80)) %\nshow\ngo to [back v] layer\nset [ghost v] effect to (20)\nswitch costume to (pick random (1) to (4))\nif <(side) = [1]> then\n    go to x: (300) y: (pick random (150) to (100))\n    repeat until <(x position) < [-250]>\n        change x by (-1)\n    end\n    delete this clone\nend\nif <(side) = [2]> then\n    go to x: (-300) y: (pick random (150) to (100))\n    repeat until <(x position) > [250]>\n        change x by (1)\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nforever\n    go [backward v] (1) layers\n    go to [back v] layer\nend\n\nwhen flag clicked\nforever\n    set [side v] to (pick random (1) to (2))\n    create clone of (_myself_ v)\n    wait (pick random (3) to (5)) seconds\nend\n\n@Thumbnail\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (costume2 v)\nset size to (100) %\nswitch costume to (costume1 v)\nset [ghost v] effect to (100)\n\n
ɪɴꜱᴛʀᴜᴄᴛɪᴏɴꜱ:\n(ᴜꜱᴇ ᴀʀʀᴏᴡ ᴋᴇʏꜱ ᴛᴏ ᴍᴏᴠᴇ ᴛʜᴇ ᴘʟᴀʏᴇʀ)\n"ɢ" ᴛᴏ ᴏᴘᴇɴ ꜱᴀꜰᴇ ᴄʜᴀᴛ.\nᴘʀᴇꜱꜱ "ɢ" ᴀɢᴀɪɴ ᴛᴏ ᴄʟᴏꜱᴇ ꜱᴀꜰᴇ ᴄʜᴀᴛ.\nᴛᴏ ᴄʜᴀᴛ ᴘʀᴇꜱꜱ ᴛʜᴇ ɴᴜᴍʙᴇʀ ᴄᴏʀʀᴇꜱᴘᴏɴᴅɪɴɢ ᴛᴏ ᴛʜᴇ ᴛʜɪɴɢ ʏᴏᴜ ᴡᴀɴᴛ ᴛᴏ ꜱᴀʏ!\n\nᴇᴠᴇʀʏᴛʜɪɴɢ ɪꜱ ᴘᴏꜱꜱɪʙʟᴇ ꜱᴏ ᴘʟᴇᴀꜱᴇ ᴅᴏɴ'ᴛ ꜱᴀʏ ɪᴛ ɪꜱ ɪᴍᴘᴏꜱꜱɪʙʟᴇ.\n\nᴛᴏᴏ ꜱʜᴏʀᴛ? ɪꜰ ᴛʜɪꜱ ɢᴇᴛꜱ ᴛᴏᴘ-ʟᴏᴠᴇᴅ, ɪ ᴡɪʟʟ ᴍᴀᴋᴇ ᴀ ᴍᴜᴄʜ ʟᴏɴɢᴇʀ ᴠᴇʀꜱɪᴏɴ! ꜰᴏʟʟᴏᴡ ꜰᴏʀ ᴍᴏʀᴇ ᴘʀᴏᴊᴇᴄᴛꜱ ʟɪᴋᴇ ᴛʜɪꜱ!\n\nᴛʜɪꜱ ɪꜱ ᴍʏ ꜰɪʀꜱᴛ ᴇᴠᴇʀ ꜱᴄʀᴏʟʟɪɴɢ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ ᴘʟᴀᴛꜰᴏʀᴍᴇʀ, ꜱᴏ ᴘʟᴇᴀꜱᴇ ʙᴇ ɢᴇɴᴛʟᴇ ɪɴ ᴛʜᴇ ᴄᴏᴍᴍᴇɴᴛꜱ! :)\n \nᴏʜ, ᴘʟᴇᴀꜱᴇ ɴᴏᴛɪꜰʏ ᴍᴇ ᴏꜰ ᴀɴʏ ʙᴜɢꜱ :)