Mineshaft - A Multiplayer Platformer
@Stage\n\nwhen I receive [start v]\nforever\n    play sound [Hot Spaghetti v] until done\nend\n\n@Trampolines\n\nwhen flag clicked\nset [x v] to [1]\nset [y v] to [2]\nforever\n    show\n    switch costume to (join (X) (Y))\nend\n\n@Broadcasts\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nwait (1) seconds\nif <(Players) = [1]> then\n    go to x: (0) y: (100)\n    switch costume to (alone v)\n    show\n    repeat (100)\n        set y to ((y position) / (10))\n    end\n    hide\nend\n\nwhen I receive [start v]\nwait (2) seconds\nset [pp v] to (Players)\nforever\n    go to [front v] layer\n    if <(PP) < (Players)> then\n        wait (2) seconds\n        if <(PP) < (Players)> then\n            go to x: (0) y: (100)\n            set [pp v] to (Players)\n            switch costume to (joined v)\n            set voice to (alto v)::tts\n            speak [A player has joined the game!]::tts\n            show\n            repeat (100)\n                set y to ((y position) / (10))\n            end\n            hide\n        end\n    end\n    if <(Players) < (PP)> then\n        wait (2) seconds\n        if <(Players) < (PP)> then\n            go to x: (0) y: (100)\n            set [pp v] to (Players)\n            switch costume to (left v)\n            set voice to (alto v)::tts\n            speak [A player has left the game!]::tts\n            show\n            repeat (100)\n                set y to ((y position) / (10))\n            end\n            hide\n        end\n    end\nend\n\nwhen I receive [start v]\nwait (1) seconds\nif <(Players) = [1]> then\n    set voice to (alto v)::tts\n    speak [You're playing alone]::tts\nelse\n    set voice to (alto v)::tts\n    speak [You're not playing alone. Right now]::tts\n    speak ((Players) - (1))::tts\n    speak [other players are also playing this platformer.]::tts\nend\n\nwhen I receive [win v]\nhide\nstop [other scripts in sprite v]\nstop all sounds\n\n@Players\n\ndefine Movement (id)\nset size to (50) %\nshow\nthink (username)\nchange [yv v] by (-1)\nif <(ChatOutput) = [1]> then\n    say [Hi!]\nend\nif <(ChatOutput) = [2]> then\n    say [Wait here!]\nend\nif <(ChatOutput) = [3]> then\n    say [Bye!]\nend\nif <(ChatOutput) = [4]> then\n    say [I'm off!]\nend\nif <(ChatOutput) = [5]> then\n    say [Okay]\nend\nif <(ChatOutput) = [6]> then\n    say [Yes]\nend\nif <(ChatOutput) = [7]> then\n    say [Keep trying!]\nend\nif <(ChatOutput) = [8]> then\n    say [Wait for me!]\nend\nif <(ChatOutput) = [9]> then\n    say [Come with me!]\nend\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<(mouse x) > (x position)> and <mouse down?>>> then\n    change [xv v] by (0.6)\n    switch costume to (1 v)\nelse\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<(mouse x) < (x position)> and <mouse down?>>> then\n        change [xv v] by (-0.6)\n        switch costume to (2 v)\n    else\n        switch costume to (3 v)\n    end\nend\nset [xv v] to ((Xv) * (0.9))\nchange x by (Xv)\nSave My Data\nif <touching (terrain v)?> then\n    change y by (1)\nend\nif <touching (terrain v)?> then\n    change y by (1)\nend\nif <touching (terrain v)?> then\n    change y by (1)\nend\nif <touching (terrain v)?> then\n    change y by (1)\nend\nif <touching (terrain v)?> then\n    change y by (-4)\n    change x by ((Xv) * (-1))\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<(mouse y) > (y position)> and <mouse down?>>> then\n        set [yv v] to [13]\n        if <([abs v] of (Xv) ) = (Xv)> then\n            set [xv v] to [-9]\n        else\n            set [xv v] to [10]\n        end\n    else\n        set [xv v] to [0]\n    end\nend\nchange y by (Yv)\nSave My Data\nif <touching (terrain v)?> then\n    change y by ((0) - (Yv))\n    set [yv v] to [1]\nend\nchange y by (-1)\nif <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<(mouse y) > (y position)> and <mouse down?>>> and <touching (terrain v)?>> then\n    switch costume to (4 v)\n    set [yv v] to [13]\nend\nif <touching (trampolines v)?> then\n    switch costume to (4 v)\n    set [yv v] to [16]\nend\nchange y by (1)\nif <(y position) > [180]> then\n    set [yv v] to [0]\nend\nif <(x position) > [230]> then\n    if <not <(X) = [7]>> then\n        set x to (-220)\n        change [x v] by (1)\n        set [xv v] to [0]\n        set [yv v] to [0]\n    end\nend\nif <(x position) < [-230]> then\n    if <not <(X) = [1]>> then\n        set x to (220)\n        change [x v] by (-1)\n        set [xv v] to [0]\n        set [yv v] to [0]\n    end\nend\nif <(y position) > [171]> then\n    if <not <(Y) = [2]>> then\n        set y to (-137)\n        set [xv v] to [0]\n        set [yv v] to [0]\n        change [y v] by (1)\n    end\nend\nif <(y position) < [-171]> then\n    if <not <(Y) = [1]>> then\n        set y to (137)\n        change [y v] by (-1)\n        set [xv v] to [0]\n        set [yv v] to [0]\n    end\nend\ngo to [front v] layer\n\nwhen I receive [initialise  v]\nhide\nset [username v] to (username)\nset [clone id v] to [0]\nrepeat (10)\n    change [clone id v] by (1)\n    create clone of (_myself_ v)\nend\n\ndefine (id)\nif <(item (id) of [active check v]) = [Off]> then\n    hide\nelse\n    if <(item (((id) * (8)) - (3)) of [cloud list v]) = (join (X) (Y))> then\n        switch costume to ((item (((id) * (8)) - (0)) of [cloud list v]) + (0))\n        show\n        set size to (50) %\n        think (item (((id) * (8)) - (4)) of [cloud list v])\n        change x by (((x position) - (item (((id) * (8)) - (7)) of [cloud list v])) / (-2.5))\n        change y by (((y position) - (item (((id) * (8)) - (6)) of [cloud list v])) / (-2.5))\n        if <(item (((id) * (6)) - (0)) of [cloud list v]) = [1]> then\n            say [Hi!]\n        end\n        if <(item (((id) * (6)) - (0)) of [cloud list v]) = [2]> then\n            say [Wait here!]\n        end\n        if <(item (((id) * (6)) - (0)) of [cloud list v]) = [3]> then\n            say [Bye!]\n        end\n        if <(item (((id) * (6)) - (0)) of [cloud list v]) = [4]> then\n            say [I'm off!]\n        end\n        if <(item (((id) * (6)) - (0)) of [cloud list v]) = [5]> then\n            say [Okay]\n        end\n        if <(item (((id) * (6)) - (0)) of [cloud list v]) = [6]> then\n            say [Yes]\n        end\n        if <(item (((id) * (6)) - (0)) of [cloud list v]) = [7]> then\n            say [Keep trying!]\n        end\n        if <(item (((id) * (6)) - (0)) of [cloud list v]) = [8]> then\n            say [Wait for me!]\n        end\n        if <(item (((id) * (6)) - (0)) of [cloud list v]) = [9]> then\n            say [Come with me!]\n        end\n    else\n        go to x: (item (((id) * (8)) - (7)) of [cloud list v]) y: (item (((id) * (8)) - (6)) of [cloud list v])\n        hide\n    end\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 (999) to (99999)) to [my list v]\nadd (Username) to [my list v]\nadd (join (X) (Y)) to [my list v]\nadd (ChatOutput) to [my list v]\nadd [1] to [my list v]\nadd (costume [number v]) to [my list v]\n\ndefine Tick\nif <(Clone ID) = (PlayerSlot)> then\n    Movement (Clone ID)\nelse\n    (Clone ID)\nend\n\nwhen I start as a clone\ngo to x: (-200) y: (0)\nwait until <(Started) = [1]>\nforever\n    Tick\nend\n\nwhen I receive [start v]\nshow variable [players v]\n\nwhen flag clicked\nhide variable [players v]\n\nwhen flag clicked\nhide variable [chat1 v]\nhide variable [chat2 v]\nhide variable [chat3 v]\nhide variable [chat4 v]\nhide variable [chat5 v]\nhide variable [chat6 v]\nhide variable [chat7 v]\nhide variable [chat8 v]\nhide variable [chat9 v]\nset [chat v] to [0]\nset [chat1 v] to [1: Hi!]\nset [chat2 v] to [2: Wait here!]\nset [chat3 v] to [3: Bye!]\nset [chat4 v] to [4: I'm off!]\nset [chat5 v] to [5: Okay]\nset [chat6 v] to [6: Yes]\nset [chat7 v] to [7: Keep trying!]\nset [chat8 v] to [8: Wait for me!]\nset [chat9 v] to [9: Come with me!]\n\nwhen [t v] key pressed\nif <(Chat) = [1]> then\n    set [chat v] to [0]\nelse\n    set [chat v] to [1]\nend\n\nwhen I receive [start v]\nforever\n    if <(Chat) = [1]> then\n        show variable [chat1 v]\n        show variable [chat2 v]\n        show variable [chat3 v]\n        show variable [chat4 v]\n        show variable [chat5 v]\n        show variable [chat6 v]\n        show variable [chat7 v]\n        show variable [chat8 v]\n        show variable [chat9 v]\n        if <key (1 v) pressed?> then\n            hide vars\n            set [chatoutput v] to [1]\n            wait (2) seconds\n            set [chatoutput v] to [0]\n        end\n        if <key (2 v) pressed?> then\n            hide vars\n            set [chatoutput v] to [2]\n            wait (2) seconds\n            set [chatoutput v] to [0]\n        end\n        if <key (3 v) pressed?> then\n            hide vars\n            set [chatoutput v] to [3]\n            wait (2) seconds\n            set [chatoutput v] to [0]\n        end\n        if <key (4 v) pressed?> then\n            hide vars\n            set [chatoutput v] to [4]\n            wait (2) seconds\n            set [chatoutput v] to [0]\n        end\n        if <key (5 v) pressed?> then\n            hide vars\n            set [chatoutput v] to [5]\n            wait (2) seconds\n            set [chatoutput v] to [0]\n        end\n        if <key (6 v) pressed?> then\n            hide vars\n            set [chatoutput v] to [6]\n            wait (2) seconds\n            set [chatoutput v] to [0]\n        end\n        if <key (7 v) pressed?> then\n            hide vars\n            set [chatoutput v] to [7]\n            wait (2) seconds\n            set [chatoutput v] to [0]\n        end\n        if <key (8 v) pressed?> then\n            hide vars\n            set [chatoutput v] to [8]\n            wait (2) seconds\n            set [chatoutput v] to [0]\n        end\n        if <key (9 v) pressed?> then\n            hide vars\n            set [chatoutput v] to [9]\n            wait (2) seconds\n            set [chatoutput v] to [0]\n        end\n    else\n        hide vars\n    end\nend\n\ndefine hide vars\nset [chat v] to [0]\nhide variable [chat1 v]\nhide variable [chat2 v]\nhide variable [chat3 v]\nhide variable [chat4 v]\nhide variable [chat5 v]\nhide variable [chat6 v]\nhide variable [chat7 v]\nhide variable [chat8 v]\nhide variable [chat9 v]\n\nwhen flag clicked\nset [chatoutput v] to [0]\n\n@Connecting\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    reset timer\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 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?) * (6)) - (3)) 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?) * (6)) - (3)) of [cloud list v])> then\n        set [playerslot v] to (Moved?)\n        stop [this script v]\n    end\nend\n\nwhen flag clicked\nset [started v] to [0]\n\nwhen I receive [start v]\nset [started v] to [1]\n\nwhen I receive [failed v]\ngo to x: (0) y: (0)\nswitch costume to (fail v)\nstop [all v]\n\nwhen I receive [failed v]\ngo to x: (0) y: (100)\nswitch costume to (fail v)\nshow\nrepeat (100)\n    set y to ((y position) / (10))\nend\nhide\n\nwhen I receive [win v]\nhide\nstop [other scripts in sprite v]\nstop all sounds\n\n@Terrain\n\nwhen flag clicked\nforever\n    switch costume to (join (X) (Y))\nend\n\n@Loading\n\nwhen flag clicked\nshow\nset size to (20) %\nforever\n    turn right (11) degrees\n    go to [front v] layer\n    change size by (((size) - (90)) / (-5))\nend\n\nwhen I receive [start v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [win v]\nhide\nstop [other scripts in sprite v]\nstop all sounds\n\n@Thumbnail\n\nwhen [timer v] > (0.001)\nhide variable [players v]\nshow\ngo to x: (0) y: (-100)\nforever\n    go to [front v] layer\n    change y by ((y position) / (-10))\nend\n\nwhen flag clicked\nhide\nforever\n    reset timer\nend\n\n@Spikes\n\n@Multiplayer\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) * (8)) - (5)) 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) * (8)) - (5)) 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 (0.3) 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 [win v]\nhide\nstop [other scripts in sprite v]\nstop all sounds\n\n
RESHARED || THIS WAS JUST TO TEST MULTIPLAYER THERE IS NO OBJECTIVE TO THIS GAME\nMineshaft - A Multiplayer Platformer\nArrow keys WASD or mobile controls to move.\nTo chat, press T and then select one of the 9 phrases. Sorry but you can not chat on mobile. As long as you are not a "New Scratcher" you can see other players and chat with them!