(Online) Multiplayer Scrolling Platformer
@Stage\n\n@Blank\n\n@JJyrant Intro\n\nwhen flag clicked\nhide variable [collected v]\nswitch backdrop to (blank v)\nhide\nclear graphic effects\nset size to (100) %\ngo to [front v] layer\ngo to x: (0) y: (0)\nset [xpos v] to [0]\nset [value v] to [0]\nset [sinus v] to [0]\nswitch costume to (square \(1\) v)\nset [velocity v] to [0]\nset [clonenumber v] to [0]\nstart sound [Anikdote - Turn It Up v]\nrepeat (5)\n    create clone of (_myself_ v)\n    wait (0.001) seconds\nend\nchange [clonenumber v] by (1)\ncreate clone of (_myself_ v)\nchange [clonenumber v] by (1)\nset [xpos v] to [-87.5]\nwait (1) seconds\nrepeat (5)\n    change [xpos v] by (35)\n    create clone of (_myself_ v)\n    change [value v] by (1)\n    wait (0.01) seconds\nend\nwait (.7) seconds\nchange [clonenumber v] by (1)\ncreate clone of (_myself_ v)\nwait (1.6) seconds\nchange [clonenumber v] by (1)\ncreate clone of (_myself_ v)\nwait (.1) seconds\nchange [clonenumber v] by (1)\ncreate clone of (_myself_ v)\nwait (3.2) seconds\nchange [clonenumber v] by (1)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nif <(clonenumber) = [0]> then\n    show\n    switch costume to (square \(1\) v)\n    set size to (pick random (50) to (100)) %\n    go to x: (pick random (-180) to (180)) y: (pick random (-180) to (180))\n    repeat until <<(round (x position)) = [0]> and <(round (y position)) = [0]>>\n        change x by (((0) - (x position)) / (5))\n        change y by (((0) - (y position)) / (5))\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nif <(clonenumber) = [1]> then\n    show\n    switch costume to (square \(1\) v)\n    set size to (50) %\n    go to x: (0) y: (0)\n    repeat until <(round (size)) = [150]>\n        change size by (((150) - (size)) / (3))\n    end\n    set [velocity v] to [10]\n    repeat until <(round (size)) > [1400]>\n        switch costume to (blank v)\n        change size by (velocity)\n        change [velocity v] by ((velocity) / (2))\n        switch costume to (square \(1\) v)\n    end\nend\n\nwhen I start as a clone\nif <(clonenumber) = [2]> then\n    set [brightness v] effect to (100)\n    show\n    switch costume to ((value) + (5))\n    set size to (50) %\n    go to x: (xpos) y: (-1000)\n    go to [front v] layer\n    repeat (56)\n        change size by (((100) - (size)) / (3))\n        set [velocity v] to (((velocity) * (.72)) + (((0) - (y position)) / (7)))\n        change y by (velocity)\n    end\n    wait (2) seconds\n    set y to (-1000)\n    set size to (0) %\n    go to [front v] layer\n    repeat (25)\n        change size by (((100) - (size)) / (3))\n        set [velocity v] to (((velocity) * (.72)) + (((-100) - (y position)) / (7)))\n        change y by (velocity)\n    end\n    repeat (100)\n        set y to ((([sin v] of (sinus) ) * (15)) - (100))\n        change [sinus v] by (15)\n    end\nend\n\nwhen I start as a clone\nif <(clonenumber) = [3]> then\n    show\n    go to [front v] layer\n    switch costume to (bar v)\n    set size to (100) %\n    go to x: (-1000) y: (0)\n    repeat until <(round (x position)) = [0]>\n        change x by (((0) - (x position)) / (5))\n    end\n    set [velocity v] to [15]\n    repeat until <(round (size)) > [45000]>\n        switch costume to (blank v)\n        change size by (velocity)\n        change [velocity v] by ((velocity) / (2))\n        switch costume to (bar v)\n    end\nend\n\nwhen I start as a clone\nif <(clonenumber) = [4]> then\n    show\n    switch costume to (logo v)\n    go to x: (0) y: (0)\n    clear graphic effects\n    set size to (0) %\n    go to [front v] layer\n    repeat (26)\n        change size by (((100) - (size)) / (3))\n        set [velocity v] to (((velocity) * (.79)) + (((200) - (size)) / (10)))\n        change size by (velocity)\n    end\n    set [velocity v] to [10]\n    repeat until <(x position) > [239]>\n        change [velocity v] by ((velocity) / (4))\n        change x by (velocity)\n        change size by (((100) - (size)) / (5))\n    end\n    go to x: (-1000) y: (0)\n    hide\n    wait (.2) seconds\n    show\n    repeat until <<(round (x position)) = [0]> and <(round (size)) = [200]>>\n        change x by (((0) - (x position)) / (5))\n        change size by (((200) - (size)) / (5))\n    end\n    repeat until <(round (size)) = [350]>\n        change size by (((350) - (size)) / (5))\n    end\n    repeat until <(round (size)) = [200]>\n        change size by (((200) - (size)) / (5))\n    end\n    set [velocity v] to [1]\n    repeat until <(size) < [15]>\n        change [ghost v] effect by (4)\n        change [velocity v] by ((velocity) / (4))\n        change size by ((0) - (velocity))\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nif <(clonenumber) = [5]> then\n    show\n    switch costume to (screen v)\n    clear graphic effects\n    go to x: (0) y: (0)\n    Flash\n    wait (0.05) seconds\n    Flash\n    wait (.2) seconds\n    Flash\n    wait (0.08) seconds\n    Flash\n    wait (.1) seconds\n    Flash\nend\n\ndefine Flash\nclear graphic effects\nset [brightness v] effect to (100)\nset size to (100) %\nrepeat (20)\n    go to [front v] layer\n    change [ghost v] effect by (5)\nend\n\nwhen I start as a clone\nif <(clonenumber) = [6]> then\n    show\n    go to [front v] layer\n    switch costume to (bar v)\n    set size to (100) %\n    go to x: (-1000) y: (0)\n    set [brightness v] effect to (100)\n    repeat until <(round (x position)) = [0]>\n        change x by (((0) - (x position)) / (5))\n    end\n    set [velocity v] to [15]\n    repeat until <(round (size)) > [45000]>\n        switch costume to (blank v)\n        change size by (velocity)\n        change [velocity v] by ((velocity) / (2))\n        switch costume to (bar v)\n    end\n    broadcast (Delete v)\nend\n\nwhen I receive [delete v]\nset [brightness v] effect to (100)\nif <not <(costume [number v]) = [11]>> then\n    delete this clone\nelse\n    wait (1) seconds\n    broadcast (INTRO DONE v)\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    delete this clone\nend\nswitch backdrop to (blue v)\n\n@Joining\n\nwhen flag clicked\nhide variable [seconds v]\nhide\n\nwhen I receive [begin v]\nwait (1) seconds\nhide\n\nwhen I receive [joining v]\nswitch costume to (joining v)\nshow\n\nwhen I receive [joined v]\ngo [forward v] (1322) layers\nstart sound [Connected v]\nswitch costume to (connected v)\nshow\nwait (1) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nshow variable [collected v]\nshow variable [seconds v]\n\nwhen I receive [full  v]\nswitch costume to (full  v)\nshow\n\nwhen flag clicked\nforever\n    repeat until <(spin speed of coin) = [6]>\n        wait (0.08) seconds\n        change [spin speed of coin v] by (1)\n    end\n    set [spin speed of coin v] to [0]\nend\n\nwhen flag clicked\nforever\n    hide variable [collected show v]\nend\n\n@Loading...\n\nwhen flag clicked\ngo [forward v] (213) layers\nset size to (100) %\nhide\npoint in direction (90)\nclear graphic effects\ngo to x: (0) y: (-80)\n\nwhen I receive [joining v]\nrepeat (10)\n    create clone of (_myself_ v)\n    turn right (40) degrees\nend\n\nwhen I receive [joined v]\nhide\ndelete this clone\n\nwhen I start as a clone\nshow\nset [ghost v] effect to (100)\nforever\n    repeat (20)\n        turn right (7.5) degrees\n        change [ghost v] effect by (-6)\n        change size by (1)\n    end\n    repeat (20)\n        turn right (7.5) degrees\n        change [ghost v] effect by (6)\n        change size by (-1)\n    end\nend\n\nwhen flag clicked\nhide\n\n@Player\n\nwhen I receive [begin v]\nforever\n    if <key (1 v) pressed?> then\n        set [chat item v] to [1]\n        say (item (chat item) of [cloud chat items v])\n        wait (2) seconds\n        say []\n        set [chat item v] to [0]\n    else\n        if <key (2 v) pressed?> then\n            set [chat item v] to [2]\n            say (item (chat item) of [cloud chat items v])\n            wait (2) seconds\n            say []\n            set [chat item v] to [0]\n        else\n            if <key (3 v) pressed?> then\n                set [chat item v] to [3]\n                say (item (chat item) of [cloud chat items v])\n                wait (2) seconds\n                say []\n                set [chat item v] to [0]\n            else\n                if <key (4 v) pressed?> then\n                    set [chat item v] to [4]\n                    say (item (chat item) of [cloud chat items v])\n                    wait (2) seconds\n                    say []\n                    set [chat item v] to [0]\n                else\n                    if <key (5 v) pressed?> then\n                        set [chat item v] to [5]\n                        say (item (chat item) of [cloud chat items v])\n                        wait (2) seconds\n                        say []\n                        set [chat item v] to [0]\n                    else\n                        if <key (6 v) pressed?> then\n                            set [chat item v] to [6]\n                            say (item (chat item) of [cloud chat items v])\n                            wait (2) seconds\n                            say []\n                            set [chat item v] to [0]\n                        else\n                            if <key (7 v) pressed?> then\n                                set [chat item v] to [7]\n                                say (item (chat item) of [cloud chat items v])\n                                wait (2) seconds\n                                say []\n                                set [chat item v] to [0]\n                            else\n                                if <key (8 v) pressed?> then\n                                    set [chat item v] to [8]\n                                    say (item (chat item) of [cloud chat items v])\n                                    wait (2) seconds\n                                    say []\n                                    set [chat item v] to [0]\n                                else\n                                    if <key (9 v) pressed?> then\n                                        set [chat item v] to [9]\n                                        say (item (chat item) of [cloud chat items v])\n                                        wait (2) seconds\n                                        say []\n                                        set [chat item v] to [0]\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nshow list [cloud chat items v]\nset [chat item v] to [0]\n\nwhen I receive [begin v]\nset [chat v] to [0]\nforever\n    if <key (t v) pressed?> then\n        if <(Chat) = [0]> then\n            set [chat v] to [1]\n        else\n            set [chat v] to [0]\n        end\n    end\n    if <(Chat) = [0]> then\n        show list [cloud chat items v]\n    else\n        hide list [cloud chat items v]\n    end\n    wait until <not <key (t v) pressed?>>\nend\n\ndefine write (val) to encoded\nset [letter # v] to [1]\nrepeat (length of (val))\n    set [encoded v] to (join (encoded) (item # of (letter (letter #) of (val)) in [code v]))\n    change [letter # v] by (1)\nend\nset [encoded v] to (join (encoded) [00])\n\nwhen I receive [begin v]\nforever\n    send cloud data\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 (value)\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                            set [☁ p8 v] to (value)\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine send cloud data\nif <[1] > (MY PLAYER #)> then\n    stop [this script v]\nend\nadd (round (x)) to [buffer v]\nadd (round (y)) to [buffer v]\nchange [cloud timer v] by (1)\nif <[3] > (cloud timer)> then\n    stop [this script v]\nend\nset [cloud timer v] to [0]\nset [encoded v] to []\nwrite (username) to encoded\nwrite (chat item) to encoded\nwrite (round ((timer) * (10))) to encoded\nrepeat (length of [buffer v])\n    write (item (1) of [buffer v]) to encoded\n    delete (1) of [buffer v]\nend\nset cloud # (MY PLAYER #) to (encoded)\n\ndefine game on\nset rotation style [don't rotate v]\nset size to (40) %\nclear graphic effects\npoint in direction (90)\nshow\nset [in air 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 [x v] to [0]\nset [y v] to [0]\nset [exit v] to []\nreset timer\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\n\ndefine tick\nif <<<key (right arrow v) pressed?> or <<(mouse x) > (x position)> and <mouse down?>>> or <key (d v) pressed?>> then\n    change [sx v] by (2)\nend\nif <<<key (left arrow v) pressed?> or <<(x position) > (mouse x)> and <mouse down?>>> or <key (a v) pressed?>> then\n    change [sx v] by (-2)\nend\nif <<<key (up arrow v) pressed?> or <<(mouse y) > (y position)> and <mouse down?>>> or <key (w v) pressed?>> then\n    if <(in air) < [4]> then\n        set [sy v] to [16]\n    end\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 <(sy) > [-20]> then\n    change [sy v] by (-2)\nend\nchange player y by (sy)\nposition\ntest - die\nchange [scroll x v] by (round (((x) - (scroll x)) / (10)))\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) < [-200]> then\n    set [exit v] to [die]\nend\n\nwhen I receive [play game 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) and wait\n    end\n    if <(exit) = [win]> then\n        Game - win\n    else\n        game - die\n    end\n    set [scroll x v] to [0]\nend\n\ndefine change player y by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nposition\nif <touching (platforms v)?> then\n    if <(sy) > [0]> then\n        touching platformer out [-1]\n    else\n        touching platformer out [1]\n    end\nend\n\nwhen I receive [begin v]\nbroadcast (green flag v) and wait\nbroadcast (play game v) and wait\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 y) > (y position)> and <mouse down?>>> or <key (w 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 [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\nstart sound [Door Closing v]\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 (spikes v)?> then\n    set [exit v] to [die]\nend\n\ndefine Game - win\nstart sound [Slide Whistle v]\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\nset [level v] to [2]\nbroadcast (win v)\nwait (1) seconds\n\ndefine touching platformer out (out)\nchange [y v] by (out)\nposition\nrepeat until <not <touching (platforms v)?>>\n    change [y v] by (out)\n    position\nend\nset [sy v] to [0]\nif <(out) > [0]> then\n    set [in air v] to [0]\nend\n\nwhen I receive [intro done v]\nset [max players v] to [8]\nset [my player # v] to [0]\ndelete all of [buffer v]\nbroadcast (setup opponents v) and wait\nbroadcast (joining v)\nbroadcast (join game v) and wait\nif <(MY PLAYER #) > [0]> then\n    broadcast (joined v)\nelse\n    broadcast (full  v)\nend\nwait (1) seconds\nbroadcast (begin v)\n\nwhen flag clicked\nhide\n\n@Opponents\n\ndefine begin decoding of (encoded)\nset [encoded v] to (encoded)\nset [letter # v] to [1]\n\ndefine value = read from ecoded\nset [value v] to []\nforever\n    set [idx v] to (join (letter (letter #) of (encoded)) (letter ((letter #) + (1)) of (encoded)))\n    change [letter # v] by (2)\n    if <(idx) < [1]> then\n        stop [this script v]\n    end\n    set [value v] to (join (value) (item (idx) of [code v]))\nend\n\ndefine setup players\ndelete all of [buffer v]\nhide\nset [offline v] to [100]\nset [player # v] to [1]\nrepeat ((MAX PLAYERS) - (1))\n    create clone of (_myself_ v)\n    change [player # v] by (1)\nend\n\nwhen I receive [begin v]\nforever\n    if <(MY PLAYER #) = (player #)> then\n        set [offline v] to [100]\n        hide\n    else\n        tick\n    end\nend\n\ndefine value = cloud # (player)\nif <(player) = [1]> then\n    set [value v] to (☁ P1)\nelse\n    if <(player) = [2]> then\n        set [value v] to (☁ P2)\n    else\n        if <(player) = [3]> then\n            set [value v] to (☁ P3)\n        else\n            if <(player) = [4]> then\n                set [value v] to (☁ P4)\n            else\n                if <(player) = [5]> then\n                    set [value v] to (☁ P5)\n                else\n                    if <(player) = [6]> then\n                        set [value v] to (☁ P6)\n                    else\n                        if <(player) = [7]> then\n                            set [value v] to (☁ P7)\n                        else\n                            set [value v] to (☁ P8)\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [setup opponents v]\nsetup players\n\nwhen I receive [join game v]\nvalue = cloud # (player #)\nset [last value v] to (join [A] (value))\nwait (3) seconds\nvalue = cloud # (player #)\nif <(join [A] (value)) = (last value)> then\n    set [my player # v] to (player #)\nend\n\nwhen flag clicked\nset [names v] to [1]\nforever\n    if <key (n v) pressed?> then\n        if <(names) = [1]> then\n            set [names v] to [0]\n        else\n            set [names v] to [1]\n        end\n    end\n    wait until <not <key (n v) pressed?>>\nend\n\ndefine check if of edge\nif <<<(x position) > [200]> or <(x position) < [-200]>> or <<(y position) > [160]> or <(y position) < [-160]>>> then\n    switch costume to (arrows v)\n    point towards (player v)\n    if on edge, bounce\nelse\n    switch costume to (opponents v)\n    point in direction (90)\nend\n\nwhen flag clicked\nhide\n\ndefine tick\nvalue = cloud # (player #)\nif <(join [A] (value)) = (last value)> then\n    change [offline v] by (1)\n    if <(offline) = [100]> then\n        hide\n    end\nelse\n    set [last value v] to (join [A] (value))\n    if <(offline) > [99]> then\n        show\n    end\n    set [offline v] to [0]\n    begin decoding of (value)\n    value = read from ecoded\n    set [username v] to (value)\n    value = read from ecoded\n    if <(names) = [1]> then\n        say (join (username) (item (value) of [chat items v]))\n    else\n        say []\n    end\n    value = read from ecoded\n    value = read from ecoded\n    repeat until <(value) = []>\n        add (value) to [buffer v]\n        value = read from ecoded\n    end\nend\nif <(length of [buffer v]) > [0]> then\n    set x to ((item (1) of [buffer v]) - (scroll x))\n    delete (1) of [buffer v]\n    set y to ((item (1) of [buffer v]) - (scroll y))\n    delete (1) of [buffer v]\nend\ncheck if of edge\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 [setup v]\nset [x v] to [0]\nset [y v] to [0]\nif <(level) = [1]> then\n    switch costume to (1 v)\n    clone at x: [360] y: [0]\n    clone at x: [360] y: [0]\n    clone at x: [0] y: [-100]\n    clone at x: [630] y: [400]\n    clone at x: [130] y: [320]\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]\nhide\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\nhide\n\n@Spikes\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 [setup v]\nset [x v] to [0]\nset [y v] to [0]\nif <(level) = [1]> then\n    switch costume to (spikes \(1\) v)\n    clone at x: [838] y: [145]\n    clone at x: [800] y: [145]\n    clone at x: [930] y: [208]\n    next costume\n    clone at x: [1350] y: [300]\n    next costume\n    clone at x: [1470] y: [630]\nelse\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]\nhide\ndelete this clone\n\ndefine clone at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\n\nwhen flag clicked\nhide\n\n@Coins\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nswitch costume to (spin speed of coin)\nposition ((x) - (scroll x)) ((y) - (scroll y))\nif <touching (player v)?> then\n    change [collected v] by (1)\n    start sound [pop v]\n    start sound [Coin v]\n    if <(collected) = (collectable max)> then\n        broadcast (open portal v)\n    end\n    delete this clone\nend\n\nwhen I receive [setup v]\nclear graphic effects\nset [collectable max v] to [0]\nset [collected v] to [0/16]\nset [x v] to [0]\nset [y v] to [0]\nif <(level) = [1]> then\n    switch costume to (coins \(1\) v)\n    clone at x: [136] y: [62]\n    clone at x: [212] y: [67]\n    clone at x: [387] y: [60]\n    clone at x: [488] y: [206]\n    clone at x: [709] y: [144]\n    clone at x: [880] y: [266]\n    clone at x: [720] y: [-74]\n    clone at x: [915] y: [-74]\n    clone at x: [810] y: [-74]\n    clone at x: [1070] y: [364]\n    clone at x: [1300] y: [440]\n    clone at x: [1550] y: [500]\n    clone at x: [1400] y: [680]\n    clone at x: [1570] y: [800]\n    clone at x: [1350] y: [960]\n    clone at x: [1260] y: [988]\nend\nset [x v] to [-99999]\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)\nset [x v] to (x)\nset [y v] to (y)\nchange [collectable max v] by (1)\ncreate clone of (_myself_ v)\n\n@Exit\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((x) - (scroll x)) ((y) - (scroll y))\nif <<(costume [number v]) = [2]> and <touching (player v)?>> then\n    set [exit v] to [win]\nend\n\nwhen I receive [setup v]\nset [collected v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nif <(level) = [1]> then\n    switch costume to (exit \(closed\) v)\n    clone at x: [1085] y: [1000]\nelse\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)\nset [x v] to (x)\nset [y v] to (y)\n\nwhen I receive [open portal v]\nswitch costume to ( exit \(opened\) v)\n\nwhen flag clicked\nhide\n\n@Thumbnail\n\nwhen flag clicked\nhide variable [highscore v]\nhide variable [collected v]\nswitch costume to (costume1 v)\nset [ghost v] effect to (100)\nrepeat (10)\n    hide variable [collected show v]\nend\nforever\n    go to [front v] layer\n    if <(level) = [2]> then\n        switch costume to (victory v)\n    end\nend\n\nshow\n\nwhen I receive [begin v]\nshow variable [collected show v]\n\nwhen flag clicked\nswitch costume to (thumbnail v)\nset [level v] to [1]\nwait until <(level) = [2]>\nstop [other scripts in sprite v]\nclear graphic effects\nshow list [cloud chat items v]\nhide variable [collected show v]\nset [show v] to (seconds)\nshow variable [show v]\nshow variable [highscore v]\nbroadcast (win animation v) and wait\nstop [all v]\n\nwhen flag clicked\nset [play? v] to [0]\nreset timer\nhide variable [show v]\nforever\n    set [seconds v] to (timer)\nend\n\nwhen I receive [win animation v]\nrepeat (15)\n    set [pitch v] effect to (-50)\n    start sound [pop v]\n    go to x: (pick random (15) to (-15)) y: (pick random (15) to (-15))\nend\ngo to x: (0) y: (0)\n\nwhen flag clicked\nset [highscore v] to [21.385]\n\n@Intro2\n\nwhen flag clicked\ngo to [front v] layer\nswitch backdrop to (random backdrop v)\nhide\nclear graphic effects\nset size to (100) %\ngo to [front v] layer\ngo to x: (0) y: (0)\nset [xpos v] to [0]\nset [value v] to [0]\nset [sinus v] to [0]\nswitch costume to (square \(1\) v)\nset [velocity v] to [0]\nset [clonenumber v] to [0]\nstart sound [Anikdote - Turn It Up v]\nrepeat (5)\n    create clone of (_myself_ v)\n    wait (0.001) seconds\nend\nchange [clonenumber v] by (1)\ncreate clone of (_myself_ v)\nchange [clonenumber v] by (1)\nset [xpos v] to [-87.5]\nwait (1) seconds\nrepeat (5)\n    change [xpos v] by (35)\n    create clone of (_myself_ v)\n    change [value v] by (1)\n    wait (0.01) seconds\nend\nwait (.7) seconds\nchange [clonenumber v] by (1)\ncreate clone of (_myself_ v)\nwait (1.6) seconds\nchange [clonenumber v] by (1)\ncreate clone of (_myself_ v)\nwait (.1) seconds\nchange [clonenumber v] by (1)\ncreate clone of (_myself_ v)\nwait (3.2) seconds\nchange [clonenumber v] by (1)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nif <(clonenumber) = [0]> then\n    show\n    switch costume to (square \(1\) v)\n    set size to (pick random (50) to (100)) %\n    go to x: (pick random (-180) to (180)) y: (pick random (-180) to (180))\n    repeat until <<(round (x position)) = [0]> and <(round (y position)) = [0]>>\n        change x by (((0) - (x position)) / (5))\n        change y by (((0) - (y position)) / (5))\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nif <(clonenumber) = [1]> then\n    show\n    switch costume to (square \(1\) v)\n    set size to (50) %\n    go to x: (0) y: (0)\n    repeat until <(round (size)) = [150]>\n        change size by (((150) - (size)) / (3))\n    end\n    set [velocity v] to [10]\n    repeat until <(round (size)) > [1400]>\n        switch costume to (blank v)\n        change size by (velocity)\n        change [velocity v] by ((velocity) / (2))\n        switch costume to (square \(1\) v)\n    end\nend\n\nwhen I start as a clone\nif <(clonenumber) = [2]> then\n    set [brightness v] effect to (100)\n    show\n    switch costume to ((value) + (5))\n    set size to (50) %\n    go to x: (xpos) y: (-1000)\n    go to [front v] layer\n    repeat (56)\n        change size by (((100) - (size)) / (3))\n        set [velocity v] to (((velocity) * (.72)) + (((0) - (y position)) / (7)))\n        change y by (velocity)\n    end\n    wait (2) seconds\n    set y to (-1000)\n    set size to (0) %\n    go to [front v] layer\n    repeat (25)\n        change size by (((100) - (size)) / (3))\n        set [velocity v] to (((velocity) * (.72)) + (((-100) - (y position)) / (7)))\n        change y by (velocity)\n    end\n    repeat (100)\n        set y to ((([sin v] of (sinus) ) * (15)) - (100))\n        change [sinus v] by (15)\n    end\nend\n\nwhen I start as a clone\nif <(clonenumber) = [3]> then\n    show\n    go to [front v] layer\n    switch costume to (bar v)\n    set size to (100) %\n    go to x: (-1000) y: (0)\n    repeat until <(round (x position)) = [0]>\n        change x by (((0) - (x position)) / (5))\n    end\n    set [velocity v] to [15]\n    repeat until <(round (size)) > [45000]>\n        switch costume to (blank v)\n        change size by (velocity)\n        change [velocity v] by ((velocity) / (2))\n        switch costume to (bar v)\n    end\nend\n\nwhen I start as a clone\nif <(clonenumber) = [4]> then\n    show\n    switch costume to (logo v)\n    go to x: (0) y: (0)\n    clear graphic effects\n    set size to (0) %\n    go to [front v] layer\n    repeat (26)\n        change size by (((100) - (size)) / (3))\n        set [velocity v] to (((velocity) * (.79)) + (((200) - (size)) / (10)))\n        change size by (velocity)\n    end\n    set [velocity v] to [10]\n    repeat until <(x position) > [239]>\n        change [velocity v] by ((velocity) / (4))\n        change x by (velocity)\n        change size by (((100) - (size)) / (5))\n    end\n    go to x: (-1000) y: (0)\n    hide\n    wait (.2) seconds\n    show\n    repeat until <<(round (x position)) = [0]> and <(round (size)) = [200]>>\n        change x by (((0) - (x position)) / (5))\n        change size by (((200) - (size)) / (5))\n    end\n    repeat until <(round (size)) = [350]>\n        change size by (((350) - (size)) / (5))\n    end\n    repeat until <(round (size)) = [200]>\n        change size by (((200) - (size)) / (5))\n    end\n    set [velocity v] to [1]\n    repeat until <(size) < [15]>\n        change [ghost v] effect by (4)\n        change [velocity v] by ((velocity) / (4))\n        change size by ((0) - (velocity))\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nif <(clonenumber) = [5]> then\n    show\n    switch costume to (screen v)\n    clear graphic effects\n    go to x: (0) y: (0)\n    Flash\n    wait (0.05) seconds\n    Flash\n    wait (.2) seconds\n    Flash\n    wait (0.08) seconds\n    Flash\n    wait (.1) seconds\n    Flash\nend\n\ndefine Flash\nclear graphic effects\nset [brightness v] effect to (100)\nset size to (100) %\nrepeat (20)\n    go to [front v] layer\n    change [ghost v] effect by (5)\nend\n\nwhen I start as a clone\nif <(clonenumber) = [6]> then\n    show\n    go to [front v] layer\n    switch costume to (bar v)\n    set size to (100) %\n    go to x: (-1000) y: (0)\n    set [brightness v] effect to (100)\n    repeat until <(round (x position)) = [0]>\n        change x by (((0) - (x position)) / (5))\n    end\n    set [velocity v] to [15]\n    repeat until <(round (size)) > [45000]>\n        switch costume to (blank v)\n        change size by (velocity)\n        change [velocity v] by ((velocity) / (2))\n        switch costume to (bar v)\n    end\n    broadcast (Delete v)\nend\n\nwhen I receive [delete v]\nset [brightness v] effect to (100)\nif <not <(costume [number v]) = [11]>> then\n    delete this clone\nelse\n    wait (1) seconds\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    delete this clone\nend\nswitch backdrop to (next backdrop v)\n\n
Click the ❤️, and⭐️, and also follow @JJyrant for more!\n\nAlso, comment "Sky!" in my studio to get a curator invite!: https://scratch.mit.edu/studios/29400385/\n-------------------------------------------------------------------------\nCome check out my other games:\n - Taco Catcher:\nhttps://scratch.mit.edu/projects/515506520/\n - Chick Crossing: https://scratch.mit.edu/projects/524939427/\n - Spike Slide: https://scratch.mit.edu/projects/524689085/\n - Cookie Clicker: https://scratch.mit.edu/projects/509256375/\n - Cloud Multiplayer Scrolling Platformer:\nhttps://scratch.mit.edu/projects/514642720/\n - Key Clicker:\nhttps://scratch.mit.edu/projects/503945584/\n-------------------------------------------------------------------------\n(Online) Multiplayer Scrolling Platformer (mobile friendly)\n-----------------------------------------------------------\nNOTES:\n1. you won't see others if you are a new scratcher\n2. It lags when there's more than one player\n3. 8 player slots\n4. Mobile friendly\n5. Cloud chat\n     - Press n key to hide/show names\n     - Press t key to show/hide chat options\n     - Press 1 - 9 keys to chat!\n6. Scrolling vertically and horizontally\n