Cloud Platformer Multiplayer Fun v1.42


@Stage\n\nwhen flag clicked\nswitch backdrop to (stripes v)\nset [brightness v] effect to (70)\nbroadcast (menu v)\n\nwhen I receive [card make v]\nforever\n    switch backdrop to (back design)\nend\n\nwhen I receive [play card v]\nswitch backdrop to (back design)\nforever\n    play sound [Happy-birthday-instrumental v] until done\nend\n\nwhen I receive [broccoli attack v]\nstop [other scripts in sprite v]\nstop all sounds\n\nwhen I receive [lights on v]\nplay sound [Video Game 2 v] until done\nforever\n    play sound [Video Game 1 v] until done\nend\n\nwhen I receive [candle collected v]\nstop [other scripts in sprite v]\nstop all sounds\nplay sound [Win v] until done\nwait (.5) seconds\nplay sound [Happy-birthday-instrumental v] until done\n\n@Text\n\ndefine text: (text) start x: (x) y: (y) end x: (x2) y: (y2) size: (size) effect: (effect) wait: (wait time) sound: (sound)\nset [animation v] to (effect)\nset size to (0) %\nhide\nset [goal size v] to (size)\nset [sound v] to (sound)\ngo to x: (x) y: (y)\nset [goal y v] to (y2)\nset [goal x v] to ((x2) - ((((length of (text)) / (2)) - (.5)) * (((size) / (100)) * (9))))\nset [letter v] to [1]\nrepeat (length of (text))\n    if < [qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890'] contains (letter (letter) of (text))?> then\n        switch costume to (letter (letter) of (text))\n        create clone of (_myself_ v)\n    end\n    change [goal x v] by (((size) / (100)) * (9))\n    change [letter v] by (1)\n    wait (wait time) seconds\nend\n\nwhen I start as a clone\nif <(animation) = [pop]> then\n    show\n    if <(sound) = [1]> then\n        start sound [Finger Snap v]\n    end\n    repeat (25)\n        change x by (((goal x) - (x position)) * (.2))\n        change y by (((goal y) - (y position)) * (.2))\n        change size by (((goal size) - (size)) * (.2))\n    end\n    go to x: (goal x) y: (goal y)\n    set size to (goal size) %\n    change [letters done v] by (1)\nend\n\nwhen flag clicked\ndelete this clone\n\nwhen I start as a clone\nif <(animation) = [drop]> then\n    set x to (goal x)\n    set [y speed v] to [0]\n    set [bounce speed v] to (((y position) - (goal y)) * (.04))\n    show\n    set size to (goal size) %\n    repeat (4)\n        repeat until <(y position) < (goal y)>\n            change y by (y speed)\n            change [y speed v] by (-1)\n        end\n        start sound [pop v]\n        set [y speed v] to (bounce speed)\n        set [bounce speed v] to ((bounce speed) * (.6))\n        set y to ((goal y) + (1))\n    end\n    go to x: (goal x) y: (goal y)\n    change [letters done v] by (1)\nend\n\ndefine age finish\nif <<(age) > [10]> and <(age) < [14]>> then\n    set [age st/nd/rd/th v] to (join (age) [th])\nelse\n    if <(letter (length of (age)) of (age)) = [1]> then\n        set [age st/nd/rd/th v] to (join (age) [st])\n    else\n        if <(letter (length of (age)) of (age)) = [2]> then\n            set [age st/nd/rd/th v] to (join (age) [nd])\n        else\n            if <(letter (length of (age)) of (age)) = [3]> then\n                set [age st/nd/rd/th v] to (join (age) [rd])\n            else\n                set [age st/nd/rd/th v] to (join (age) [th])\n            end\n        end\n    end\nend\n\nwhen I start as a clone\nset [clone v] to [1]\ngo to [front v] layer\n\nwhen I receive [next age v]\nif <(clone) = [1]> then\n    if <(animation) = [type]> then\n        delete this clone\n    end\nelse\n    fast type\nend\n\nwhen I start as a clone\nif <(animation) = [type]> then\n    point in direction (90)\n    go to x: (goal x) y: (goal y)\n    set size to (goal size) %\n    show\nend\n\ndefine fast type\ntext: (candles) start x: [0] y: [0] end x: [-150] y: [-20] size: [600] effect: [type] wait: [0] sound: []\ntext: (candles) start x: [0] y: [0] end x: [150] y: [-20] size: [600] effect: [type] wait: [0] sound: []\n\nwhen I receive [pop wave v]\nif <(clone) = [1]> then\n    if <(animation) = [pop]> then\n        forever\n            if <((goal size) + ((100) - ([abs v] of ((x position) - (wave x)) ))) > (goal size)> then\n                set size to ((goal size) + ((100) - ([abs v] of ((x position) - (wave x)) ))) %\n            else\n                set size to (goal size) %\n            end\n        end\n    end\nelse\n    set [wave x v] to [-300]\n    forever\n        change [wave x v] by (10)\n        if <(wave x) > [300]> then\n            set [wave x v] to [-300]\n        end\n    end\nend\n\nwhen I receive [broccoli attack v]\nstop [other scripts in sprite v]\nset [brightness v] effect to (-40)\nwait (1) seconds\nif <(clone) = [0]> then\n    start sound [Wobble v]\nend\nset [x speed v] to (pick random (-7) to (7))\nset [y speed v] to (pick random (2) to (40))\nrepeat until <touching (_edge_ v)?>\n    change x by (x speed)\n    change y by (y speed)\n    turn right (x speed) degrees\n    change [y speed v] by (-1)\nend\ndelete this clone\n\nwhen I receive [lights on v]\nset [brightness v] effect to (0)\n\nwhen I receive [candle collected v]\nwait (.01) seconds\ntext: [you] start x: [0] y: [60] end x: [0] y: [100] size: [700] effect: [pop] wait: [0.05] sound: [1]\ntext: [win] start x: [0] y: [60] end x: [0] y: [20] size: [700] effect: [pop] wait: [0.05] sound: [1]\nwait (1) seconds\ntext: (join [congrats on turning ] (age)) start x: [0] y: [180] end x: [0] y: [-80] size: [200] effect: [drop] wait: [0.07] sound: []\n\nwhen I receive [candle collected v]\ndelete this clone\n\nwhen I receive [level start v]\npoint in direction (90)\nwait (0.01) seconds\nif <not <(known level) = (level)>> then\n    level word type\nend\n\nwhen I receive [level start v]\nif <not <(known level) = (level)>> then\n    delete this clone\nend\n\nwhen I receive [play card v]\nset [known level v] to [0]\npoint in direction (90)\nclear graphic effects\nset [color v] effect to (text color)\nset [clone v] to [0]\nage finish\nset [letters done v] to [0]\ntext: (join [Happy ] (age st/nd/rd/th)) start x: [0] y: [0] end x: [0] y: [130] size: [450] effect: [pop] wait: [0.05] sound: [1]\ntext: [Birthday] start x: [0] y: [0] end x: [0] y: [75] size: [500] effect: [pop] wait: [0.05] sound: [1]\nwait until <(letters done) = ((length of (age)) + (13))>\nbroadcast (pop wave v)\nset [letters done v] to [0]\ntext: (name) start x: [0] y: [200] end x: [0] y: [-130] size: ((300) + ((1700) / (length of (name)))) effect: [drop] wait: [0.07] sound: []\nwait until <(letters done) = (length of (name))>\nbroadcast (cake in v) and wait\nbroadcast (are you one v) and wait\nwait (3) seconds\nbroadcast (broccoli attack v)\n\nwhen I receive [menu v]\npoint in direction (90)\nset [menu done v] to [0]\ntext: [Welcome to] start x: [0] y: [-180] end x: [0] y: [140] size: [200] effect: [pop] wait: [0.05] sound: [1]\ntext: [birthday card] start x: [240] y: [-180] end x: [0] y: [100] size: [400] effect: [pop] wait: [0.05] sound: [1]\ntext: [platformer] start x: [-240] y: [-180] end x: [0] y: [50] size: [400] effect: [pop] wait: [0.05] sound: [1]\ntext: [Select a button to start] start x: [0] y: [180] end x: [0] y: [-20] size: [200] effect: [drop] wait: [0.01] sound: []\nset [menu done v] to [1]\n\nwhen I receive [delete menu v]\nstop [other scripts in sprite v]\ndelete this clone\n\ndefine level word type\nif <(level) = [1]> then\n    text: [oh no] start x: [0] y: [0] end x: [0] y: [140] size: [150] effect: [pop] wait: [0] sound: []\n    text: [the mushrooms stole the last candle] start x: [0] y: [0] end x: [0] y: [120] size: [150] effect: [pop] wait: [0] sound: []\n    text: [we have to go after them] start x: [0] y: [0] end x: [0] y: [100] size: [150] effect: [pop] wait: [0] sound: []\nend\nif <(level) = [2]> then\n    text: [watch out for holes] start x: [0] y: [0] end x: [0] y: [130] size: [150] effect: [pop] wait: [0] sound: []\n    text: [you don't want to fall] start x: [0] y: [0] end x: [0] y: [110] size: [150] effect: [pop] wait: [0] sound: []\nend\nif <(level) = [3]> then\n    text: [make sure you don't get eaten] start x: [0] y: [0] end x: [0] y: [130] size: [150] effect: [pop] wait: [0] sound: []\n    text: (join [before ] (join (name) [ blows out the candles])) start x: [0] y: [0] end x: [0] y: [110] size: [140] effect: [pop] wait: [0] sound: []\nend\nif <(level) = [4]> then\n    text: [ewwww] start x: [0] y: [0] end x: [0] y: [130] size: [150] effect: [pop] wait: [0] sound: []\n    text: [don't contaminate yourself] start x: [0] y: [0] end x: [0] y: [110] size: [150] effect: [pop] wait: [0] sound: []\nend\nif <(level) = [5]> then\n    text: [double trouble] start x: [0] y: [0] end x: [0] y: [120] size: [150] effect: [pop] wait: [0] sound: []\nend\nif <(level) = [6]> then\n    text: [hurry] start x: [0] y: [0] end x: [0] y: [140] size: [160] effect: [pop] wait: [0] sound: []\n    text: [without this candle] start x: [0] y: [0] end x: [0] y: [120] size: [150] effect: [pop] wait: [0] sound: []\n    text: (join (join [how will ] (name)) (join [ turn ] (age))) start x: [0] y: [0] end x: [0] y: [100] size: [150] effect: [pop] wait: [0] sound: []\nend\nif <(level) = [7]> then\n    text: [someone's hungry] start x: [0] y: [0] end x: [0] y: [120] size: [150] effect: [pop] wait: [0] sound: []\nend\nif <(level) = [8]> then\n    text: [it's all about timing] start x: [0] y: [0] end x: [0] y: [120] size: [150] effect: [pop] wait: [0] sound: []\nend\nif <(level) = [9]> then\n    text: [here's a joke] start x: [0] y: [0] end x: [0] y: [160] size: [150] effect: [pop] wait: [0] sound: []\n    text: [how many bananas does it] start x: [0] y: [0] end x: [0] y: [140] size: [150] effect: [pop] wait: [0] sound: []\n    text: [take to change a lightbulb] start x: [0] y: [0] end x: [0] y: [120] size: [150] effect: [pop] wait: [0] sound: []\nend\nif <(level) = [10]> then\n    text: [a bunch] start x: [0] y: [0] end x: [0] y: [150] size: [150] effect: [pop] wait: [0] sound: []\nend\nif <(level) = [11]> then\n    text: [almost there] start x: [0] y: [0] end x: [0] y: [140] size: [150] effect: [pop] wait: [0] sound: []\nend\nif <(level) = [12]> then\n    text: [there it is] start x: [0] y: [0] end x: [0] y: [160] size: [150] effect: [pop] wait: [0] sound: []\n    text: [go get that candle] start x: [0] y: [0] end x: [0] y: [140] size: [150] effect: [pop] wait: [0] sound: []\nend\nset [known level v] to (level)\n\nwhen I receive [card make v]\nset [age v] to [1]\nset [name v] to [name]\nset [back color v] to [80]\nset [text color v] to [0]\nset [back design v] to [1]\nset [cake flavor v] to [1]\nset [icing color v] to [0]\nshow variable [age v]\nshow variable [icing color v]\nshow variable [back color v]\nshow variable [text color v]\nshow variable [back design v]\nshow variable [cake flavor v]\nforever\n    broadcast (delete clones v)\n    age finish\n    menu card type\n    color set\nend\n\nwhen I receive [delete clones v]\ndelete this clone\n\ndefine menu card type\ntext: (join [Happy ] (age st/nd/rd/th)) start x: [0] y: [0] end x: [0] y: [130] size: [450] effect: [type] wait: [0] sound: []\ntext: [Birthday] start x: [0] y: [0] end x: [0] y: [75] size: [500] effect: [type] wait: [0] sound: []\ntext: (name) start x: [0] y: [0] end x: [0] y: [-130] size: ((300) + ((1700) / (length of (name)))) effect: [type] wait: [0] sound: []\n\ndefine color set\nset [color v] effect to (text color)\nset [brightness v] effect to (0)\n\nwhen I receive [menu v]\nhide variable [age v]\nhide variable [icing color v]\nhide variable [back color v]\nhide variable [cake flavor v]\nhide variable [back design v]\nhide variable [text color v]\n\ndelete this clone\n\ngo to [front v] layer\ntext: [Birthday card] start x: [0] y: [0] end x: [60] y: [140] size: [300] effect: [type] wait: [0] sound: []\ntext: [Platformer] start x: [0] y: [0] end x: [100] y: [100] size: [300] effect: [type] wait: [0] sound: []\n\n@Cake1\n\nwhen flag clicked\nset rotation style [left-right v]\nhide\n\nwhen I receive [cake in v]\nclear graphic effects\nstart sound [Tada v]\nclone setup\ncolor set\nrepeat (20)\n    change size by (25)\nend\nset size to (1300) %\n\nwhen I start as a clone\nset size to (500) %\npoint in direction (pick random (0) to (360))\nset [ghost v] effect to (70)\nshow\nrepeat (30)\n    move (3) steps\n    change [ghost v] effect by (1)\n    go to [front v] layer\nend\ndelete this clone\n\ndefine clone setup\nswitch costume to (smoke v)\nrepeat (12)\n    go to x: (pick random (-10) to (10)) y: (pick random (-10) to (-30))\n    create clone of (_myself_ v)\nend\nswitch costume to (frosting v)\npoint in direction (90)\nshow\ngo to [front v] layer\nset size to (800) %\ngo to x: (0) y: (-20)\n\nwhen I receive [broccoli attack v]\nstop [other scripts in sprite v]\nchange [brightness v] effect by (-40)\n\nwhen I receive [beam done v]\nwait (1) seconds\nset [cake y v] to (y position)\nset [cake x v] to [0]\nset [y speed v] to [10]\nstart sound [Wobble v]\nrepeat until <(cake y) < [-110]>\n    change [cake y v] by (y speed)\n    change [y speed v] by (-1)\n    broadcast (cake costume tick v)\nend\nset [cake y v] to [-100]\nstart sound [Water Drop v]\nwait (1) seconds\nbroadcast (lights on v)\n\nwhen I receive [cake costume tick v]\ngo to x: (cake x) y: (cake y)\npoint in direction (cake direction)\n\nwhen I receive [lights on v]\nchange [brightness v] effect by (40)\n\nwhen I receive [candle collected v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [card make v]\nforever\n    show\n    go to x: (0) y: (-20)\n    color set\n    if <<key (n v) pressed?> and <(name changing) = [0]>> then\n        broadcast (new name v)\n        set [name changing v] to [1]\n    end\n    if <<key (s v) pressed?> and <(save code changing) = [0]>> then\n        broadcast (make code v)\n        set [save code changing v] to [1]\n    end\nend\n\ndefine color set\nif <(icing color) = [-1]> then\n    set [brightness v] effect to (40)\n    set [color v] effect to (22)\nelse\n    if <(icing color) = [201]> then\n        set [brightness v] effect to (-45)\n        set [color v] effect to (16)\n    else\n        set [color v] effect to (icing color)\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen I receive [new name v]\nask [Enter a new name.] and wait\ncheck name\nset [name changing v] to [0]\n\ndefine check name\nset [name letter v] to [0]\nif <(length of (answer)) > [12]> then\n    broadcast (name too long v)\n    stop [this script v]\nelse\n    if <(length of (answer)) < [2]> then\n        broadcast (name too short v)\n        stop [this script v]\n    else\n        repeat (length of (answer))\n            change [name letter v] by (1)\n            if <not < [qwertyuiopasdfghjklzxcvbnm QWERTYUIOPASDFGHJKLZXCVBNM1234567890'] contains (letter (name letter) of (answer))?>> then\n                broadcast (invalid characters v)\n                stop [this script v]\n            end\n        end\n    end\nend\nset [name v] to (answer)\n\nwhen I receive [name too long v]\nsay [Name above 12 character maximum] for (3) seconds\n\nwhen I receive [invalid characters v]\nsay [You can only use letters, numbers, and apostrophe] for (3) seconds\n\nwhen I receive [name too short v]\nsay [Name below the 2 character minimum] for (3) seconds\n\nwhen I receive [make code v]\nif <(length of [1.copy code 2. restart project 3.click "play card" + paste v]) = [1]> then\n    show list [1.copy code 2. restart project 3.click "play card" + paste v]\n    delete all of [1.copy code 2. restart project 3.click "play card" + paste v]\nelse\n    make code\n    hide list [1.copy code 2. restart project 3.click "play card" + paste v]\nend\nwait until <not <key (s v) pressed?>>\nset [save code changing v] to [0]\n\ndefine make code\nadd [] to [1.copy code 2. restart project 3.click "play card" + paste v]\nmake (age) [3] digits\nmake (back design) [1] digits\nmake (back color) [3] digits\nmake (icing color) [3] digits\nmake (cake flavor) [1] digits\nmake (text color) [3] digits\nreplace item (1) of [1.copy code 2. restart project 3.click "play card" + paste v] with (join (item (1) of [1.copy code 2. restart project 3.click "play card" + paste v]) (name))\n\ndefine make (variable) (digits) digits\nif <(letter (1) of (variable)) = [-]> then\n    set [temp var v] to (letter (2) of (variable))\n    repeat until <(length of (temp var)) > ((digits) - (2))>\n        set [temp var v] to (join [0] (temp var))\n    end\n    set [temp var v] to (join [-] (temp var))\nelse\n    set [temp var v] to (variable)\n    repeat until <(length of (temp var)) > ((digits) - (1))>\n        set [temp var v] to (join [0] (temp var))\n    end\nend\nreplace item (1) of [1.copy code 2. restart project 3.click "play card" + paste v] with (join (item (1) of [1.copy code 2. restart project 3.click "play card" + paste v]) (temp var))\n\nwhen I receive [menu v]\nshow list [1.copy code 2. restart project 3.click "play card" + paste v]\ndelete all of [1.copy code 2. restart project 3.click "play card" + paste v]\n\n@Cake2\n\nwhen flag clicked\nset rotation style [left-right v]\nhide\n\nwhen I receive [cake in v]\nclear graphic effects\nswitch costume to (cake v)\npoint in direction (90)\nshow\ngo to [front v] layer\nset size to (800) %\ngo to x: (0) y: (-20)\nflavor set\nrepeat (20)\n    change size by (25)\n    go to [front v] layer\nend\nset size to (1300) %\n\nwhen I receive [broccoli attack v]\nstop [other scripts in sprite v]\nchange [brightness v] effect by (-40)\n\nwhen I receive [cake costume tick v]\ngo to x: (cake x) y: (cake y)\npoint in direction (cake direction)\n\nwhen I receive [lights on v]\nchange [brightness v] effect by (40)\n\nwhen I receive [candle collected v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [card make v]\nforever\n    go to x: (0) y: (-20)\n    go to [front v] layer\n    flavor set\n    show\nend\n\ndefine flavor set\nif <(cake flavor) = [1]> then\n    set [color v] effect to (0)\n    set [brightness v] effect to (0)\nelse\n    if <(cake flavor) = [2]> then\n        set [color v] effect to (-8)\n        set [brightness v] effect to (-65)\n    else\n        set [color v] effect to (-22)\n        set [brightness v] effect to (-50)\n    end\nend\n\n@fade\n\nwhen flag clicked\npoint in direction (90)\nset size to (100) %\nswitch costume to (color v)\ngo to x: (0) y: (0)\nset [color v] effect to (80)\nset [brightness v] effect to (0)\nforever\n    go to [back v] layer\nend\n\nwhen I receive [broccoli attack v]\nset [brightness v] effect to (-100)\n\nwhen I receive [lights on v]\nset [brightness v] effect to (0)\n\nwhen I start as a clone\nset size to (80) %\nset [clone v] to [1]\nswitch costume to (star v)\ngo to (candle v)\nforever\n    turn right (1) degrees\nend\n\nwhen I receive [candle collected v]\nif <(clone) = [1]> then\n    if <(costume [name v]) = [star]> then\n        repeat (20)\n            change size by (-8)\n            turn right (1) degrees\n        end\n        delete this clone\n    end\nend\n\nwhen I receive [card make v]\npoint in direction (90)\nset size to (100) %\nswitch costume to (color v)\ngo to x: (0) y: (0)\nset [brightness v] effect to (0)\nforever\n    set [color v] effect to (back color)\n    go to [back v] layer\nend\n\nwhen I receive [play card v]\nset [color v] effect to (back color)\n\nwhen I receive [level start v]\ndelete this clone\n\n@candle\n\nwhen flag clicked\npoint in direction (90)\nset [candle id v] to [0]\nhide\n\nwhen I receive [are you one v]\ngo to x: (-5) y: (200)\nif <(age) < [19]> then\n    set [candles per row v] to ([ceiling v] of ((age) / (6)) )\nelse\n    set [candles per row v] to [4]\nend\nset [candles v] to [0]\nchange x by ((0) - (((([ceiling v] of ((age) / (candles per row)) ) - (1)) / (2)) * ((90) / ([ceiling v] of ((age) / (candles per row)) ))))\nrepeat ([ceiling v] of ((age) / (candles per row)) )\n    set y to (165)\n    change y by ((((candles per row) - (1)) / (2)) * ((30) / (candles per row)))\n    set [candles in current row v] to [0]\n    repeat until <<(candles in current row) = (candles per row)> or <(candles) = (age)>>\n        create clone of (_myself_ v)\n        change y by ((-30) / (candles per row))\n        wait (.25) seconds\n    end\n    change x by ((90) / ([ceiling v] of ((age) / (candles per row)) ))\nend\n\nwhen I start as a clone\nstart sound [High Whoosh v]\nclear graphic effects\nchange [candles v] by (1)\nchange [candles in current row v] by (1)\nset [candle id v] to (candles)\nbroadcast (next age v)\ngo to [front v] layer\nset size to (95) %\nshow\nrepeat (20)\n    turn right (18) degrees\n    change y by (-8)\n    change size by (-4)\nend\n\nwhen I receive [broccoli attack v]\nstop [other scripts in sprite v]\nset [brightness v] effect to (-40)\nif <(candle ID) = (age)> then\n    set [broccoli attack x v] to (x position)\nend\n\nwhen I receive [beam v]\nif <(candle ID) = (age)> then\n    set [y speed v] to [1]\n    repeat until <(y position) > [60]>\n        change y by (y speed)\n        set [y speed v] to ((y speed) * (1.1))\n    end\n    broadcast (beam done v)\n    delete this clone\nend\n\nwhen I receive [beam done v]\nwait (1) seconds\nset [y speed v] to (pick random (10) to (20))\nset [x speed v] to (pick random (-7) to (7))\nrepeat until <touching (_edge_ v)?>\n    change y by (y speed)\n    change x by (x speed)\n    turn right (x speed) degrees\n    change [y speed v] by (-1)\nend\ndelete this clone\n\nwhen I receive [lights on v]\nset [brightness v] effect to (0)\n\nwhen I receive [level start v]\nif <(level) = [12]> then\n    go to x: (195) y: (130)\n    show\n    go to [front v] layer\n    create clone of (fade v)\n    wait until <touching (cake hitbox v)?>\n    broadcast (candle collected v)\nend\n\nwhen I receive [candle collected v]\nstop [other scripts in sprite v]\nhide\n\n@Mushroom UFO\n\nwhen flag clicked\npoint in direction (90)\nset size to (50) %\nhide\n\nwhen I receive [broccoli attack v]\nwait (2) seconds\ngo to x: (-280) y: (80)\nshow\nstart sound [Zoop v]\nrepeat (30)\n    change x by ([abs v] of (((x position) - (broccoli attack x)) * (.15)) )\nend\nset x to (broccoli attack x)\nbroadcast (beam v)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nstart sound [Teleport v]\nswitch costume to (beam v)\nchange y by (-1)\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\nwhen I receive [beam done v]\nif <(y position) = [80]> then\n    wait (.5) seconds\n    start sound [Zoop v]\n    repeat until <(x position) > [240]>\n        change x by (20)\n    end\n    hide\nelse\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    delete this clone\nend\n\nwhen I receive [lights on v]\nset [brightness v] effect to (0)\n\n@ground\n\nwhen flag clicked\nhide\n\nwhen I receive [beam done v]\nwait (1) seconds\nswitch costume to (level 1 v)\nshow\ngo to x: (0) y: (-50)\nrepeat (10)\n    change y by (5)\nend\ngo to x: (0) y: (0)\n\nwhen I receive [broccoli attack v]\nset [brightness v] effect to (-20)\n\nwhen I receive [lights on v]\nset [brightness v] effect to (0)\n\nwhen I receive [level start v]\ngo to x: (0) y: (0)\nswitch costume to (level)\nshow\n\nwhen I receive [candle collected v]\nrepeat (20)\n    change y by (-18)\nend\nhide\n\nwhen I receive [platform start v]\ngo to x: (0) y: (0)\n\n@cake hitbox\n\nwhen flag clicked\nset [cake direction v] to [90]\nset rotation style [left-right v]\nhide\nset size to (1300) %\n\nwhen I receive [lights on v]\nset [ghost v] effect to (100)\nshow\ngo to x: (cake x) y: (cake y)\nrepeat until <not <touching (ground v)?>>\n    change y by (4)\n    set [cake x v] to (x position)\n    set [cake y v] to (y position)\n    broadcast (cake costume tick v)\nend\nrepeat until <touching (ground v)?>\n    change y by (-1)\n    set [cake x v] to (x position)\n    set [cake y v] to (y position)\n    broadcast (cake costume tick v)\nend\nchange y by (1)\nset [cake y v] to (y position)\nbroadcast (platform start v)\n\nwhen I receive [platform start v]\nset [level v] to [1]\nbroadcast (level start v)\n\ndefine when <key pressed> set x speed to (walk speed)\nif <key pressed> then\n    change x by (walk speed)\n    set [x speed v] to (walk speed)\n    if <<(x position) > [239]> and <(level) < [12]>> then\n        change [level v] by (1)\n        start sound [Magic Spell v]\n        create clone of (curtain v)\n        broadcast (level start v)\n    end\n    if <touching (ground v)?> then\n        check climb slope: [8]\n    end\n    set [cake direction v] to (((x speed) / ([abs v] of (x speed) )) * (90))\nend\n\ndefine when <key pressed> set y speed to (jump speed)\nif <key pressed> then\n    change y by (-1)\n    if <<touching (ground v)?> or <(time since jump) < [9]>> then\n        set [y speed v] to (jump speed)\n        set [time since jump v] to [9]\n        start sound [Jump v]\n    end\n    change y by (1)\nend\nchange y by (y speed)\n\ndefine move out of ground\nif <touching (ground v)?> then\n    repeat until <not <touching (ground v)?>>\n        if <(y speed) < [0]> then\n            change y by (1)\n        else\n            change y by (-1)\n        end\n    end\n    set [y speed v] to [0]\nelse\n    change y by (-1)\n    if <not <touching (ground v)?>> then\n        change [y speed v] by (-1)\n    end\n    change y by (1)\nend\n\nwhen I receive [cake costume tick v]\ngo to x: (cake x) y: (cake y)\npoint in direction (cake direction)\n\ndefine check climb slope: (slope height)\nrepeat (slope height)\n    change y by (1)\n    if <not <touching (ground v)?>> then\n        stop [this script v]\n    end\nend\nchange y by ((0) - (slope height))\nchange x by ((0) - (x speed))\n\ndefine check if on ground\nchange y by (-1)\nif <touching (ground v)?> then\n    set [time since jump v] to [0]\nelse\n    change [time since jump v] by (1)\nend\nchange y by (1)\n\nwhen I receive [level start v]\nstop [other scripts in sprite v]\nlevel start position\nset [y speed v] to [0]\nset [x speed v] to [0]\nforever\n    set [x speed v] to [0]\n    when <<key (right arrow v) pressed?> or <key (d v) pressed?>> set x speed to [5]\n    when <<key (left arrow v) pressed?> or <key (a v) pressed?>> set x speed to [-5]\n    when <<key (up arrow v) pressed?> or <key (w v) pressed?>> set y speed to [16]\n    move out of ground\n    check if on ground\n    set [cake x v] to (x position)\n    set [cake x speed v] to (x speed)\n    set [cake y v] to (y position)\n    set [cake y speed v] to (y speed)\n    broadcast (cake costume tick v)\n    if <(y position) < [-175]> then\n        start sound [Oops2 v]\n        create clone of (curtain v)\n        broadcast (level start v)\n    end\nend\n\ndefine level start position\nreset timer\nif <(level) = [1]> then\n    go to x: (0) y: (-80)\nelse\n    if <<<(level) > [1]> and <(level) < [9]>> or <(level) > [10]>> then\n        go to x: (-223) y: (-90)\n    else\n        go to x: (-223) y: (170)\n    end\nend\n\nwhen I receive [candle collected v]\nstop [other scripts in sprite v]\n\nset y to (0)\n\nset y to (0)\n\n@Cake Legs\n\nwhen flag clicked\nset [cake costume tick v] to [0]\nset rotation style [left-right v]\nhide\nset size to (1300) %\n\nwhen I receive [lights on v]\nshow\n\nwhen I receive [cake costume tick v]\ngo to x: (cake x) y: (cake y)\npoint in direction (cake direction)\nif <(cake y speed) > [0]> then\n    switch costume to (jump v)\nelse\n    if <<(cake y speed) < [1]> and <not <(time since jump) < [9]>>> then\n        switch costume to (fall v)\n    else\n        if <([abs v] of (cake x speed) ) > [0]> then\n            change [cake costume tick v] by (.5)\n            switch costume to ((([ceiling v] of (cake costume tick) ) mod (8)) + (1))\n        else\n            switch costume to (stand v)\n        end\n    end\nend\n\nwhen I receive [candle collected v]\nstop [other scripts in sprite v]\nhide\n\n@Cake Arms\n\nwhen flag clicked\nset [cake costume tick v] to [0]\nset rotation style [left-right v]\nhide\nset size to (1300) %\n\nwhen I receive [lights on v]\nshow\n\nwhen I receive [cake costume tick v]\ngo to [front v] layer\ngo to x: (cake x) y: (cake y)\npoint in direction (cake direction)\nif <(cake y speed) > [0]> then\n    switch costume to (jump v)\nelse\n    if <<(cake y speed) < [1]> and <not <(time since jump) < [9]>>> then\n        switch costume to (fall v)\n    else\n        if <([abs v] of (cake x speed) ) > [0]> then\n            change [cake costume tick v] by (.5)\n            switch costume to ((([ceiling v] of (cake costume tick) ) mod (8)) + (1))\n        else\n            switch costume to (stand v)\n        end\n    end\nend\n\nwhen I receive [candle collected v]\nstop [other scripts in sprite v]\nhide\n\n@enemy\n\nwhen flag clicked\nset [clone v] to [0]\nhide\n\nwhen I receive [level start v]\nif <(clone) = [0]> then\n    if <(level) = [3]> then\n        Make clone at x: [0] y: [180] direction: [180] up speed: [12] down speed: [7] distance: [300] costume: [fork]\n    end\n    if <(level) = [4]> then\n        Make clone at x: [-100] y: [-90] direction: [90] up speed: [4] down speed: [4] distance: [200] costume: [mushroom]\n    end\n    if <(level) = [5]> then\n        Make clone at x: [-110] y: [-90] direction: [90] up speed: [3] down speed: [3] distance: [120] costume: [mushroom]\n        Make clone at x: [200] y: [-90] direction: [-90] up speed: [3] down speed: [3] distance: [120] costume: [mushroom]\n    end\n    if <(level) = [6]> then\n        Make clone at x: [-50] y: [20] direction: [90] up speed: [3] down speed: [3] distance: [100] costume: [mushroom]\n    end\n    if <(level) = [7]> then\n        Make clone at x: [-100] y: [180] direction: [180] up speed: [6] down speed: [6] distance: [220] costume: [fork]\n        Make clone at x: [215] y: [180] direction: [180] up speed: [10] down speed: [10] distance: [290] costume: [fork]\n    end\n    if <(level) = [8]> then\n        Make clone at x: [-85] y: [-180] direction: [0] up speed: [2] down speed: [3] distance: [110] costume: [fork]\n        Make clone at x: [75] y: [-180] direction: [0] up speed: [2] down speed: [3] distance: [110] costume: [fork]\n        Make clone at x: [-230] y: [15] direction: [90] up speed: [3] down speed: [3] distance: [295] costume: [mushroom]\n    end\n    if <(level) = [9]> then\n        Make clone at x: [200] y: [130] direction: [-90] up speed: [2] down speed: [2] distance: [30] costume: [fork]\n        Make clone at x: [205] y: [180] direction: [180] up speed: [9] down speed: [9] distance: [350] costume: [fork]\n    end\n    if <(level) = [10]> then\n        Make clone at x: [-190] y: [-180] direction: [36] up speed: [9] down speed: [9] distance: [365] costume: [fork]\n    end\n    if <(level) = [11]> then\n        Make clone at x: [70] y: [180] direction: [180] up speed: [12] down speed: [4] distance: [300] costume: [fork]\n        Make clone at x: [110] y: [-90] direction: [-90] up speed: [3] down speed: [3] distance: [100] costume: [mushroom]\n    end\nelse\n    delete this clone\nend\n\ndefine Make clone at x: (x) y: (y) direction: (direction) up speed: (up speed) down speed: (down speed) distance: (distance) costume: (costume)\ngo to x: (x) y: (y)\npoint in direction (direction)\nset [up speed v] to (up speed)\nset [down speed v] to (down speed)\nset [distance v] to (distance)\nset [start x v] to (x)\nset [start y v] to (y)\nswitch costume to (costume)\nif <(costume [name v]) = [fork]> then\n    go to [back v] layer\n    set rotation style [all around v]\nelse\n    set rotation style [left-right v]\nend\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nwait (0.01) seconds\nset [clone v] to [1]\nshow\nforever\n    go to x: (start x) y: (start y)\n    repeat (round ((distance) / (up speed)))\n        move (up speed) steps\n        if <(costume [name v]) = [fork]> then\n            check hit\n        else\n            costume set\n        end\n    end\n    if <(costume [name v]) = [fork]> then\n        repeat (round ((distance) / (down speed)))\n            move ((0) - (down speed)) steps\n            check hit\n        end\n    else\n        turn right (180) degrees\n        repeat (round ((distance) / (down speed)))\n            move (down speed) steps\n            costume set\n        end\n        turn right (180) degrees\n    end\nend\n\ndefine costume set\nchange [costume tick v] by ((1) / (5))\nset y to (start y)\ncheck hit\nif <([ceiling v] of ((costume tick) mod (2)) ) = [1]> then\n    change y by (6)\nend\n\ndefine check hit\nnext costume\nif <<touching (cake hitbox v)?> and <not <(timer) < [.25]>>> then\n    start sound [Oops2 v]\n    create clone of (curtain v)\n    broadcast (level start v)\nend\nswitch costume to ((costume [number v]) - (1))\n\n@Button\n\nwhen I receive [menu v]\nshow\npoint in direction (90)\nswitch costume to (neither v)\ngo to x: (0) y: (-100)\nset size to (0) %\nrepeat (30)\n    change size by (30)\n    turn right (24) degrees\nend\nset size to (900) %\nwait until <(menu done) = [1]>\nforever\n    if <touching (mouse-pointer v)?> then\n        if <(mouse x) < [0]> then\n            switch costume to (make v)\n            if <mouse down?> then\n                broadcast (delete menu v)\n                broadcast (curtain close v) and wait\n                hide\n                broadcast (curtain open v) and wait\n                broadcast (card make v)\n                stop [this script v]\n            end\n        else\n            switch costume to (play v)\n            if <mouse down?> then\n                start sound [Clock Ticking v]\n                ask [enter your code] and wait\n                Decode (answer)\n                if <(code valid) = [1]> then\n                    broadcast (delete menu v)\n                    broadcast (curtain close v) and wait\n                    hide\n                    broadcast (curtain open v) and wait\n                    broadcast (play card v)\n                    stop [this script v]\n                end\n            end\n        end\n    else\n        switch costume to (neither v)\n    end\nend\n\ndefine Decode (code)\nset [code valid v] to [0]\nset [code letter v] to [0]\nset [age v] to []\nset [back design v] to []\nset [back color v] to []\nset [icing color v] to []\nset [cake flavor v] to []\nset [text color v] to []\nset [name v] to []\nrepeat (3)\n    change [code letter v] by (1)\n    set [age v] to (join (age) (letter (code letter) of (code)))\n    if <not < [1234567890] contains (letter (code letter) of (code))?>> then\n        broadcast (code invalid v)\n        stop [this script v]\n    end\nend\nif <not <<(age) > [0]> and <(age) < [121]>>> then\n    broadcast (code invalid v)\n    stop [this script v]\nend\nrepeat (1)\n    change [code letter v] by (1)\n    set [back design v] to (join (back design) (letter (code letter) of (code)))\n    if <not < [1234567890] contains (letter (code letter) of (code))?>> then\n        broadcast (code invalid v)\n        stop [this script v]\n    end\nend\nif <not <<(back design) > [0]> and <(back design) < [4]>>> then\n    broadcast (code invalid v)\n    stop [this script v]\nend\nrepeat (3)\n    change [code letter v] by (1)\n    set [back color v] to (join (back color) (letter (code letter) of (code)))\n    if <not < [1234567890] contains (letter (code letter) of (code))?>> then\n        broadcast (code invalid v)\n        stop [this script v]\n    end\nend\nif <not <<(back color) > [-1]> and <(back color) < [201]>>> then\n    broadcast (code invalid v)\n    stop [this script v]\nend\nrepeat (3)\n    change [code letter v] by (1)\n    set [icing color v] to (join (icing color) (letter (code letter) of (code)))\n    if <not < [1234567890-] contains (letter (code letter) of (code))?>> then\n        broadcast (code invalid v)\n        stop [this script v]\n    end\nend\nif <not <<(icing color) > [-2]> and <(icing color) < [202]>>> then\n    broadcast (code invalid v)\n    stop [this script v]\nend\nrepeat (1)\n    change [code letter v] by (1)\n    set [cake flavor v] to (join (cake flavor) (letter (code letter) of (code)))\n    if <not < [1234567890] contains (letter (code letter) of (code))?>> then\n        broadcast (code invalid v)\n        stop [this script v]\n    end\nend\nif <not <<(cake flavor) > [0]> and <(cake flavor) < [4]>>> then\n    broadcast (code invalid v)\n    stop [this script v]\nend\nrepeat (3)\n    change [code letter v] by (1)\n    set [text color v] to (join (text color) (letter (code letter) of (code)))\n    if <not < [1234567890] contains (letter (code letter) of (code))?>> then\n        broadcast (code invalid v)\n        stop [this script v]\n    end\nend\nif <not <<(age) > [-1]> and <(age) < [201]>>> then\n    broadcast (code invalid v)\n    stop [this script v]\nend\nrepeat until <(code letter) = (length of (code))>\n    change [code letter v] by (1)\n    set [name v] to (join (name) (letter (code letter) of (code)))\n    if <not < [qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM 1234567890'] contains (letter (code letter) of (code))?>> then\n        broadcast (code invalid v)\n        stop [this script v]\n    end\nend\nif <not <<(length of (name)) > [1]> and <(length of (name)) < [13]>>> then\n    broadcast (code invalid v)\n    stop [this script v]\nend\nchange [age v] by (1)\nchange [back color v] by (1)\nchange [back design v] by (1)\nchange [icing color v] by (1)\nchange [cake flavor v] by (1)\nchange [text color v] by (1)\nchange [age v] by (-1)\nchange [back color v] by (-1)\nchange [back design v] by (-1)\nchange [icing color v] by (-1)\nchange [cake flavor v] by (-1)\nchange [text color v] by (-1)\nset [code valid v] to [1]\n\nwhen I receive [code invalid v]\nstart sound [Disconnect v]\nsay [code invalid] for (2) seconds\n\n@Curtain\n\nwhen I receive [curtain close v]\nif <(costume [number v]) = [1]> then\n    start sound [Connect v]\n    hide\n    go to x: (0) y: (360)\n    show\n    repeat (15)\n        go to [front v] layer\n        change y by (((0) - (y position)) * (.2))\n    end\n    go to x: (0) y: (0)\nend\n\nwhen I receive [curtain open v]\nif <(costume [number v]) = [1]> then\n    go to x: (0) y: (0)\n    show\n    repeat (15)\n        change y by (((y position) - (360)) * (.2))\n    end\n    go to x: (0) y: (-360)\n    hide\nend\n\nwhen flag clicked\nhide\nswitch costume to (white v)\nclear graphic effects\n\nwhen I start as a clone\nif <<([x position v] of [cake hitbox v]) > [239]> and <(level) < [12]>> then\n    switch costume to (green v)\nelse\n    switch costume to (red v)\nend\ngo to x: (0) y: (0)\nset [ghost v] effect to (0)\nset [brightness v] effect to (-50)\nshow\nrepeat (10)\n    change [ghost v] effect by (10)\n    change [brightness v] effect by (5)\nend\ndelete this clone\n\n@Thumbnail\n\ngo to x: (0) y: (0)\nshow\ngo to [front v] layer\n\nwhen flag clicked\nhide\n\n