Nature - a platformer - multiplayer - mobile friendly                #games  #all

Instructions:           Click the green blob 1000 times! xD \n       This is my entry for @0014049's contest.\n                     Press s to skip a level\n                  THIS IS MULTIPLAYER!\n           Thanks to @techexpert26 for cloud.

@Stage\n\n@Less lag\n\n@Player\n\nwhen flag clicked\nforever\n    if <(player skip) = [1]> then\n        if <key (s v) pressed?> then\n            broadcast (front v)\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nset size to (65) %\nrepeat (10)\n    change [brightness v] effect by (3)\n    change size by (-3)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nclear graphic effects\nset size to (150) %\n\nwhen flag clicked\nforever\n    switch costume to (costume4 v)\n    repeat (13)\n        next costume\n    end\n    wait (pick random (1) to (3)) seconds\nend\n\ndefine write (value) to the encoded varaible\nset [i v] to [1]\nrepeat (length of (value))\n    set [encoded v] to (join (encoded) (item # of (letter (i) of (value)) in [table v]))\n    change [i v] by (1)\nend\nset [encoded v] to (join (encoded) [00])\n\nwhen flag clicked\ngo to x: (-173) y: (40)\nset [max players v] to [10]\nset [my player # v] to [0]\nset [spawn y v] to [60]\nbroadcast (setup opponents v) and wait\nbroadcast (message to join v) and wait\nbroadcast (join game v) and wait\nif <(MY PLAYER #) > [0]> then\n    broadcast (joined v) and wait\nelse\n    broadcast (full v) and wait\nend\nbroadcast (begin v)\n\ndefine set cloud # (player) to (something)\nif <(player) = [1]> then\n    set [☁ player1-data v] to (something)\nend\nif <(player) = [2]> then\n    set [☁ player2-data v] to (something)\nend\nif <(player) = [3]> then\n    set [☁ player3-data v] to (something)\nend\nif <(player) = [4]> then\n    set [☁ player4-data v] to (something)\nend\nif <(player) = [5]> then\n    set [☁ player5-data v] to (something)\nend\nif <(player) = [6]> then\n    set [☁ player6-data v] to (something)\nend\nif <(player) = [7]> then\n    set [☁ player7-data v] to (something)\nend\nif <(player) = [8]> then\n    set [☁ player8-data v] to (something)\nend\nif <(player) = [9]> then\n    set [☁ player9-data v] to (something)\nend\nif <(player) = [10]> then\n    set [☁ player10-data v] to (something)\nend\n\nwhen I receive [begin v]\nset [y v] to [0]\nforever\n    change [y v] by (-1)\n    if <<<key (a v) pressed?> or <key (left arrow v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n        change [x v] by (-1)\n    end\n    if <<<key (d v) pressed?> or <key (right arrow v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n        change [x v] by (1)\n    end\n    set [x v] to ((x) * (0.9))\n    change x by (x)\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (-4)\n        change x by ((x) * (-1))\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > [0]>>> then\n            set [y v] to [14]\n            if <(x) > [0]> then\n                set [x v] to [-10]\n            else\n                set [x v] to [10]\n            end\n        else\n            set [x v] to [0]\n        end\n    end\n    change y by (y)\n    if <touching (level v)?> then\n        change y by ((y) - ((y) * (2)))\n        set [y v] to [0]\n    end\n    change y by (-1)\n    if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <((mouse y) - (y position)) > [50]>>> and <touching (level v)?>> then\n        set [y v] to [15]\n    end\n    change y by (1)\n    if <<<<<<touching (obstacles v)?> or <(y position) < [-175]>> or <key (r v) pressed?>> or <touching (lava v)?>> or <touching (game - spinning spiked2 v)?>> or <touching (enemies v)?>> then\n        broadcast (OOF v)\n        hide\n        wait (0.5) seconds\n        go to x: (-210) y: (-115)\n        show\n    end\n    if <([abs v] of (x position) ) > [230]> then\n        if <(x position) > [230]> then\n            broadcast (front v)\n        else\n            broadcast (back v)\n        end\n    end\n    if <touching (trampolines v)?> then\n        set [y v] to [23]\n    end\n    if <(MY PLAYER #) > [0]> then\n        send cloud data\n    end\nend\n\ndefine send cloud data\nset [encoded v] to []\nwrite (username) to the encoded varaible\nwrite (round ((timer) * (10))) to the encoded varaible\nwrite (round (x position)) to the encoded varaible\nwrite (round (y position)) to the encoded varaible\nwrite ([costume # v] of [level v]) to the encoded varaible\nset cloud # (MY PLAYER #) to (encoded)\n\nwhen flag clicked\nforever\n    play sound [Porter Robinson & Madeon - Shelter \(Official Audio\) v] until done\nend\n\nwhen I receive [front v]\ngo to x: (-214) y: (-96)\nhide\nwait (0.2) seconds\nshow\ngo to x: (-214) y: (-96)\n\nwhen I receive [back v]\ngo to x: (173) y: (spawn y)\n\nwhen [s v] key pressed\n\nbroadcast (front v)\n\n@opponents\n\ndefine begin decode of (encoded)\nset [encoded v] to (encoded)\nset [counter v] to [1]\n\ndefine decode\nset [value v] to []\nforever\n    set [idx v] to (join (letter (counter) of (encoded)) (letter ((counter) + (1)) of (encoded)))\n    change [counter 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 [table v]))\nend\n\ndefine setup players\nset [color v] effect to (90)\nhide\nset [player # v] to [1]\nset [offline v] to [100]\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 variable = cloud # (player)\nif <(player) = [1]> then\n    set [value v] to (☁ player1-data)\nend\nif <(player) = [2]> then\n    set [value v] to (☁ player2-data)\nend\nif <(player) = [3]> then\n    set [value v] to (☁ player3-data)\nend\nif <(player) = [4]> then\n    set [value v] to (☁ player4-data)\nend\nif <(player) = [5]> then\n    set [value v] to (☁ player5-data)\nend\nif <(player) = [6]> then\n    set [value v] to (☁ player6-data)\nend\nif <(player) = [7]> then\n    set [value v] to (☁ player7-data)\nend\nif <(player) = [8]> then\n    set [value v] to (☁ player8-data)\nend\nif <(player) = [9]> then\n    set [value v] to (☁ player9-data)\nend\nif <(player) = [10]> then\n    set [value v] to (☁ player10-data)\nend\n\nwhen I receive [setup opponents v]\nsetup players\n\ndefine tick\nvariable = 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]\nend\nbegin decode of (value)\ndecode\nsay (value)\ndecode\ndecode\nset x to (value)\ndecode\nset y to (value)\ndecode\nif <(value) = ([costume # v] of [level v])> then\n    show\nelse\n    hide\nend\n\nwhen I receive [join game v]\nvariable = cloud # (player #)\nset [last value v] to (join [A] (value))\nwait (3.1) seconds\nvariable = cloud # (player #)\nif <(join [A] (value)) = (last value)> then\n    set [my player # v] to (player #)\nend\n\n@Level\n\nwhen I receive [front v]\nshow\nwait (0.5) seconds\nnext costume\n\nwhen I receive [back v]\nswitch costume to ((costume [number v]) - (1))\n\nwhen flag clicked\nset [player skip v] to [0]\nswitch costume to (costume1 v)\n\nwhen flag clicked\nforever\n    if <(costume [number v]) = [8]> then\n        broadcast (enemy, come out! v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(costume [number v]) = [9]> then\n        broadcast (enemy, hide! v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(costume [number v]) < [10]> then\n        set [player skip v] to [1]\n    end\nend\n\nwhen flag clicked\nforever\n    if <(costume [number v]) = [10]> then\n        set [player skip v] to [0]\n    end\nend\n\n@Joining\n\nwhen I receive [message to join v]\nswitch costume to (connecting v)\n\nwhen I receive [full v]\nswitch costume to (full v)\nwait (0.1) seconds\nhide\n\nwhen I receive [joined v]\nswitch costume to (connecting2 v)\nwait (1) seconds\nhide\n\nwhen flag clicked\nshow\nforever\n    go to [front v] layer\nend\n\n@Obstacles\n\nwhen flag clicked\nswitch costume to (costume1 v)\n\nwhen I receive [front v]\nshow\nwait (1) seconds\nnext costume\n\nwhen I receive [back v]\nswitch costume to ((costume [number v]) - (1))\n\n@notifications\n\nwhen flag clicked\nshow\nforever\n    wait (pick random (8) to (15)) seconds\n    repeat (10)\n        change [ghost v] effect by (-10)\n    end\n    switch costume to (costume1 v)\n    wait (1) seconds\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\nend\n\n@Clouds\n\ngo to (random position v)\n\nwhen I receive [begin v]\nhide\nforever\n    go to [back v] layer\n    go to x: (-230) y: (pick random (-25) to (220))\n    create clone of (_myself_ v)\n    wait (1.4) seconds\nend\n\nwhen I start as a clone\nshow\nset [ghost v] effect to (pick random (20) to (50))\nrepeat until <(x position) > [300]>\n    change x by (5)\nend\ndelete this clone\n\n@Lava\n\nwhen flag clicked\nswitch costume to (costume1 v)\n\nwhen I receive [front v]\nshow\nwait (1) seconds\nnext costume\n\nwhen I receive [back v]\nswitch costume to ((costume [number v]) - (1))\n\nwhen flag clicked\nset size to (100) %\nforever\n    go to [back v] layer\n    go to x: (0) y: (0)\n    repeat (10)\n        change size by (1)\n    end\n    repeat (10)\n        change size by (-1)\n    end\nend\n\n@Death Particles\n\nwhen flag clicked\nhide\n\nwhen I receive [oof v]\nrepeat (8)\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nshow\ngo to (player v)\nset [px v] to (pick random (-5) to (5))\nset size to (pick random (80) to (120)) %\nset [ghost v] effect to (pick random (20) to (60))\nset [py2 v] to (pick random (4) to (8))\nrepeat until <touching (_edge_ v)?>\n    change size by (([cos v] of ((timer) * (100)) ) * (0.5))\n    change [ghost v] effect by (([cos v] of ((timer) * (100)) ) * (0.5))\n    change x by (Px)\n    change y by (Py2)\n    change [py2 v] by (-1)\nend\ndelete this clone\n\n@Flying particles\n\nwhen flag clicked\nhide\nforever\n    create clone of (_myself_ v)\n    wait (pick random (0.2) to (0.3)) seconds\nend\n\nwhen I start as a clone\nshow\ngo to x: (pick random (230) to (-230)) y: (-120)\nset size to (pick random (50) to (90)) %\nset [x clone v] to (pick random (-2) to (2))\nset [y clone v] to (pick random (2) to (4))\nset [gra v] to [0]\nrepeat until <touching (_edge_ v)?>\n    change size by (([cos v] of ((grA) * (100)) ) * (0.5))\n    change x by (x clone)\n    change y by (y clone)\n    change [gra v] by (0.1)\nend\ndelete this clone\n\n@Sun\n\nwhen flag clicked\nforever\n    go to [back v] layer\n    turn right (1.5) degrees\nend\n\n@trampolines\n\nwhen flag clicked\nswitch costume to (costume1 v)\n\nwhen I receive [front v]\nshow\nwait (1) seconds\nnext costume\n\nwhen I receive [back v]\nswitch costume to ((costume [number v]) - (1))\n\n@Transition\n\nwhen I receive [front v]\nshow\ngo to [front v] layer\nset size to (200) %\nset [ghost v] effect to (0)\ngo to x: (-550) y: (0)\nrepeat (40)\n    change x by (((0) - (x position)) / (10))\nend\nwait (0.2) seconds\nrepeat (40)\n    change x by ((((200) - (x position)) / (10)) * (-1))\n    change [ghost v] effect by (2.5)\nend\nhide\nnext costume\n\nwhen flag clicked\nhide\nswitch costume to (costume1 v)\n\n@Game - Spinning spiked2\n\nwhen flag clicked\nswitch costume to (costume1 v)\n\nwhen I receive [back v]\nswitch costume to ((costume [number v]) - (1))\n\nwhen I receive [front v]\nshow\nwait (0.5) seconds\nnext costume\n\nwhen flag clicked\nforever\n    go to [back v] layer\n    point in direction ((90) + (([cos v] of ((timer) * (200)) ) * (-200)))\nend\n\n@Game - Spinning spiked3\n\nwhen flag clicked\nswitch costume to (costume1 v)\n\nwhen I receive [back v]\nswitch costume to ((costume [number v]) - (1))\n\nwhen I receive [front v]\nshow\nwait (0.5) seconds\nnext costume\n\nwhen flag clicked\nforever\n    go to [back v] layer\n    point in direction ((90) + (([cos v] of ((timer) * (200)) ) * (-200)))\nend\n\n@Enemies\n\nwhen flag clicked\nforever\n    if <not <(costume [number v]) = [8]>> then\n        broadcast (enemy, hide! v)\n    end\nend\n\nwhen flag clicked\nhide\nforever\n    go to x: (-47) y: (-116)\n    glide (1.3) secs to x: (86) y: (-116)\n    glide (1.3) secs to x: (-47) y: (-116)\nend\n\nwhen I receive [enemy, come out! v]\nshow\n\nwhen I receive [enemy, hide! v]\nhide\n\n@Tn\n\nwhen flag clicked\nhide\n\n