Robot - A Multiplayer Platformer
@Stage\n\nwhen I receive [game tick v]\nreplace item (1) of [dev tools v] with [Press \(t\) to close]\nreplace item (2) of [dev tools v] with (join (join [Mouse: \(] (join ([floor v] of ((mouse x) + (~SCROLL X)) ) (join [, ] (mouse y)))) [\)])\nreplace item (3) of [dev tools v] with (join (join [Position: \(] (join ([floor v] of ([x v] of [player v]) ) (join [, ] ([floor v] of ([y v] of [player v]) )))) [\)])\nreplace item (4) of [dev tools v] with (join [Scroll X: ] ([floor v] of (~SCROLL X) ))\nreplace item (5) of [dev tools v] with (join (([floor v] of ([y v] of [player v]) ) + (91)) (join [, ] ([floor v] of (([y v] of [player v]) - (29)) )))\nreplace item (6) of [dev tools v] with (join [Time: ] ([floor v] of (*Game Time) ))\nreplace item (7) of [dev tools v] with (join [Completed: ] (☁ Completed))\nreplace item (8) of [dev tools v] with (join [Completed with Coin: ] (☁ Completed with Coin))\nreplace item (9) of [dev tools v] with (join [World Record: ] (☁ World Record))\n\nwhen flag clicked\nAdd\nset [-player deaths v] to [0]\nshow list [dev tools v]\nset [*game timer v] to [0]\nset [gameplay v] to [0]\nreplace item (1) of [collected coins v] with [0]\n\ndefine Add\ndelete all of [dev tools v]\nrepeat (9)\n    add [] to [dev tools v]\nend\n\nwhen I receive [game start v]\nset [gameplay v] to [1]\nrepeat until <(timer) > ((*Game Timer) + (300))>\n    if <(Gameplay) = [0]> then\n        stop [this script v]\n    end\n    set [*game time v] to ((timer) - (*Game Timer))\nend\nset [gameplay v] to [2]\nset [*player lives v] to [0]\n\nwhen I receive [game start v]\nforever\n    wait until <not <key (t v) pressed?>>\n    wait until <key (t v) pressed?>\n    hide list [dev tools v]\n    wait until <not <key (t v) pressed?>>\n    wait until <key (t v) pressed?>\n    show list [dev tools v]\nend\n\nwhen I receive [infinite tick v]\nif <mouse down?> then\n    change [~mouse v] by (1)\nelse\n    set [~mouse v] to [0]\nend\n\nwhen I receive [level complete v]\nset [gameplay v] to [0]\nif <(item (1) of [-level times v]) > ((*Game Time) - (1))> then\n    replace item (1) of [-level times v] with ((*Game Time) - (1))\nend\n\nwhen I receive [player death v]\nif <(Gameplay) = [1]> then\n    set [gameplay v] to [0]\nend\n\nwhen I receive [player death v]\nstop [other scripts in sprite v]\nstart sound [hurt v]\n\nwhen I receive [level complete v]\nstop [other scripts in sprite v]\n\nwhen I receive [game start v]\nset volume to (30) %\nforever\n    play sound [Itty Bitty 8 Bit v] until done\nend\n\n@Blank Sprite\n\nset [☁ completed v] to [0]\nset [☁ completed with coin v] to [0]\n\nset [☁ world record v] to [300]\n\nwhen flag clicked\nif <<(username) = [Animator180]> and <(☁ Scratcher Status) = [0]>> then\n    set [☁ scratcher status v] to [1]\nend\n\nset [☁ scratcher status v] to [0]\n\n@Player\n\nwhen flag clicked\nhide\n\ndefine Platformer\nset rotation style [left-right v]\nif <<(player state) = [crouch]> or <(player state) = [slide]>> then\n    switch costume to (crouch v)\nelse\n    switch costume to (hitbox v)\nend\nif <<(*Right Control) = [1]> and <(player state) = [normal]>> then\n    point in direction (90)\n    change [x vel v] by (2.5)\nend\nif <<(*Left Control) = [1]> and <(player state) = [normal]>> then\n    point in direction (-90)\n    change [x vel v] by (-2.5)\nend\nif <(player state) = [slide]> then\n    set [x vel v] to ((x vel) * (0.93))\n    set [y slope 2 v] to ((y) - (y slope))\n    set [y slope v] to (y)\n    if <(in air) > [0]> then\n        set [player state v] to [normal]\n    end\nelse\n    set [x vel v] to ((x vel) * (0.8))\n    set [y slope v] to [0]\n    set [y slope 2 v] to [0]\nend\nChange x by (round (x vel))\nif <(*Down Control) > [0]> then\n    if <([abs v] of (x vel) ) > [3]> then\n        if <(in air) = [0]> then\n            set [player state v] to [slide]\n            if <<(y slope 2) < [0]> and <([abs v] of (x vel) ) < [12]>> then\n                if <(x vel) > [0]> then\n                    change [x vel v] by (1)\n                else\n                    change [x vel v] by (-1)\n                end\n            end\n        end\n    else\n        if <(in air) = [0]> then\n            set [player state v] to [crouch]\n        end\n    end\nelse\n    if <([touch sensor v] of [sensor v]) = [false]> then\n        set [player state v] to [normal]\n    end\nend\nif <(player state) = [normal]> then\n    set [previous direction v] to (direction)\n    if <(Player Bounce?) = [1]> then\n        if <<(*Up) > [0]> and <not <(player state) = [hurt]>>> then\n            set [y vel v] to [18]\n        else\n            set [y vel v] to [12]\n        end\n    end\nend\nif <<<(*Up Limit) = [true]> and <(in air) < [4]>> and <not <(player state) = [hurt]>>> then\n    if <<([touch sensor v] of [sensor v]) = [false]> and <not <(player state) = [crouch]>>> then\n        if <(in air) = [1]> then\n            start sound [Jump v]\n        end\n        set [y vel v] to [14]\n    end\nend\nif <(Player Hurt) = [1]> then\n    set [*player lives v] to [0]\nend\nchange [y vel v] by (-1)\nif <(y vel) < [-20]> then\n    set [y vel v] to [-20]\nend\nChange y by (y vel)\nPosition\nchange [~scroll x v] by (((x) - (~SCROLL X)) / (1))\nBoundaries\nif <(y) < [-180]> then\n    hide\n    set [*player lives v] to [0]\nend\nif <<touching (non-solid objects v)?> or <touching (pipe sensor v)?>> then\n    set [touching v] to [1]\nelse\n    set [touching v] to [0]\nend\nAnimation\n\ndefine Change y by (sy)\nchange [y v] by (round (sy))\nchange [in air v] by (1)\nPosition\nrepeat until <not <<touching (ground collision v)?> or <touching (solid objects v)?>>>\n    if <(sy) < [0]> then\n        set [in air v] to [0]\n        set [frames v] to [0]\n        change [y v] by (1)\n    else\n        change [y v] by (-1)\n        set [y vel v] to [0]\n    end\n    Position\n    set [y vel v] to (round ((y vel) * (0.9)))\nend\n\ndefine Change x by (sx)\nchange [x v] by (sx)\nPosition\nif <<touching (ground collision v)?> or <touching (solid objects v)?>> then\n    repeat (12)\n        change [y v] by (1)\n        Position\n        if <not <<touching (ground collision v)?> or <touching (solid objects v)?>>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-12)\n    repeat until <not <<touching (ground collision v)?> or <touching (solid objects 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 Position\ngo to x: ((x) - (~SCROLL X)) y: (y)\n\ndefine Setup\nset [*player lives v] to [1]\nset [level beaten? v] to [0]\nset [*down control v] to [0]\nset [*left control v] to [0]\nset [*right control v] to [0]\nset [*up v] to [0]\nset [x v] to [-175]\nset [y v] to [-66]\nset [x vel v] to [0]\nset [y vel v] to [0]\nset [~scroll x v] to [0]\nset [player state v] to [normal]\nset [in air v] to [0]\nset [player bounce? v] to [0]\nset [previous direction v] to [90]\nset [player hurt v] to [0]\nset [y slope v] to [0]\nset [y slope 2 v] to [0]\nset [invinsibility frames v] to [0]\nPosition\ngo to [front v] layer\nswitch costume to (stand1 v)\nset rotation style [left-right v]\npoint in direction (90)\nset size to (70) %\nset [*game timer v] to (timer)\n\ndefine Animation\nif <(player state) = [crouch]> then\n    switch costume to (crouch1 v)\nelse\n    if <(player state) = [slide]> then\n        switch costume to ((([floor v] of ((timer) * (4)) ) mod (2)) + (27))\n    else\n        if <(in air) > [0]> then\n            if <(y vel) > [0]> then\n                switch costume to (run jump v)\n            else\n                switch costume to (run drop v)\n            end\n        else\n            if <([abs v] of (x vel) ) > [0.3]> then\n                switch costume to ((([floor v] of ((timer) * (20)) ) mod (16)) + (6))\n            else\n                switch costume to ((([floor v] of ((timer) * (3)) ) mod (2)) + (4))\n            end\n        end\n    end\nend\n\ndefine Controls\nset [*right control v] to (<<key (right arrow v) pressed?> or <key (d v) pressed?>> + (0))\nset [*left control v] to (<<key (left arrow v) pressed?> or <key (a v) pressed?>> + (0))\nif <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n    change [*up v] by (1)\nelse\n    set [*up v] to [0]\nend\nif <<key (down arrow v) pressed?> or <key (s v) pressed?>> then\n    change [*down control v] by (1)\nelse\n    set [*down control v] to [0]\nend\nset [*up limit v] to <<(*Up) > [0]> and <(*Up) < [5]>>\n\nwhen I receive [game start v]\nset [ghost v] effect to (100)\nshow\nset volume to (30) %\nrepeat (10)\n    Setup\n    change [ghost v] effect by (-10)\n    broadcast (Game Tick v)\nend\nrepeat until <<(*Player Lives) = [0]> or <(Level Beaten?) = [1]>>\n    Controls\n    Platformer\n    broadcast (Game Tick v)\n    if <key (r v) pressed?> then\n        Setup\n    end\nend\nif <(*Player Lives) = [0]> then\n    broadcast (Player Death v)\nend\n\nwhen I receive [player death v]\nclear graphic effects\nrepeat (20)\n    switch costume to ((([floor v] of ((timer) * (8)) ) mod (2)) + (32))\nend\nset [y vel v] to [10]\nrepeat until <(y position) < [-180]>\n    switch costume to ((([floor v] of ((timer) * (8)) ) mod (2)) + (32))\n    change y by (y vel)\n    change [y vel v] by (-1)\nend\nhide\nwait (1) seconds\nbroadcast (Game Fade v)\n\nwhen I receive [level complete v]\nstop [other scripts in sprite v]\npoint in direction (90)\nswitch costume to (grab flagpole v)\nset [x v] to [6965]\nPosition\nrepeat (18)\n    show\nend\nstart sound [nsmb_flagpole v]\nglide (0.7) secs to x: (95) y: (-77)\nwait (0.5) seconds\nstart sound [Win v]\nrepeat until <(x position) > [240]>\n    switch costume to ((([floor v] of ((timer) * (20)) ) mod (16)) + (6))\n    change x by (8)\nend\nhide\nwait (1) seconds\nbroadcast (Get Time v)\n\ndefine Boundaries\nif <(~SCROLL X) < [0]> then\n    set [~scroll x v] to [0]\nend\nif <(~SCROLL X) > [6870]> then\n    set [~scroll x v] to [6870]\nend\nif <(x) < [-220]> then\n    set [x v] to [-220]\n    Position\nend\nif <(x) > [7090]> then\n    set [x v] to [7090]\n    Position\nend\n\n@Non-Solid Objects\n\nwhen flag clicked\nset volume to (10) %\nhide\n\nwhen I receive [game tick v]\nset [object costume v] to (costume [number v])\nswitch costume to (bypass v)\nset size to (Infinity) %\ngo to x: ((object x) - (~SCROLL X)) y: (object y)\nset size to (100) %\nswitch costume to (object costume)\nif <(ID) = [1]> then\n    switch costume to (flagpole v)\n    if <<<touching (player v)?> and <([touching v] of [player v]) = [1]>> and <(touched?) = [0]>> then\n        broadcast (Level Complete v)\n        set [touched? v] to [1]\n    end\nend\nif <(ID) = [2]> then\n    if <<<touching (player v)?> and <([touching v] of [player v]) = [1]>> and <(touched?) = [0]>> then\n        set [touched? v] to [1]\n        set [frames v] to [0]\n        change [*game coins v] by (1)\n    end\n    if <(touched?) = [0]> then\n        switch costume to (coins v)\n    else\n        if <(frames) = [1]> then\n            start sound [Collect v]\n        end\n        switch costume to (glow v)\n        set size to ((80) + ((frames) * (10))) %\n        change [ghost v] effect by ((100) / (12))\n        if <(frames) > [15]> then\n            delete this clone\n        end\n    end\n    change [frames v] by (1)\nend\nif <(ID) = [3]> then\n    if <<<touching (player v)?> and <([touching v] of [player v]) = [1]>> and <(touched?) = [0]>> then\n        set [touched? v] to [1]\n        set [frames v] to [0]\n        if <(item (1) of [collected coins v]) = [0]> then\n            start sound [Coin v]\n            replace item (1) of [collected coins v] with [1]\n        end\n        change [*game coins v] by (1)\n    end\n    if <(touched?) = [0]> then\n        switch costume to (big coin v)\n    else\n        turn right (15) degrees\n        change [object y v] by ((11) + ((frames) * (-2)))\n        if <(frames) > [15]> then\n            delete this clone\n        end\n        if <(frames) > [10]> then\n            change [ghost v] effect by (20)\n        end\n    end\n    change [frames v] by (1)\nend\nif <(ID) = [4]> then\n    Enemy Movement\nend\nif <(ID) = [5]> then\n    switch costume to (flag1 v)\nend\n\ndefine Clone x: (x) y: (y) Repeat: (number) ID: (id) Border 1: (border 1) Border 2: (border 2)\nclear graphic effects\nset [object x v] to (x)\nset [object y v] to (y)\nset [id v] to (id)\nset [border 1 v] to (border 1)\nset [border 2 v] to (border 2)\nrepeat (number)\n    create clone of (_myself_ v)\n    change [object x v] by (35)\nend\n\nwhen I start as a clone\nset volume to (30) %\nshow\nset [touched? v] to [0]\nset [old y v] to (object y)\nif <(ID) = [6]> then\n    switch costume to (flag2 v)\n    set [ghost v] effect to (100)\n    repeat (10)\n        change [ghost v] effect by (-10)\n    end\n    repeat (8)\n        show\n    end\n    glide (0.7) secs to x: (130) y: (-175)\nend\nforever\n    if <<([abs v] of (x position) ) > [270]> or <([abs v] of (y position) ) > [210]>> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [game start v]\npoint in direction (90)\nhide\nAdd\nset [frames v] to [0]\nClone x: [1365] y: [55] Repeat: [3] ID: [2] Border 1: [0] Border 2: [0]\nClone x: [460] y: [50] Repeat: [3] ID: [2] Border 1: [0] Border 2: [0]\nClone x: [2665] y: [85] Repeat: [3] ID: [2] Border 1: [0] Border 2: [0]\nClone x: [3340] y: [130] Repeat: [3] ID: [2] Border 1: [0] Border 2: [0]\nClone x: [5635] y: [95] Repeat: [3] ID: [2] Border 1: [0] Border 2: [0]\nClone x: [770] y: [7] Repeat: [1] ID: [2] Border 1: [0] Border 2: [0]\nClone x: [830] y: [-7] Repeat: [1] ID: [2] Border 1: [0] Border 2: [0]\nClone x: [890] y: [-21] Repeat: [1] ID: [2] Border 1: [0] Border 2: [0]\nClone x: [950] y: [-35] Repeat: [1] ID: [2] Border 1: [0] Border 2: [0]\nClone x: [1010] y: [-49] Repeat: [1] ID: [2] Border 1: [0] Border 2: [0]\nClone x: [4635] y: [-32] Repeat: [1] ID: [2] Border 1: [0] Border 2: [0]\nClone x: [4695] y: [-48] Repeat: [1] ID: [2] Border 1: [0] Border 2: [0]\nClone x: [4755] y: [-64] Repeat: [1] ID: [2] Border 1: [0] Border 2: [0]\nClone x: [4815] y: [-80] Repeat: [1] ID: [2] Border 1: [0] Border 2: [0]\nClone x: [7623] y: [14] Repeat: [1] ID: [2] Border 1: [0] Border 2: [0]\nClone x: [7658] y: [34] Repeat: [1] ID: [2] Border 1: [0] Border 2: [0]\nClone x: [7693] y: [34] Repeat: [1] ID: [2] Border 1: [0] Border 2: [0]\nClone x: [7728] y: [14] Repeat: [1] ID: [2] Border 1: [0] Border 2: [0]\nClone x: [300] y: [-95] Repeat: [1] ID: [4] Border 1: [-220] Border 2: [390]\nClone x: [2210] y: [-33] Repeat: [1] ID: [4] Border 1: [1935] Border 2: [2210]\nClone x: [2890] y: [-104] Repeat: [1] ID: [4] Border 1: [2845] Border 2: [3160]\nClone x: [3485] y: [-105] Repeat: [1] ID: [4] Border 1: [3260] Border 2: [3485]\nClone x: [4520] y: [-43] Repeat: [1] ID: [4] Border 1: [4260] Border 2: [4550]\nClone x: [4890] y: [-115] Repeat: [1] ID: [4] Border 1: [4850] Border 2: [5020]\nClone x: [5880] y: [-114] Repeat: [1] ID: [4] Border 1: [5850] Border 2: [5985]\nClone x: [1710] y: [-95] Repeat: [1] ID: [4] Border 1: [1520] Border 2: [1710]\nClone x: [6305] y: [-42] Repeat: [1] ID: [4] Border 1: [6180] Border 2: [6305]\nClone x: [4423] y: [145] Repeat: [1] ID: [3] Border 1: [0] Border 2: [0]\nClone x: [7000] y: [0] Repeat: [1] ID: [1] Border 1: [0] Border 2: [0]\nClone x: [7000] y: [0] Repeat: [1] ID: [5] Border 1: [0] Border 2: [0]\n\nbroadcast (Game Start v)\n\nwhen I receive [hard reset v]\nset [*game coins v] to [0]\nset [*real coins v] to [0]\n\nwhen I receive [delete level v]\ndelete this clone\n\nwhen I receive [game reset v]\nset [*game coins v] to [0]\nset [*real coins v] to [0]\n\ndefine Add\ndelete all of [power up v]\nrepeat (4)\n    add [0] to [power up v]\nend\n\nwhen I receive [level complete v]\nif <(ID) = [5]> then\n    go to x: (130) y: (0)\n    set [id v] to [6]\n    create clone of (_myself_ v)\n    set [id v] to [5]\n    switch costume to (flag1 v)\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    delete this clone\nend\n\ndefine Can Move (location)\nset [can move? v] to (<([abs v] of ((~SCROLL X) - (object x)) ) > (location)> + (0))\nif <<(ID) = [7]> and <(Can Move?) = [1]>> then\n    set [frames v] to [50]\nend\n\ndefine Enemy Movement\nif <(touched?) = [0]> then\n    if <(Can Move?) = [0]> then\n        switch costume to ((6) + ([floor v] of ((frames) mod (6)) ))\n        if <(object x) < (border 1)> then\n            point in direction (90)\n        end\n        if <(object x) > (border 2)> then\n            point in direction (-90)\n        end\n        if <(direction) = [90]> then\n            change [object x v] by (2)\n        else\n            change [object x v] by (-2)\n        end\n        set rotation style [left-right v]\n        set [player bounce? v] to [0]\n        change [frames v] by (0.5)\n    else\n        set rotation style [left-right v]\n        if <([x v] of [player v]) > (object x)> then\n            point in direction (90)\n        else\n            point in direction (-90)\n        end\n    end\nelse\n    if <(death state) = [1]> then\n        switch costume to (slide death1 v)\n        change [object y v] by ((14) + ((frames) * (-1.5)))\n        if <(frames) = [1]> then\n            start sound [squish v]\n        end\n        set rotation style [all around v]\n        if <(previous direction) = [-90]> then\n            turn right (15) degrees\n            change [object x v] by (-4)\n        else\n            turn right (-15) degrees\n            change [object x v] by (4)\n        end\n        change [frames v] by (1)\n        if <(y position) < [-240]> then\n            delete this clone\n        end\n    else\n        if <(frames) = [0]> then\n            set [player bounce? v] to [1]\n            start sound [boing v]\n        else\n            set [player bounce? v] to [0]\n        end\n        if <(frames) < [4]> then\n            switch costume to ((12) + ([floor v] of ((frames) mod (6)) ))\n        end\n        if <(frames) > [10]> then\n            delete this clone\n        end\n        change [frames v] by (0.5)\n    end\nend\nif <<touching (player v)?> and <<([touching v] of [player v]) = [1]> and <(touched?) = [0]>>> then\n    set [frames v] to [0]\n    if <<([in air v] of [player v]) > [5]> or <([player state v] of [player v]) = [slide]>> then\n        set [touched? v] to [1]\n        set [death state v] to (<([player state v] of [player v]) = [slide]> + (0))\n        set [previous direction v] to (direction)\n    else\n        set [player hurt v] to [1]\n    end\nend\nCan Move [280]\n\n@Solid Objects\n\nwhen I receive [game tick v]\nset [block costume v] to (costume [number v])\nswitch costume to (bypass v)\nset size to (Infinity) %\ngo to x: ((block x) - (~SCROLL X)) y: (block y)\nset size to (125) %\nswitch costume to (block costume)\nif <(ID) = [1]> then\n    switch costume to (brick v)\n    if <<([y vel v] of [player v]) = [0]> and <<<touching (player v)?> and <([up sensor v] of [sensor v]) = [true]>> and <(touched?) = [0]>>> then\n        start sound [Mario Breaking block Epic Sound FX v]\n        delete this clone\n    end\nend\nif <(ID) = [2]> then\n    if <(touched?) = [1]> then\n        switch costume to (block2 v)\n    else\n        switch costume to (block v)\n    end\n    if <<([y vel v] of [player v]) = [0]> and <<<touching (player v)?> and <([up sensor v] of [sensor v]) = [true]>> and <(touched?) = [0]>>> then\n        replace item (1) of [blocks v] with (block x)\n        replace item (2) of [blocks v] with (block y)\n        create clone of (effects v)\n        start sound [Collect v]\n        change [*game coins v] by (1)\n        set [touched? v] to [1]\n    end\nend\nif <(ID) = [3]> then\n    switch costume to (disappearing platform v)\n    if <(touched?) = [1]> then\n        if <(frames) > [4]> then\n            set [ghost v] effect to (((frames) * (15)) - (60))\n        end\n        change [frames v] by (1)\n        if <(frames) > [10]> then\n            delete this clone\n        end\n    end\n    if <<<<touching (player v)?> and <([down sensor v] of [sensor v]) = [true]>> and <([y v] of [player v]) > (block y)>> and <(touched?) = [0]>> then\n        set [frames v] to [0]\n        set [touched? v] to [1]\n    end\nend\n\nwhen flag clicked\nhide\ndelete all of [blocks v]\nrepeat (6)\n    add [0] to [blocks v]\nend\n\ndefine Clone x: (x) y: (y) ID: (id)\nclear graphic effects\nset [block x v] to (x)\nset [block y v] to (y)\nset [id v] to (id)\ncreate clone of (_myself_ v)\n\nwhen I receive [game start v]\nClone x: [-30] y: [25] ID: [1]\nClone x: [0] y: [25] ID: [2]\nClone x: [30] y: [25] ID: [1]\nClone x: [1950] y: [87] ID: [1]\nClone x: [1980] y: [87] ID: [2]\nClone x: [2010] y: [87] ID: [1]\nClone x: [5400] y: [98] ID: [1]\nClone x: [5430] y: [98] ID: [2]\nClone x: [5460] y: [98] ID: [1]\n\nwhen I start as a clone\nshow\nset volume to (30) %\nset [touched? v] to [0]\nforever\n    if <<([abs v] of (x position) ) > [270]> or <([abs v] of (y position) ) > [210]>> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [delete level v]\ndelete this clone\n\n@Ground Collision\n\nwhen flag clicked\nhide\n\ndefine Clone\nswitch costume to (1 v)\nset [x v] to [0]\ncreate clone of (_myself_ v)\nrepeat (15)\n    next costume\n    change [x v] by (480)\n    create clone of (_myself_ v)\nend\nset [x v] to [8000]\n\nwhen I receive [game tick v]\nset [costume v] to (costume [number v])\nswitch costume to (bypass v)\nset size to (Infinity) %\ngo to x: ((x) - (~SCROLL X)) y: (y)\nset size to (100) %\nswitch costume to (costume)\n\nwhen I receive [game start v]\nshow\nClone\nhide\n\nwhen I receive [delete level v]\ndelete this clone\n\nwhen I start as a clone\nforever\n    if <<([abs v] of (x position) ) > [500]> or <([abs v] of (y position) ) > [210]>> then\n        hide\n    else\n        show\n    end\nend\n\n@Sensor\n\nwhen I receive [game tick v]\nshow\nswitch costume to (sensor v)\ngo to (player v)\nset [up sensor v] to <<touching (ground collision v)?> or <touching (solid objects v)?>>\nswitch costume to (hitbox detector v)\nset [touch sensor v] to <<touching (ground collision v)?> or <touching (solid objects v)?>>\nswitch costume to (sensor2 v)\nset [down sensor v] to <<touching (ground collision v)?> or <touching (solid objects v)?>>\nset [ghost v] effect to (100)\n\nwhen flag clicked\nhide\n\n@Text\n\nwhen flag clicked\nhide\nset [different text v] to [0]\nreplace item (1) of [-level times v] with [300]\nset [change v] to [0]\n\ndefine Write Text (text) Movement (movement) Icon (icon) Size (size) Fade (fade)\nset [fade v] to (fade)\nif <(icon) = [1]> then\n    switch costume to (coin v)\n    set size to (105) %\n    create clone of (_myself_ v)\n    change x by (20)\n    change y by (-6)\nend\nset size to (100) %\nif <(movement) = [1]> then\n    set [i v] to (length of (text))\nelse\n    set [i v] to [1]\nend\nrepeat (length of (text))\n    switch costume to (letter (i) of (text))\n    if <(movement) = [1]> then\n        change x by (-18)\n        change [i v] by (-1)\n    else\n        change x by (18)\n        change [i v] by (1)\n    end\n    create clone of (_myself_ v)\n    if <(costume [number v]) = [11]> then\n        change x by (-10)\n    end\nend\nif <(icon) = [2]> then\n    change x by (-25)\n    change y by (2.5)\n    switch costume to (timer v)\n    set size to (50) %\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nshow\nif <(costume [number v]) = [18]> then\n    set [ghost v] effect to (100)\n    repeat (10)\n        change [ghost v] effect by (-8)\n    end\nelse\n    if <(Fade) = [1]> then\n        set [ghost v] effect to (100)\n        repeat (10)\n            change [ghost v] effect by (-10)\n        end\n    end\nend\n\nwhen I receive [game start v]\nhide\nclear graphic effects\nset [*game coins v] to [0]\nforever\n    broadcast (Delete Text v)\n    clear graphic effects\n    if <(*Player Lives) > [0]> then\n        go to x: (235) y: (153)\n        Write Text ([ceiling v] of ((300) - (*Game Time)) ) Movement [1] Icon [2] Size [0] Fade [0]\n        go to x: (-210) y: (157)\n        Write Text (*Game Coins) Movement [0] Icon [1] Size [0] Fade [0]\n        set size to (85) %\n        go to x: (-210) y: (122)\n        Clone Coins\n        set [ghost v] effect to (0)\n    end\nend\n\nwhen I receive [delete text v]\ndelete this clone\n\nwhen I receive [delete level v]\nstop [other scripts in sprite v]\nbroadcast (Delete Text v)\nhide\n\nwhen I receive [level start v]\nstop [other scripts in sprite v]\nbroadcast (Text Fade v)\n\nwhen I receive [player death v]\nreplace item (1) of [collected coins v] with [0]\nset [-game? v] to [1]\nchange [-player deaths v] by (1)\nstop [other scripts in sprite v]\nhide\nwait (0.5) seconds\ngo to x: (0) y: (0)\nset size to (100) %\nswitch costume to (glow v)\ncreate clone of (_myself_ v)\nstart sound [Lose v]\nif <(Gameplay) = [2]> then\n    switch costume to (time's up! v)\nelse\n    switch costume to (you died v)\nend\nshow\nset size to (50) %\nset [ghost v] effect to (100)\ngo to [front v] layer\nrepeat (10)\n    change size by (5)\n    change [ghost v] effect by (-10)\nend\nset [gameplay v] to [0]\n\nwhen I receive [text fade v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nbroadcast (Delete Text v)\n\nwhen I receive [game tick v]\nif <(*Game Coins) > [49]> then\n    change [*game coins v] by (-50)\nend\n\ndefine Clone Coins\nswitch costume to ((item (1) of [collected coins v]) + (16))\nif <(costume [number v]) = [16]> then\n    set [ghost v] effect to (20)\nend\ncreate clone of (_myself_ v)\nchange x by (34)\n\nwhen I receive [get time v]\nbroadcast (Text Fade v)\nset [different text v] to (☁ Scratcher Status)\nset [fade v] to [1]\nclear graphic effects\nwait (0.5) seconds\nset volume to (50) %\nstart sound [Collect v]\nstop [other scripts in sprite v]\nhide\nGet Results <(Different Text) = [1]>\nwait (0.5) seconds\ngo to x: (0) y: (-155)\nswitch costume to (click v)\ncreate clone of (_myself_ v)\nwait until <(~Mouse) = [1]>\nstart sound [Click v]\nbroadcast (Text Fade v)\nset [change v] to [1]\nbroadcast (Game Fade v)\n\ndefine Shorten (text)\nset [i v] to [1]\nset [shortened time v] to []\nrepeat ((length of ([floor v] of (text) )) + (2))\n    set [shortened time v] to (join (Shortened Time) (letter (i) of (text)))\n    change [i v] by (1)\nend\n\nwhen I receive [level complete v]\nstop [other scripts in sprite v]\n\nset [different text v] to [1]\nbroadcast (Get Time v)\n\ndefine Get Results <different text>\ngo to x: (-30) y: (12)\nif <different text> then\n    go to x: (-53) y: (25)\nend\ngo to [front v] layer\nswitch costume to (time v)\nset size to (100) %\ncreate clone of (_myself_ v)\ngo to x: (22) y: (12)\nif <different text> then\n    go to x: (-1) y: (25)\nend\nShorten (item (1) of [-level times v])\nWrite Text (Shortened Time) Movement [0] Icon [4] Size [0] Fade [1]\nswitch costume to (coins v)\ngo to x: (-55) y: (-12)\nif <different text> then\n    go to x: (-78) y: (0)\nend\ncreate clone of (_myself_ v)\ngo to x: (-30) y: (-12)\nif <different text> then\n    go to x: (-53) y: (0)\nend\nWrite Text (*Game Coins) Movement [0] Icon [4] Size [0] Fade [1]\nCloud\nif <different text> then\n    go to x: (-37) y: (-25)\n    switch costume to (world record v)\n    create clone of (_myself_ v)\n    go to x: (27) y: (-25)\n    Write Text (☁ World Record) Movement [0] Icon [4] Size [0] Fade [1]\nend\n\ndefine Cloud\nif <(Shortened Time) < [20]> then\n    stop [all v]\nend\nchange [☁ completed v] by (1)\nif <(item (1) of [collected coins v]) = [1]> then\n    change [☁ completed with coin v] by (1)\nend\nif <(Shortened Time) < (☁ World Record)> then\n    set [☁ world record v] to (Shortened Time)\nend\n\n@Scrolling Background\n\nwhen flag clicked\nhide\n\nwhen I receive [game start v]\nshow\ngo to [back v] layer\nswitch costume to (level 1 v)\nforever\n    set [ghost v] effect to (40)\n    set x to ((((~SCROLL X) / (-1.3)) mod (480)) + (-480))\nend\n\nwhen I receive [world map v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [game over v]\nstop [other scripts in sprite v]\nhide\n\n@Thumbnail\n\nwhen flag clicked\nset [ghost v] effect to (100)\nswitch costume to (thumbnail v)\nforever\n    set [time v] to (timer)\n    broadcast (Infinite Tick v)\nend\n\nwhen [timer v] > (time)\nif <not <(username) = [Animator180]>> then\n    show list [dev tools v]\nend\nif <(costume [number v]) = [2]> then\n    start sound [smw_lemmy_wendy_incorrect v]\nend\nforever\n    go to [front v] layer\nend\n\nwhen I receive [game start v]\nset [turbo mode v] to [0]\nforever\n    repeat (10)\n        set [turbo mode tick v] to (timer)\n    end\n    set [turbo mode time v] to ((timer) - (Turbo Mode Tick))\n    if <(Turbo Mode Time) = [0]> then\n        switch costume to (turbo mode v)\n        stop [all v]\n    end\nend\n\n@Effects\n\nwhen I start as a clone\ngo to [back v] layer\nset size to (100) %\nswitch costume to (coin v)\ngo [forward v] (5) layers\nset [x v] to (item (1) of [blocks v])\nset y to (item (2) of [blocks v])\nset [movement v] to [10]\nrepeat (9)\n    change y by (Movement)\n    change [movement v] by (-1)\nend\nset size to (80) %\nswitch costume to (glow v)\nrepeat (15)\n    change size by (10)\n    change [ghost v] effect by ((100) / (12))\nend\ndelete this clone\n\nwhen I receive [game tick v]\nset x to ((x) - (~SCROLL X))\nif <([abs v] of (x position) ) > [240]> then\n    hide\nelse\n    show\nend\n\n@Game Fade\n\nwhen flag clicked\nhide\n\nwhen I receive [game fade v]\nswitch costume to (screen v)\nshow\nif <([change v] of [text v]) = [0]> then\n    set [ghost v] effect to (100)\nend\ngo to [front v] layer\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nbroadcast (Delete Level v)\nwait (1) seconds\nif <([change v] of [text v]) = [0]> then\n    wait (0.5) seconds\n    broadcast (Game Start v)\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\nelse\n    switch costume to (screen2 v)\n    set [brightness v] effect to (-100)\n    repeat (10)\n        change [brightness v] effect by (10)\n    end\nend\n\nwhen I receive [get time v]\nswitch costume to (screen v)\nshow\nset [ghost v] effect to (100)\ngo to [front v] layer\nrepeat (10)\n    change [ghost v] effect by (-6)\nend\n\nwhen I receive [fade v]\nswitch costume to (level 1 v)\ngo to [front v] layer\nshow\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (1) seconds\nbroadcast (Game Start v)\nswitch backdrop to (background 1 v)\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\n@Title\n\nwhen flag clicked\nswitch backdrop to (title background v)\nshow\nswitch costume to (title v)\nset y to (180)\nset size to (100) %\nset [y vel2 v] to [0]\nrepeat (11)\n    change y by (y vel2)\n    change [y vel2 v] by (-1)\nend\nset [y vel2 v] to [5]\nrepeat (10)\n    change y by (y vel2)\n    change [y vel2 v] by (-1)\nend\nswitch costume to (click v)\ncreate clone of (_myself_ v)\nswitch costume to (title v)\nrepeat until <(~Mouse) = [1]>\n    if <touching (mouse-pointer v)?> then\n        change size by (((105) - (size)) / (5))\n    else\n        change size by (((100) - (size)) / (5))\n    end\nend\nwait (0.5) seconds\nbroadcast (Fade v)\n\nwhen I start as a clone\ngo to x: (0) y: (-145)\nset size to (0) %\nrepeat until <(~Mouse) = [1]>\n    change size by (((100) - (size)) / (5))\nend\nstop all sounds\nset volume to (30) %\nstart sound [Click v]\nrepeat (10)\n    change [ghost v] effect by (10)\n    change size by (2)\nend\n\nwhen I receive [fade v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\n@Slide\n\nwhen I receive [slide sound stop v]\nstop [other scripts in sprite v]\nset volume to (10) %\nforever\n    wait until <([player state v] of [player v]) = [slide]>\n    broadcast (Slide Sound Start v)\n    wait until <not <([player state v] of [player v]) = [slide]>>\n    broadcast (Slide Sound Stop v)\nend\n\nwhen I receive [slide sound start v]\nplay sound [Slide Start v] until done\nforever\n    play sound [Slide Sound v] until done\nend\n\nwhen I receive [game start v]\nbroadcast (Slide Sound Stop v)\n\nwhen I receive [player death v]\nstop [other scripts in sprite v]\n\nwhen I receive [level complete v]\nstop [other scripts in sprite v]\n\n