☁️  Sky High - A Multiplayer Platformer #games

Instructions: New Game Out! https://scratch.mit.edu/projects/865494166/\n\nSky High ✿  Multiplayer Scrolling Platformer \nNote: You must collect all coins to reach next level!\n\nCONTROLS-\n- WAD, Arrow keys to move or mobile controls.\n- Dodge Spikes and falling off the edge.\n- Race to the portal for next level!\n- 8 player slots\n - Cloud chat!\n- Press "n" to hide/show names\n- Press "t" to show/hide chat options\n- Press 1 - 9 to chat!\n- Scrolling vertically and horizontally\n- Enjoy!\n\n#Cloud #Online #Multiplayer #platformer #Games #Art #All #TeamYoshEEE

@Stage\n\nwhen [m v] key pressed\nset [mouse v] to (join (join ((mouse x) + (scroll x)) [ . ]) ((mouse y) + (scroll y)))\nshow variable [mouse v]\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\n\nwhen I receive [intro done v]\nswitch backdrop to (blank v)\n\nwhen flag clicked\nforever\n    set [collected show v] to (join (collected) (join [ / ] (collectable max)))\nend\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\nhide\nshow list [cloud chat items v]\nset [chat item v] to [0]\n\nwhen I receive [begin v]\nshow\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 <(STICK X) > [0.25]>> or <key (d v) pressed?>> then\n    change [sx v] by (2)\nend\nif <<<key (left arrow v) pressed?> or <(STICK X) < [-0.25]>> or <key (a v) pressed?>> then\n    change [sx v] by (-2)\nend\nif <<<key (up arrow v) pressed?> or <(STICK Y) > [0.25]>> 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        broadcast (doneeeee v)\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 (danger 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 [stop intro 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\nbroadcast (Stop intro v)\n\nwhen flag clicked\nwait (4.3) seconds\nforever\n    show variable [collected show v]\nend\n\nwhen flag clicked\nif <touching (bell v)?> then\n    broadcast (L3 v)\nend\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 (arrow v)\n    point towards (player v)\n    if on edge, bounce\nelse\n    switch costume to (costume1 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: [400]\nelse\n    switch costume to (7 v)\n    clone at x: [130] y: [400]\n    clone at x: [201] y: [500]\n    clone at x: [230] y: [550]\n    clone at x: [240] y: [530]\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\nwhen I receive [l3 v]\nswitch costume to (11 v)\n\n@collectables\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]\nset [x v] to [0]\nset [y v] to [0]\nif <(level) = [1]> then\n    switch costume to (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@danger\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: [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@Joining\n\nwhen flag clicked\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 [Connect v]\nswitch costume to (connected v)\nshow\nwait (1) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\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\n@notif\n\nwhen flag clicked\ngo to x: (0) y: (50)\ngo to [front v] layer\nhide\nwait (pick random (8) to (15)) seconds\nshow\nrepeat until <(y position) < [6]>\n    change y by (((5) - (y position)) / (6))\nend\nwait (3.5) seconds\nrepeat until <(y position) > [49.5]>\n    change y by (((y position) + (5)) / (5))\nend\nhide\nforever\n    wait (pick random (14) to (26)) seconds\n    show\n    repeat until <(y position) < [6]>\n        change y by (((5) - (y position)) / (6))\n    end\n    wait (3.5) seconds\n    repeat until <(y position) > [49.5]>\n        change y by (((y position) + (5)) / (5))\n    end\n    hide\nend\n\nwhen I receive [alert v]\nstop [other scripts in sprite v]\nrepeat (5)\n    change [ghost v] effect by (20)\nend\nhide\n\nwhen I receive [tick v]\ngo to [front v] layer\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@Detector\n\nwhen I start as a clone\nif <(clone id) = [0]> then\n    go to x: (-15) y: (0)\n    set [loved__ v] to [0]\n    switch costume to (love v)\n    forever\n        set [love? v] to <touching (mouse-pointer v)?>\n        if <touching (mouse-pointer v)?> then\n            set [loved__ v] to [1]\n        end\n    end\nend\nif <(clone id) = [1]> then\n    go to x: (0) y: (0)\n    switch costume to (fave v)\n    set [faved___ v] to [0]\n    forever\n        set [fav v] to <touching (mouse-pointer v)?>\n        if <touching (mouse-pointer v)?> then\n            set [faved___ v] to [1]\n        end\n    end\nend\n\nwhen flag clicked\nhide\nset [faved___ v] to [0]\nset [loved__ v] to [0]\nset [clone id v] to [0]\ncreate clone of (_myself_ v)\nwait (0.2) seconds\nset [clone id v] to [1]\ncreate clone of (_myself_ v)\nwait until <<(LOVED__) = [1]> and <(FAVED___) = [1]>>\nwait (1) seconds\nchange [collected show v] by (10)\nshow\ngo to [front v] layer\ngo to x: (0) y: (50)\nreset timer\nswitch costume to (pick random (1) to (4))\nset [ghost v] effect to (100)\nrepeat until <(timer) > [3.5]>\n    change y by ((y position) / (-15))\n    change [ghost v] effect by (-3)\nend\nreset timer\nrepeat until <(timer) > [3.5]>\n    change y by (((y position) - (-100)) / (-15))\n    change [ghost v] effect by (10)\nend\n\n@Sprite1\n\nwhen flag clicked\nwait (4) seconds\nforever\n    play sound [Piano v] until done\nend\n\n@Sprite2\n\n@Sprite3\n\n@Sprite4\n\n@tn2\n\nwhen flag clicked\nhide variable [collected v]\nshow\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 (costume2 v)\n    end\nend\n\nwhen flag clicked\nswitch costume to (costume 1 v)\nset [level v] to [1]\nwait until <(level) = [3]>\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]\nbroadcast (win animation v) and wait\nstop [all v]\n\nwhen flag clicked\nset [play? v] to [0]\nreset timer\nhide variable [show v]\nhide variable [seconds v]\nshow variable [collected 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\nshow variable [collected show v]\n\nwhen flag clicked\nshow\ngo to [front v] layer\n\nwhen flag clicked\n\nwhen I receive [doneeeee v]\nif <(exit) = [end]> then\n    switch costume to (costume 2 v)\n    go to [front v] layer\n    show variable [seconds v]\n    show\nend\n\n@JoyStick\n\nwhen flag clicked\ngo to [front v] layer\nset size to (125) %\nset [max stick v] to ((size) / (4))\nset [myself v] to [JoyStick]\ngo to x: (-165) y: (-115)\nswitch costume to (base v)\nset [ghost v] effect to (60)\ncreate clone of (_myself_ v)\nshow\n\nwhen I start as a clone\nswitch costume to (joystick v)\ngo [forward v] (1) layers\nset [ghost v] effect to (25)\nforever\n    set [stick power v] to []\n    set [stick x v] to [0]\n    set [stick y v] to [0]\n    repeat until <mouse down?>\n        go to (myself)\n    end\n    if <(distance to [mouse-pointer v]) < ((size) * (0.5))> then\n        Stick Drag\n    else\n        wait until <not <mouse down?>>\n    end\nend\n\ndefine Stick Drag\nrepeat until <not <mouse down?>>\n    go to (mouse-pointer v)\n    point towards (myself)\n    turn right (180) degrees\n    set [stick direction v] to (direction)\n    set [stick power v] to (distance to [(myself) v])\n    if <(STICK POWER) > (max stick)> then\n        move ((max stick) - (STICK POWER)) steps\n        set [stick power v] to (max stick)\n    end\n    set [stick power v] to ((STICK POWER) / (max stick))\n    set [stick x v] to ((STICK POWER) * ([sin v] of (STICK DIRECTION) ))\n    set [stick y v] to ((STICK POWER) * ([cos v] of (STICK DIRECTION) ))\nend\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    switch costume to (costume1 v)\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 (closed v)\n    clone at x: [1085] y: [1000]\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 (open v)\n\nwhen flag clicked\nhide\n\n