Minecraft Platformer 3
@Stage\n\n@README\n\n@System\n\nwhen flag clicked\nforever\n    delete all of [z-index v]\n    broadcast (Layer sort v)\nend\n\ndelete all of [tile x on the player v]\ndelete all of [tile y on the player v]\nset [i v] to (((Clone Count X) * (-30)) / (2))\nrepeat (Clone Count X)\n    ​​log​​ (i)\n    add (i) to [tile x on the player v]\n    change [i v] by (30)\nend\nset [i v] to (((Clone Count Y) * (-30)) / (2))\nrepeat (Clone Count Y)\n    ​​log​​ (i)\n    add (i) to [tile y on the player v]\n    change [i v] by (30)\nend\n\nwhen flag clicked\nbroadcast (Menu - Setup v)\nhide variable [time: v]\nset [menu - select v] to [None]\nset [#daylight cycle v] to [Day]\nset [menu - selectworld v] to []\nset [#gamemode v] to (item (1) of [#gamemode v])\nwait until <(#Gamemode) = (item (3) of [#gamemode v])>\nset [clone count x v] to ((480) / (30))\nset [clone count y v] to ((360) / (30))\nset [#level v] to [1]\nif <(Menu - SelectWorld) = (join [_] (item (1) of [#biome v]))> then\n    set [#level v] to [1]\nend\nif <(Menu - SelectWorld) = (join [_] (item (2) of [#biome v]))> then\n    set [#level v] to [10]\nend\nset [#frame v] to [0]\nrepeat until <(#Frame) > [28]>\n    change [#frame v] by (1)\nend\nset [#frame v] to [0]\nbroadcast (Set - Player Spawn v)\n\nwhen I receive [set - player spawn v]\nbroadcast (Set - Generate level v)\nset [time: v] to [0]\nrepeat until <(#Level) = [11]>\n    change [#frame v] by (1)\nend\nif <(Menu - SelectWorld) = []> then\n    show variable [time: v]\n    set [time: v] to (join ((round (((#Frame) / (30)) * (10))) / (10)) [s])\nend\n\ndelete all of [#gamemode v]\nadd [Menu] to [#gamemode v]\nadd [Menu - SelectWorld] to [#gamemode v]\nadd [Set] to [#gamemode v]\nadd [Playing] to [#gamemode v]\n\ndelete all of [respawn x v]\nadd [-210] to [respawn x v]\nadd [-210] to [respawn x v]\nadd [-210] to [respawn x v]\nadd [-210] to [respawn x v]\nadd [-210] to [respawn x v]\nadd [-210] to [respawn x v]\nadd [-210] to [respawn x v]\nadd [-210] to [respawn x v]\nadd [-210] to [respawn x v]\nadd [-210] to [respawn x v]\nadd [-210] to [respawn x v]\n\ndelete all of [respawn y v]\nadd [-90] to [respawn y v]\nadd [-90] to [respawn y v]\nadd [-90] to [respawn y v]\nadd [120] to [respawn y v]\nadd [-90] to [respawn y v]\nadd [-90] to [respawn y v]\nadd [-90] to [respawn y v]\nadd [-90] to [respawn y v]\nadd [-90] to [respawn y v]\nadd [-90] to [respawn y v]\nadd [-90] to [respawn y v]\n\nwhen [c v] key pressed\nif <(username) = [-Jikky-]> then\n    show variable [#biome v]\n    show variable [#frame v]\n    show variable [#gamemode v]\n    show variable [#level v]\n    show variable [#daylight cycle v]\n    hide list [#gamemode v]\n    hide list [#biome v]\n    wait until <not <key (c v) pressed?>>\n    wait until <key (c v) pressed?>\n    hide variable [#biome v]\n    hide variable [#frame v]\n    hide variable [#gamemode v]\n    hide variable [#level v]\n    hide variable [#daylight cycle v]\n    show list [#gamemode v]\n    show list [#biome v]\nend\n\nwhen I receive [set - generate level v]\nif <<(#Level) > [0]> and <(#Level) < [10]>> then\n    set [#biome v] to [Plains]\nend\nif <<(#Level) > [9]> and <(#Level) < [20]>> then\n    set [#biome v] to [Desert]\nend\n\ndelete all of [#biome v]\nadd [Plains] to [#biome v]\nadd [Desert] to [#biome v]\n\nset [#daylight cycle v] to [Day]\n\nset [#daylight cycle v] to [Sunset]\n\nset [#daylight cycle v] to [Night]\n\n@Player\n\nwhen I receive [layer sort v]\nZ-index Sprite by [0]\n\ndefine Z-index Sprite by (z-index)\nset [i v] to [1]\nrepeat until <not <(z-index) < (item (i) of [z-index v])>>\n    change [i v] by (1)\nend\ninsert (z-index) at (i) of [z-index v] \ngo [forward v] ((i) - (1)) layers\n\ndefine Player - Tile X Y\nset [j v] to [1]\nrepeat (length of [tile x on the player v])\n    if <(item (j) of [tile x on the player v]) < (Player X)> then\n        set [player tile x v] to (j)\n        if <(item ((((Player tile Y) - (2)) * (Clone Count X)) + (Player tile X)) of [tile list v]) = [0]> then\n            if <<not <(item ((((Player tile Y) - (2)) * (Clone Count X)) + ((Player tile X) + (1))) of [tile list v]) = [0]>> and <(player vy) = [0]>> then\n                set [player tile x v] to ((Player tile X) + (1))\n            end\n            if <<not <(item ((((Player tile Y) - (2)) * (Clone Count X)) + ((Player tile X) - (1))) of [tile list v]) = [0]>> and <(player vy) = [0]>> then\n                set [player tile x v] to ((Player tile X) - (1))\n            end\n        end\n    end\n    change [j v] by (1)\nend\nset [j v] to [1]\nrepeat (length of [tile y on the player v])\n    if <(item (j) of [tile y on the player v]) < (Player Y)> then\n        set [player tile y v] to (j)\n    end\n    change [j v] by (1)\nend\n\nwhen I receive [set - player spawn v]\nforever\n    if <(#Gamemode) = (item (4) of [#gamemode v])> then\n        if <<(Player - touch water?) = [Yes]> and <not <(([abs v] of (player vx) ) + ([abs v] of (player vy) )) = [0]>>> then\n            SE\n        else\n            if <<<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > [0]>>>> and <(🧑touch ground？) < [3]>> then\n                SE\n            end\n            if <<<<<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<mouse down?> and <(mouse x) < [0]>>>> or <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <(mouse x) > [0]>>>>> and <(🧑touch ground？) = [0]>> and <not <(player vx) = [0]>>> then\n                SE\n                if <(Player - touch water?) = [No]> then\n                    wait (0.2) seconds\n                end\n                if <(Player - touch slime?) = [Yes]> then\n                    wait (0.1) seconds\n                end\n            end\n            if <<(🧑touch ground？) > [5]> and <(Player - touch water?) = [No]>> then\n        end\n        if <(Player - touch water?) = [Yes]> then\n            wait (0.6) seconds\n        end\n    end\nend\n\ndefine Set costume <left> <right> <jumping>\nchange [player - animator v] by (1)\nif <(player - animator) = [3]> then\n    set [player - animator v] to [0]\n    if <(Player - Costume) = [6]> then\n        set [player - costume v] to [3]\n    else\n        change [player - costume v] by (1)\n    end\nend\nif <<<left> or <right>> and <not <(player vx) = [0]>>> then\n    switch costume to (Player - Costume)\nelse\n    if <<jumping> and <(Player - touch slime?) = [No]>> then\n        switch costume to (jump v)\n    else\n        switch costume to (idle v)\n    end\nend\n\ndefine Player - Respawn\nset size to (400) %\nset [#gamemode v] to (item (3) of [#gamemode v])\nset [player - spawn x v] to (item (#Level) of [respawn x v])\nset [player - spawn y v] to (item (#Level) of [respawn y v])\ngo to x: (Player - Spawn X) y: (Player - Spawn Y)\nset [player - animator v] to [0]\nset [player - costume v] to [2]\nset [player vx v] to [0]\nset [player vy v] to [0]\nset [🧑touch ground？ v] to [3]\nset [player - touch ice? v] to [No]\nset [player - touch slime? v] to [No]\nset [player - touch water? v] to [No]\nset [#gamemode v] to (item (4) of [#gamemode v])\nset rotation style [left-right v]\npoint in direction (90)\n\nwhen I receive [set - player spawn v]\nPlayer - Respawn\nset [death v] to [0]\nrepeat until <not <(#Gamemode) = (item (4) of [#gamemode v])>>\n    show\n    clear graphic effects\n    switch costume to (hitbox v)\n    set [player x v] to (x position)\n    set [player y v] to (y position)\n    Player - Tile X Y\n    if <<(Goal Dir) = [→]> and <(x position) > [230]>> then\n        hide\n        change [#level v] by (1)\n        broadcast (Set - Player Spawn v) and wait\n    end\n    if <<(Goal Dir) = [↑]> and <(y position) > [170]>> then\n        hide\n        change [#level v] by (1)\n        broadcast (Set - Player Spawn v) and wait\n    end\n    if <(y position) < [-175]> then\n        hide\n        set [#gamemode v] to (item (3) of [#gamemode v])\n        start sound [player hurt v]\n        wait (0.3) seconds\n        change [death v] by (1)\n        Player - Respawn\n    end\n    if <touching (water v)?> then\n        set [player vy v] to ((player vy) * (0.4))\n    end\n    if <touching (damage blocks//lava v)?> then\n        hide\n        create clone of (_myself_ v)\n        set [#gamemode v] to (item (3) of [#gamemode v])\n        start sound [lava＿falling v]\n        wait (0.3) seconds\n        change [death v] by (1)\n        Player - Respawn\n    end\n    if <touching (damage blocks//cactus v)?> then\n        hide\n        create clone of (_myself_ v)\n        set [#gamemode v] to (item (3) of [#gamemode v])\n        start sound [player hurt v]\n        wait (0.3) seconds\n        change [death v] by (1)\n        Player - Respawn\n    end\n    if <(#Gamemode) = (item (4) of [#gamemode v])> then\n        if <<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<mouse down?> and <(mouse x) < [0]>>>> then\n            point in direction (-90)\n            if <(Player - touch ice?) = [Yes]> then\n                change [player vx v] by (-0.4)\n            else\n                change [player vx v] by (-2)\n            end\n        end\n        if <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <(mouse x) > [0]>>>> then\n            point in direction (90)\n            if <(Player - touch ice?) = [Yes]> then\n                change [player vx v] by (0.4)\n            else\n                change [player vx v] by (2)\n            end\n        end\n        if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > [0]>>>> then\n            if <(🧑touch ground？) < [3]> then\n                if <(Player - touch slime?) = [Yes]> then\n                    set [player vy v] to [16]\n                else\n                    set [player vy v] to [12]\n                end\n            end\n            if <(Player - touch water?) = [Yes]> then\n                set [player vy v] to [8]\n            end\n        end\n    end\n    if <<<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > [0]>>>> and <(🧑touch ground？) < [5]>> then\n        change [player vy v] by (-0.8)\n    else\n        change [player vy v] by (-1.8)\n    end\n    if <(#Daylight cycle) = [Night]> then\n        change [brightness v] effect by (-25)\n    end\n    Change X [8.1]\n    Move in steps (([abs v] of (player vx) ) + ([abs v] of (player vy) ))\n    Set costume <<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<mouse down?> and <(mouse x) < [0]>>>> <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <(mouse x) > [0]>>>> <<(🧑touch ground？) > [0]> and <(Player - touch water?) = [No]>>\nend\n\ndefine Change X (vmax)\nif <<(Player - touch water?) = [Yes]> or <<(Player - touch slime?) = [Yes]> and <(🧑touch ground？) < [3]>>> then\n    set [player μ v] to [0.6]\nelse\n    if <(Player - touch ice?) = [Yes]> then\n        set [player μ v] to [0.98]\n    else\n        set [player μ v] to [0.75]\n    end\nend\nset [player vx v] to ((player vx) * (player μ))\nif <(player vx) > ((vmax) * (player μ))> then\n    set [player vx v] to ((vmax) * (player μ))\nend\nif <(player vx) < ((vmax) * (() - (player μ)))> then\n    set [player vx v] to ((vmax) * (() - (player μ)))\nend\nif <(Player - touch ice?) = [Yes]> then\n    if <([abs v] of (player vx) ) < [0.1]> then\n        set [player vx v] to [0]\n    end\nelse\n    if <([abs v] of (player vx) ) < [1]> then\n        set [player vx v] to [0]\n    end\nend\n\ndefine SE\nset volume to (100) %\nif <(Player - touch water?) = [Yes]> then\n    start sound (pick random (18) to (21))\nelse\n    if <(Player - touch slime?) = [Yes]> then\n        start sound [Slime v]\n    else\n        if <(Player - touch ice?) = [Yes]> then\n            start sound (pick random (6) to (11))\n        else\n            if <(item ((((Player tile Y) - (2)) * (Clone Count X)) + (Player tile X)) of [tile list v]) = [2]> then\n                start sound (pick random (30) to (33))\n            end\n            if <(item ((((Player tile Y) - (2)) * (Clone Count X)) + (Player tile X)) of [tile list v]) = [3]> then\n                start sound (pick random (2) to (5))\n            end\n            if <(item ((((Player tile Y) - (2)) * (Clone Count X)) + (Player tile X)) of [tile list v]) = [4]> then\n                start sound (pick random (6) to (9))\n            end\n            if <(item ((((Player tile Y) - (2)) * (Clone Count X)) + (Player tile X)) of [tile list v]) = [7]> then\n                start sound (pick random (26) to (29))\n            end\n        end\n    end\nend\n\ndefine Move in steps (steps)\nif <(🧑touch ground？) > [4]> then\n    set [player - touch slime? v] to [No]\nend\nif <(🧑touch ground？) > [3]> then\n    set [player - touch water? v] to [No]\nend\nchange [🧑touch ground？ v] by (1)\nrepeat (steps)\n    set [player - last pos v] to (x position)\n    change x by ((player vx) / (steps))\n    if <<touching (stage blocks v)?> or <<touching (slime v)?> or <touching (ice v)?>>> then\n        set [player vx v] to [0]\n        set x to (player - last pos)\n    end\n    set [player - last pos v] to (y position)\n    change y by ((player vy) / (steps))\n    if <touching (water v)?> then\n        set [player - touch water? v] to [Yes]\n        set [🧑touch ground？ v] to [2]\n    end\n    if <touching (slime v)?> then\n        set [player - touch slime? v] to [Yes]\n        set y to (player - last pos)\n        set [🧑touch ground？ v] to [0]\n        if <([abs v] of (player vy) ) < [2]> then\n            set [player vy v] to [0]\n        else\n            set [player vy v] to ((player vy) * (-0.5))\n        end\n    end\n    if <touching (ice v)?> then\n        set [player - touch ice? v] to [Yes]\n        set y to (player - last pos)\n        if <(player vy) < [0]> then\n            set [🧑touch ground？ v] to [0]\n        end\n        set [player vy v] to [0]\n    end\n    if <touching (stage blocks v)?> then\n        set [player - touch water? v] to [No]\n        set [player - touch slime? v] to [No]\n        set [player - touch ice? v] to [No]\n        set y to (player - last pos)\n        if <(player vy) < [0]> then\n            set [🧑touch ground？ v] to [0]\n        end\n        set [player vy v] to [0]\n    end\nend\n\nwhen I start as a clone\nshow\nset size to (400) %\nclear graphic effects\npoint in direction (90)\nset rotation style [all around v]\nset [player vy v] to [12]\nrepeat until <(direction) < [0]>\n    switch costume to (hurt1 v)\n    change [ghost v] effect by (5)\n    change x by (-1)\n    turn left (5) degrees\n    change y by (player vy)\n    change [player vy v] by (-1.5)\nend\nhide\ndelete this clone\n\nwhen I receive [menu - setup v]\nhide\n\nwhen [r v] key pressed\nif <(username) = [-Jikky-]> then\n    broadcast (Set - Player Spawn v)\nend\n\n@generator\n\ndefine Generate\nif <(#Level) = [1]> then\n    1-1\nend\nif <(#Level) = [2]> then\n    1-2\nend\nif <(#Level) = [3]> then\n    1-3\nend\nif <(#Level) = [4]> then\n    1-4\nend\nif <(#Level) = [5]> then\n    1-5\nend\nif <(#Level) = [6]> then\n    1-6\nend\nif <(#Level) = [7]> then\n    1-7\nend\nif <(#Level) = [8]> then\n    1-8\nend\nif <(#Level) = [9]> then\n    1-9\nend\nif <(#Level) = [10]> then\n    2-1\nend\nif <(#Level) = [11]> then\n    2-2\nend\n\ndefine List add 0\nrepeat (((Clone Count X) * (Clone Count Y)) - (length of [tile list v]))\n    add [0] to [tile list v]\nend\n\nwhen I receive [set - generate level v]\ndelete all of [tile list v]\nGenerate\nList add 0\n\ndefine 1-1\nrepeat (Clone Count X)\n    add [2] to [tile list v]\nend\nrepeat (Clone Count X)\n    add [3] to [tile list v]\nend\n\ndefine 1-2\nrepeat (10)\n    add [2] to [tile list v]\nend\nrepeat (4)\n    add [3] to [tile list v]\nend\nrepeat (2)\n    add [2] to [tile list v]\nend\nrepeat (4)\n    add [3] to [tile list v]\nend\nrepeat (4)\n    add [2] to [tile list v]\nend\nrepeat (2)\n    add [3] to [tile list v]\nend\nrepeat (4)\n    add [0] to [tile list v]\nend\nrepeat (2)\n    add [3] to [tile list v]\nend\nrepeat (4)\n    add [0] to [tile list v]\nend\nrepeat (4)\n    add [3] to [tile list v]\nend\n\ndefine 1-3\nrepeat (Clone Count X)\n    add [2] to [tile list v]\nend\nrepeat (14)\n    add [3] to [tile list v]\nend\nrepeat (2)\n    add [2] to [tile list v]\nend\nrepeat (14)\n    add [0] to [tile list v]\nend\nrepeat (2)\n    add [2] to [tile list v]\nend\nrepeat (4)\n    add [0] to [tile list v]\nend\nadd [3] to [tile list v]\nrepeat (9)\n    add [0] to [tile list v]\nend\nrepeat (2)\n    add [2] to [tile list v]\nend\nrepeat (8)\n    add [0] to [tile list v]\nend\nadd [3] to [tile list v]\nrepeat (5)\n    add [0] to [tile list v]\nend\nrepeat (2)\n    add [2] to [tile list v]\nend\nrepeat (12)\n    add [0] to [tile list v]\nend\nadd [3] to [tile list v]\nadd [0] to [tile list v]\nrepeat (2)\n    add [2] to [tile list v]\nend\nrepeat (14)\n    add [0] to [tile list v]\nend\nrepeat (2)\n    add [2] to [tile list v]\nend\nrepeat (14)\n    add [0] to [tile list v]\nend\nrepeat (2)\n    add [3] to [tile list v]\nend\n\ndefine 1-4\nrepeat (6)\n    add [2] to [tile list v]\nend\nrepeat (2)\n    add [3] to [tile list v]\nend\nrepeat (4)\n    add [0] to [tile list v]\nend\nrepeat (4)\n    add [3] to [tile list v]\nend\nadd [2] to [tile list v]\nrepeat (4)\n    add [-1] to [tile list v]\nend\nadd [3] to [tile list v]\nrepeat (10)\n    add [0] to [tile list v]\nend\nrepeat (5)\n    add [2] to [tile list v]\n    repeat (15)\n        add [0] to [tile list v]\n    end\nend\nadd [3] to [tile list v]\n\ndefine 1-5\nrepeat (16)\n    add [2] to [tile list v]\nend\nrepeat (2)\n    add [3] to [tile list v]\nend\nrepeat (4)\n    add [#1] to [tile list v]\nend\nrepeat (10)\n    add [2] to [tile list v]\nend\nrepeat (6)\n    add [0] to [tile list v]\nend\nadd [3] to [tile list v]\nrepeat (4)\n    add [#1] to [tile list v]\nend\nrepeat (5)\n    add [2] to [tile list v]\nend\nrepeat (11)\n    add [0] to [tile list v]\nend\nadd [3] to [tile list v]\nrepeat (4)\n    add [#1] to [tile list v]\nend\n\ndefine 1-6\nrepeat (3)\n    add [3] to [tile list v]\nend\nrepeat (3)\n    repeat (2)\n        add [-1] to [tile list v]\n    end\n    repeat (1)\n        add [2] to [tile list v]\n    end\nend\nrepeat (3)\n    add [-1] to [tile list v]\nend\nadd [3] to [tile list v]\nrepeat (5)\n    add [0] to [tile list v]\nend\nadd [3] to [tile list v]\nrepeat (2)\n    repeat (2)\n        add [0] to [tile list v]\n    end\n    add [2] to [tile list v]\nend\nrepeat (4)\n    add [0] to [tile list v]\nend\nrepeat (8)\n    add [0] to [tile list v]\nend\nadd [3] to [tile list v]\nrepeat (2)\n    add [0] to [tile list v]\nend\nadd [2] to [tile list v]\nrepeat (4)\n    add [0] to [tile list v]\nend\nrepeat (11)\n    add [0] to [tile list v]\nend\nadd [3] to [tile list v]\n\ndefine 1-7\nadd [3] to [tile list v]\nrepeat (2)\n    add [2] to [tile list v]\nend\nrepeat (10)\n    add [#1] to [tile list v]\nend\nrepeat (3)\n    add [2] to [tile list v]\nend\nadd [0] to [tile list v]\nadd [3] to [tile list v]\nadd [3] to [tile list v]\nrepeat (10)\n    add [#1] to [tile list v]\nend\nrepeat (3)\n    add [3] to [tile list v]\nend\nrepeat (6)\n    add [0] to [tile list v]\nend\nrepeat (5)\n    add [2] to [tile list v]\nend\nrepeat (11)\n    add [0] to [tile list v]\nend\nrepeat (5)\n    add [3] to [tile list v]\nend\n\ndefine 1-8\nrepeat (2)\n    repeat (3)\n        add [3] to [tile list v]\n    end\n    repeat (3)\n        add [-1] to [tile list v]\n    end\nend\nrepeat (2)\n    add [3] to [tile list v]\nend\nadd [2] to [tile list v]\nadd [-1] to [tile list v]\nrepeat (14)\n    add [0] to [tile list v]\nend\nadd [3] to [tile list v]\nadd [-1] to [tile list v]\nrepeat (15)\n    add [0] to [tile list v]\nend\nadd [-1] to [tile list v]\nrepeat (8)\n    add [0] to [tile list v]\nend\nadd [2] to [tile list v]\nrepeat (3)\n    add [0] to [tile list v]\nend\nadd [2] to [tile list v]\nrepeat (2)\n    add [0] to [tile list v]\nend\nadd [-1] to [tile list v]\nrepeat (3)\n    add [2] to [tile list v]\nend\nrepeat (3)\n    add [0] to [tile list v]\nend\nadd [2] to [tile list v]\nrepeat (8)\n    add [0] to [tile list v]\nend\nadd [-1] to [tile list v]\nrepeat (15)\n    add [0] to [tile list v]\nend\nadd [-1] to [tile list v]\nadd [2] to [tile list v]\nrepeat (14)\n    add [0] to [tile list v]\nend\nadd [-1] to [tile list v]\nrepeat (2)\n    add [0] to [tile list v]\nend\nadd [2] to [tile list v]\nrepeat (7)\n    add [0] to [tile list v]\nend\nadd [2] to [tile list v]\nrepeat (3)\n    add [0] to [tile list v]\nend\nadd [2] to [tile list v]\nadd [-1] to [tile list v]\nrepeat (6)\n    add [0] to [tile list v]\nend\nadd [2] to [tile list v]\n\ndefine 2-1\nrepeat (Clone Count X)\n    add [7] to [tile list v]\nend\nrepeat (9)\n    add [7] to [tile list v]\nend\nrepeat (2)\n    add [0] to [tile list v]\nend\nadd [-2] to [tile list v]\nrepeat (4)\n    add [7] to [tile list v]\nend\nrepeat (4)\n    add [0] to [tile list v]\nend\nrepeat (4)\n    add [7] to [tile list v]\nend\nrepeat (4)\n    add [0] to [tile list v]\nend\nrepeat (4)\n    add [7] to [tile list v]\nend\nrepeat (12)\n    add [0] to [tile list v]\nend\nrepeat (3)\n    add [7] to [tile list v]\nend\nadd [0] to [tile list v]\n\ndefine 1-9\nrepeat (4)\n    add [3] to [tile list v]\nend\nadd [2] to [tile list v]\nrepeat (4)\n    if <(pick random (0) to (1)) = [1]> then\n        add [2] to [tile list v]\n    else\n        add [7] to [tile list v]\n    end\nend\nrepeat (5)\n    if <(pick random (0) to (4)) = [4]> then\n        add [2] to [tile list v]\n    else\n        add [7] to [tile list v]\n    end\nend\nrepeat (2)\n    add [5] to [tile list v]\nend\nrepeat (4)\n    add [0] to [tile list v]\nend\nadd [2] to [tile list v]\nrepeat (4)\n    if <(pick random (0) to (1)) = [1]> then\n        add [3] to [tile list v]\n    else\n        add [7] to [tile list v]\n    end\nend\nrepeat (5)\n    if <(pick random (0) to (4)) = [4]> then\n        add [2] to [tile list v]\n    else\n        add [7] to [tile list v]\n    end\nend\nrepeat (2)\n    add [7] to [tile list v]\nend\nrepeat (4)\n    add [0] to [tile list v]\nend\nadd [3] to [tile list v]\nrepeat (4)\n    add [0] to [tile list v]\nend\nadd [7] to [tile list v]\nrepeat (4)\n    if <(pick random (0) to (4)) = [4]> then\n        add [3] to [tile list v]\n    else\n        add [7] to [tile list v]\n    end\nend\nrepeat (2)\n    add [0] to [tile list v]\nend\nrepeat (9)\n    add [0] to [tile list v]\nend\nrepeat (2)\n    add [7] to [tile list v]\nend\n\ndefine 2-2\nrepeat (Clone Count X)\n    add [7] to [tile list v]\nend\nrepeat (11)\n    add [7] to [tile list v]\nend\nrepeat (3)\n    add [#1] to [tile list v]\nend\nrepeat (2)\n    add [7] to [tile list v]\nend\nrepeat (5)\n    add [0] to [tile list v]\nend\nrepeat (10)\n    add [0] to [tile list v]\nend\nrepeat (10)\n    add [7] to [tile list v]\n    repeat (15)\n        add [0] to [tile list v]\n    end\nend\n\n@Stage Blocks\n\nwhen I receive [layer sort v]\nZ-index Sprite by [1]\n\ndefine Z-index Sprite by (z-index)\nset [i v] to [1]\nrepeat until <not <(z-index) < (item (i) of [z-index v])>>\n    change [i v] by (1)\nend\ninsert (z-index) at (i) of [z-index v] \ngo [forward v] ((i) - (1)) layers\n\ndefine Generate Shadow (up) (low) <left end> <right end>\nif <not <<left end> or <right end>>> then\n    if <<not <(item ((tile id) + ((up) * (1))) of [tile list v]) = [0]>> and <<not <(item ((tile id) + ((low) * (1))) of [tile list v]) = [0]>> and <<not <(item ((tile id) - (1)) of [tile list v]) = [0]>> and <not <(item ((tile id) + (1)) of [tile list v]) = [0]>>>>> then\n        set [brightness v] effect to (-5)\n        if <<not <(item ((tile id) + (((up) * (1)) - (1))) of [tile list v]) = [0]>> and <<not <(item ((tile id) + (((up) * (1)) + (1))) of [tile list v]) = [0]>> and <<not <(item ((tile id) + (((low) * (1)) - (1))) of [tile list v]) = [0]>> and <not <(item ((tile id) + (((low) * (1)) + (1))) of [tile list v]) = [0]>>>>> then\n            set [brightness v] effect to (-10)\n            if <<not <(item ((tile id) + ((up) * (2))) of [tile list v]) = [0]>> and <<not <(item ((tile id) + ((low) * (2))) of [tile list v]) = [0]>> and <<not <(item ((tile id) - (2)) of [tile list v]) = [0]>> and <not <(item ((tile id) + (2)) of [tile list v]) = [0]>>>>> then\n                set [brightness v] effect to (-15)\n            end\n            if <<(((tile id) - (2)) mod (Clone Count X)) = [0]> or <(((tile id) + (1)) mod (Clone Count X)) = [0]>> then\n                if <<not <(item ((tile id) + ((up) * (2))) of [tile list v]) = [0]>> and <not <(item ((tile id) + ((low) * (2))) of [tile list v]) = [0]>>> then\n                    set [brightness v] effect to (-15)\n                end\n            end\n        end\n    end\nelse\n    if <<left end> and <<not <(item ((tile id) + ((up) * (1))) of [tile list v]) = [0]>> and <<not <(item ((tile id) + ((low) * (1))) of [tile list v]) = [0]>> and <not <(item ((tile id) + (1)) of [tile list v]) = [0]>>>>> then\n        set [brightness v] effect to (-5)\n        if <<not <(item ((tile id) + (((up) * (1)) + (1))) of [tile list v]) = [0]>> and <not <(item ((tile id) + ((low) + (1))) of [tile list v]) = [0]>>> then\n            set [brightness v] effect to (-10)\n            if <<not <(item ((tile id) + ((up) * (2))) of [tile list v]) = [0]>> and <not <(item ((tile id) + ((low) * (2))) of [tile list v]) = [0]>>> then\n                set [brightness v] effect to (-15)\n            end\n        end\n    end\n    if <<right end> and <<not <(item ((tile id) + ((up) * (1))) of [tile list v]) = [0]>> and <<not <(item ((tile id) + ((low) * (1))) of [tile list v]) = [0]>> and <not <(item ((tile id) - (1)) of [tile list v]) = [0]>>>>> then\n        set [brightness v] effect to (-5)\n        if <<not <(item ((tile id) + (((up) * (1)) - (1))) of [tile list v]) = [0]>> and <not <(item ((tile id) + (((low) * (1)) - (1))) of [tile list v]) = [0]>>> then\n            set [brightness v] effect to (-10)\n            if <<not <(item ((tile id) + ((up) * (2))) of [tile list v]) = [0]>> and <not <(item ((tile id) + ((low) * (2))) of [tile list v]) = [0]>>> then\n                set [brightness v] effect to (-15)\n            end\n        end\n    end\nend\n\ndefine Generate Stage Blocks\nshow\nrepeat (1)\n    delete this clone\nend\nset [tile id v] to [1]\nset [tile y v] to ((((Clone Count Y) * (-30)) / (2)) + ((30) / (2)))\nrepeat (Clone Count Y)\n    set [tile x v] to ((((Clone Count X) * (-30)) / (2)) + ((30) / (2)))\n    repeat (Clone Count X)\n        if <(item (tile id) of [tile list v]) > [0]> then\n            create clone of (_myself_ v)\n        end\n        change [tile x v] by (30)\n        change [tile id v] by (1)\n    end\n    change [tile y v] by (30)\nend\nhide\n\nwhen I start as a clone\nclear graphic effects\ngo to x: (tile x) y: (tile y)\nChange block (Clone Count X) ((0) - (Clone Count X))\nGenerate Shadow (Clone Count X) ((0) - (Clone Count X)) <(((tile id) - (1)) mod (Clone Count X)) = [0]> <((tile id) mod (Clone Count X)) = [0]>\nif <(#Daylight cycle) = [Night]> then\n    change [brightness v] effect by (-25)\nend\nset [tile v] to (item (tile id) of [tile list v])\nswitch costume to (tile)\n\nwhen I receive [set - generate level v]\nwait (0) seconds\nGenerate Stage Blocks\n\ndefine Change block (up) (low)\nif <not <<(item ((tile id) + ((up) * (1))) of [tile list v]) = [0]> or <<(item ((tile id) + ((up) * (2))) of [tile list v]) = [0]> or <(item ((tile id) + ((up) * (3))) of [tile list v]) = [0]>>>> then\n    if <(pick random (1) to (3)) = [1]> then\n        if <(#Biome) = (item (1) of [#biome v])> then\n            replace item (tile id) of [tile list v] with [4]\n        end\n        if <(#Biome) = (item (2) of [#biome v])> then\n            replace item (tile id) of [tile list v] with [8]\n        end\n    end\n    if <not <<(item ((tile id) + ((up) * (4))) of [tile list v]) = [0]> or <(item ((tile id) + ((up) * (5))) of [tile list v]) = [0]>>> then\n        if <(#Biome) = (item (1) of [#biome v])> then\n            replace item (tile id) of [tile list v] with [4]\n            if <(pick random (1) to (5)) = [1]> then\n                replace item (tile id) of [tile list v] with [5]\n            end\n            if <(pick random (1) to (10)) = [1]> then\n                replace item (tile id) of [tile list v] with [6]\n            end\n        end\n        if <(#Biome) = (item (2) of [#biome v])> then\n            replace item (tile id) of [tile list v] with [8]\n        end\n    end\nend\n\n@Water\n\nwhen I receive [layer sort v]\nif <(水ブロック層) = [1]> then\n    Z-index Sprite by [1]\nend\nif <(水ブロック層) = [2]> then\n    Z-index Sprite by [-1]\nend\n\ndefine Z-index Sprite by (z-index)\nset [i v] to [1]\nrepeat until <not <(z-index) < (item (i) of [z-index v])>>\n    change [i v] by (1)\nend\ninsert (z-index) at (i) of [z-index v] \ngo [forward v] ((i) - (1)) layers\n\nwhen I receive [set - generate level v]\nwait (0) seconds\nclear graphic effects\nGenerate Stage Blocks\n\ndefine Generate Stage Blocks\nshow\nrepeat (1)\n    delete this clone\nend\nset [水ブロック層 v] to [0]\nrepeat (2)\n    set [tile id v] to [1]\n    change [水ブロック層 v] by (1)\n    set [tile y v] to ((((Clone Count Y) * (-30)) / (2)) + ((30) / (2)))\n    repeat (Clone Count Y)\n        set [tile x v] to ((((Clone Count X) * (-30)) / (2)) + ((30) / (2)))\n        repeat (Clone Count X)\n            if < (item (tile id) of [tile list v]) contains [#]?> then\n                create clone of (_myself_ v)\n            end\n            change [tile x v] by (30)\n            change [tile id v] by (1)\n        end\n        change [tile y v] by (30)\n    end\nend\nhide\n\nwhen I start as a clone\nclear graphic effects\nif <(水ブロック層) = [1]> then\n    set [ghost v] effect to (0)\nend\nif <(水ブロック層) = [2]> then\n    set [ghost v] effect to (50)\nend\ngo to x: (tile x) y: (tile y)\nset [tile v] to (item (letter (2) of (tile id)) of [tile list v])\nif <(#Daylight cycle) = [Night]> then\n    change [brightness v] effect by (-25)\nend\nswitch costume to (tile)\n\n@草\n\nwhen I receive [layer sort v]\nZ-index Sprite by [2]\n\ndefine Z-index Sprite by (z-index)\nset [i v] to [1]\nrepeat until <not <(z-index) < (item (i) of [z-index v])>>\n    change [i v] by (1)\nend\ninsert (z-index) at (i) of [z-index v] \ngo [forward v] ((i) - (1)) layers\n\nwhen I receive [set - generate level v]\nwait (0) seconds\nGenerate Kusa Blocks (Clone Count X) ((0) - (Clone Count X))\n\ndefine Generate Kusa Blocks (up) (low)\nshow\nrepeat (1)\n    delete this clone\nend\nset [tile id v] to [1]\nset [tile y v] to ((((Clone Count Y) * (-30)) / (2)) + ((30) / (2)))\nrepeat (Clone Count Y)\n    set [tile x v] to ((((Clone Count X) * (-30)) / (2)) + ((30) / (2)))\n    repeat (Clone Count X)\n        if <<(item ((tile id) + (low)) of [tile list v]) = [3]> and <<(item (tile id) of [tile list v]) = [0]> and <(item ((tile id) + (up)) of [tile list v]) = [0]>>> then\n            if <(pick random (1) to (16)) < [6]> then\n                switch costume to (item (1) of [object list v])\n                create clone of (_myself_ v)\n            else\n                if <(pick random (1) to (16)) < [2]> then\n                    switch costume to (item (pick random (2) to (8)) of [object list v])\n                    create clone of (_myself_ v)\n                end\n            end\n        end\n        if <(#Biome) = [Desert]> then\n            if <<(item ((tile id) + (low)) of [tile list v]) = [5]> and <<(item (tile id) of [tile list v]) = [0]> and <(item ((tile id) + (up)) of [tile list v]) = [0]>>> then\n                if <(pick random (1) to (16)) < [2]> then\n                    switch costume to (dead bush v)\n                    create clone of (_myself_ v)\n                end\n            end\n        end\n        change [tile id v] by (1)\n        change [tile x v] by (30)\n    end\n    change [tile y v] by (30)\nend\nhide\n\nwhen I start as a clone\nclear graphic effects\ngo to x: (tile x) y: ((tile y) - (1))\nif <(#Daylight cycle) = [Night]> then\n    change [brightness v] effect by (-25)\nend\n\ndelete all of [object list v]\nadd [Grass] to [object list v]\nadd [Azure Bluet] to [object list v]\nadd [Oxeye Daisy] to [object list v]\nadd [Cornflower] to [object list v]\nadd [Tulip//Red Tulip] to [object list v]\nadd [Tulip//Orange Tulip] to [object list v]\nadd [Tulip//White Tulip] to [object list v]\nadd [Tulip//Pink Tulip] to [object list v]\n\n@Damage Blocks//Lava\n\nwhen I receive [layer sort v]\nZ-index Sprite by [-1]\n\ndefine Z-index Sprite by (z-index)\nset [i v] to [1]\nrepeat until <not <(z-index) < (item (i) of [z-index v])>>\n    change [i v] by (1)\nend\ninsert (z-index) at (i) of [z-index v] \ngo [forward v] ((i) - (1)) layers\n\nwhen I receive [set - generate level v]\nwait (0) seconds\nclear graphic effects\nGenerate Damage Blocks\n\ndefine Change costume\nif <(lava costume) = [1]> then\n    repeat until <(lava costume) = [20]>\n        if <(lava animator) = [3]> then\n            set [lava animator v] to [0]\n            change [lava costume v] by (1)\n        else\n            change [lava animator v] by (1)\n        end\n        switch costume to (lava costume)\n    end\nend\nif <(lava costume) = [20]> then\n    repeat until <(lava costume) = [1]>\n        if <(lava animator) = [3]> then\n            set [lava animator v] to [0]\n            change [lava costume v] by (-1)\n        else\n            change [lava animator v] by (1)\n        end\n        switch costume to (lava costume)\n    end\nend\n\ndefine Generate Damage Blocks\nshow\nrepeat (1)\n    delete this clone\nend\nset [tile id v] to [1]\nset [tile y v] to ((((Clone Count Y) * (-30)) / (2)) + ((30) / (2)))\nrepeat (Clone Count Y)\n    set [tile x v] to ((((Clone Count X) * (-30)) / (2)) + ((30) / (2)))\n    repeat (Clone Count X)\n        if <(item (tile id) of [tile list v]) = [-1]> then\n            create clone of (_myself_ v)\n        end\n        change [tile x v] by (30)\n        change [tile id v] by (1)\n    end\n    change [tile y v] by (30)\nend\nhide\n\nwhen I start as a clone\ngo to x: (tile x) y: ((tile y) - (1))\nswitch costume to (tile)\nforever\n    Change costume\nend\n\n@Damage Blocks//Cactus\n\nwhen I start as a clone\ngo to x: (tile x) y: (tile y)\nswitch costume to (tile)\n\nwhen I receive [set - generate level v]\nwait (0) seconds\nclear graphic effects\nGenerate Damage Blocks\n\ndefine Generate Damage Blocks\nshow\nrepeat (1)\n    delete this clone\nend\nset [tile id v] to [1]\nset [tile y v] to ((((Clone Count Y) * (-30)) / (2)) + ((30) / (2)))\nrepeat (Clone Count Y)\n    set [tile x v] to ((((Clone Count X) * (-30)) / (2)) + ((30) / (2)))\n    repeat (Clone Count X)\n        if <(item (tile id) of [tile list v]) = [-2]> then\n            create clone of (_myself_ v)\n        end\n        change [tile x v] by (30)\n        change [tile id v] by (1)\n    end\n    change [tile y v] by (30)\nend\nhide\n\nwhen I receive [layer sort v]\nZ-index Sprite by [-1]\n\ndefine Z-index Sprite by (z-index)\nset [i v] to [1]\nrepeat until <not <(z-index) < (item (i) of [z-index v])>>\n    change [i v] by (1)\nend\ninsert (z-index) at (i) of [z-index v] \ngo [forward v] ((i) - (1)) layers\n\n@Music\n\nwhen I receive [menu - close v]\nwait until <(#Gamemode) = (item (4) of [#gamemode v])>\nforever\n    if <(pick random (1) to (2)) = [1]> then\n        play sound [Minecraft \(cavequest remix\) v] until done\n    else\n        play sound [Moog City \(Felix Zophar Remix\) v] until done\n    end\nend\n\n@THANK YOU\n\nwhen flag clicked\nhide\n\nwhen I receive [set - generate level v]\nif <(#Level) = [11]> then\n    go to [front v] layer\n    show\nend\n\n@Effects\n\nwhen I receive [layer sort v]\nZ-index Sprite by [-999]\n\ndefine Z-index Sprite by (z-index)\nset [i v] to [1]\nrepeat until <not <(z-index) < (item (i) of [z-index v])>>\n    change [i v] by (1)\nend\ninsert (z-index) at (i) of [z-index v] \ngo [forward v] ((i) - (1)) layers\n\nwhen I receive [set - player spawn v]\nhide\nif <(#Level) = [1]> then\n    switch costume to (場面切り替え v)\n    show\n    set [ghost v] effect to (0)\n    repeat (15)\n        change [ghost v] effect by ((100) / (15))\n    end\nend\nwait until <(#Gamemode) = (item (4) of [#gamemode v])>\nforever\n    if <(#Gamemode) = (item (3) of [#gamemode v])> then\n        switch costume to (death screen v)\n        set [ghost v] effect to (0)\n        show\n        repeat (20)\n            change [ghost v] effect by (5)\n        end\n    end\n    hide\nend\n\nwhen I receive [menu - setup v]\nhide\n\nwhen I receive [menu - close v]\nwait until <(#Frame) = [1]>\nif <(#Gamemode) = (item (3) of [#gamemode v])> then\n    show\n    switch costume to (soil bg v)\n    go to x: (0) y: (0)\nend\n\n@Thumbnail\n\nwhen flag clicked\ngo to [front v] layer\nhide\n\nshow\n\n@Weather\n\nwhen I receive [layer sort v]\nif <(cloud_num) = [-1]> then\n    Z-index Sprite by [999]\nend\nif <(cloud_num) > [0]> then\n    Z-index Sprite by [998]\nend\n\ndefine Z-index Sprite by (z-index)\nset [i v] to [1]\nrepeat until <not <(z-index) < (item (i) of [z-index v])>>\n    change [i v] by (1)\nend\ninsert (z-index) at (i) of [z-index v] \ngo [forward v] ((i) - (1)) layers\n\nwhen I receive [menu - close v]\nhide\nset [cloud_num v] to [-1]\ncreate clone of (_myself_ v)\nset [cloud_num v] to [1]\nset [cloud x v] to [-100]\ncreate clone of (_myself_ v)\nchange [cloud_num v] by (1)\nset [cloud x v] to [100]\ncreate clone of (_myself_ v)\nchange [cloud_num v] by (1)\nforever\n    if <(cloud_num) < [10]> then\n        if <(pick random (1) to (5)) = [1]> then\n            set [cloud x v] to [300]\n            change [cloud_num v] by (1)\n            create clone of (_myself_ v)\n        end\n        wait (3) seconds\n    end\nend\n\nwhen I start as a clone\nif <(cloud_num) = [-1]> then\n    show\n    forever\n        if <(#Daylight cycle) = [Day]> then\n            switch costume to (sun v)\n            go to x: ((140) + ((4) * ([cos v] of (#Frame) ))) y: ((100) + ((4) * ([sin v] of (#Frame) )))\n        end\n        if <(#Daylight cycle) = [Sunset]> then\n            switch costume to (sunset v)\n            go to x: ((140) + ((4) * ([cos v] of (#Frame) ))) y: ((100) + ((4) * ([sin v] of (#Frame) )))\n        end\n        if <(#Daylight cycle) = [Night]> then\n            switch costume to (moon v)\n            go to x: ((0) + ((220) * ([cos v] of (((#Frame) / (30)) + (180)) ))) y: ((-250) + ((380) * ([sin v] of ((#Frame) / (30)) )))\n        end\n    end\nend\nif <(cloud_num) > [0]> then\n    set [cloud y v] to (pick random (100) to (170))\n    if <(#Biome) = [2]> then\n        go [forward v] (5) layers\n        set [cloud y v] to (pick random (-80) to (0))\n        set [ghost v] effect to (50)\n    end\n    switch costume to ((1) + (pick random (1) to (11)))\n    set y to (cloud y)\n    repeat until <(cloud x) < [-400]>\n        show\n        set x to (cloud x)\n        if <(#Daylight cycle) = [Night]> then\n            set [ghost v] effect to (90)\n        else\n            set [ghost v] effect to (20)\n        end\n        if <(#Gamemode) = (item (1) of [#gamemode v])> then\n    end\n    change [cloud_num v] by (-1)\n    delete this clone\nend\n\n@Backgrounds\n\nwhen I receive [layer sort v]\nZ-index Sprite by [1000]\nif <<(clone id) = [Day]> and <(#Daylight Cycle) = [Day]>> then\n    Z-index Sprite by [1001]\nend\nif <<(clone id) = [Sunset]> and <(#Daylight Cycle) = [Sunset]>> then\n    Z-index Sprite by [1001]\nend\nif <<(clone id) = [Night]> and <(#Daylight Cycle) = [Night]>> then\n    Z-index Sprite by [1001]\nend\n\ndefine Z-index Sprite by (z-index)\nset [i v] to [1]\nrepeat until <not <(z-index) < (item (i) of [z-index v])>>\n    change [i v] by (1)\nend\ninsert (z-index) at (i) of [z-index v] \ngo [forward v] ((i) - (1)) layers\n\nwhen I receive [menu - close v]\nhide\nclear graphic effects\nset size to (100) %\nswitch costume to (day v)\ngo to x: (0) y: (0)\nset [clone id v] to [Day]\ncreate clone of (_myself_ v)\nswitch costume to (sunset v)\ngo to x: (0) y: (0)\nset [clone id v] to [Sunset]\ncreate clone of (_myself_ v)\nswitch costume to (night v)\ngo to x: (0) y: (0)\nset [clone id v] to [Night]\ncreate clone of (_myself_ v)\nswitch costume to (cloudy v)\ngo to x: (0) y: (0)\nset [clone id v] to [Cloudy]\ncreate clone of (_myself_ v)\n\nset [#daylight cycle v] to [Sunset]\n\nwhen I start as a clone\nforever\n    if <(clone id) = [Day]> then\n        if <(#Daylight cycle) = [Day]> then\n            show\n            clear graphic effects\n        end\n        if <(#Daylight cycle) = [Sunset]> then\n            repeat (50)\n                change [ghost v] effect by (2)\n            end\n            wait until <not <(#Daylight cycle) = [Sunset]>>\n        end\n        if <(#Daylight cycle) = [Night]> then\n            repeat (50)\n                change [ghost v] effect by (2)\n            end\n            wait until <not <(#Daylight cycle) = [Night]>>\n        end\n    end\nend\n\nwhen I start as a clone\nforever\n    if <(clone id) = [Sunset]> then\n        if <(#Daylight cycle) = [Day]> then\n            repeat (50)\n                change [ghost v] effect by (2)\n            end\n            wait until <not <(#Daylight cycle) = [Day]>>\n        end\n        if <(#Daylight cycle) = [Sunset]> then\n            show\n            clear graphic effects\n        end\n        if <(#Daylight cycle) = [Night]> then\n            repeat (50)\n                change [ghost v] effect by (2)\n            end\n            wait until <not <(#Daylight cycle) = [Night]>>\n        end\n    end\nend\n\nset [#daylight cycle v] to [Day]\n\nset [#daylight cycle v] to [Night]\n\nwhen I start as a clone\nforever\n    if <(clone id) = [Night]> then\n        if <(#Daylight cycle) = [Day]> then\n            set [ghost v] effect to (100)\n            wait until <not <(#Daylight cycle) = [Day]>>\n        end\n        if <(#Daylight cycle) = [Sunset]> then\n            set [ghost v] effect to (100)\n            wait until <not <(#Daylight cycle) = [Sunset]>>\n        end\n        if <(#Daylight cycle) = [Night]> then\n            show\n            clear graphic effects\n        end\n    end\nend\n\n@Menu\n\ndefine Z-index Sprite by (z-index)\nset [i v] to [1]\nrepeat until <not <(z-index) < (item (i) of [z-index v])>>\n    change [i v] by (1)\nend\ninsert (z-index) at (i) of [z-index v] \ngo [forward v] ((i) - (1)) layers\n\nwhen I receive [layer sort v]\nif <(clone id) = [Bg#]> then\n    Z-index Sprite by [1000]\nend\nif <(clone id) = [_Bg#]> then\n    Z-index Sprite by [997]\nend\nif <<(clone id) = [Title#]> or <<(clone id) = [Play]> or <(clone id) = [Select world]>>> then\n    Z-index Sprite by [0]\nend\nif <(clone id) = [Splash#]> then\n    Z-index Sprite by [-1]\nend\nif <(#Gamemode) = (item (3) of [#gamemode v])> then\n    Z-index Sprite by [-1]\nend\n\nwhen I start as a clone\nif <(#Gamemode) = (item (2) of [#gamemode v])> then\n    show\n    set [menu - select v] to []\n    set [menu - selectworld v] to []\n    repeat until <not <(#Gamemode) = [Menu - SelectWorld]>>\n        if <touching (mouse-pointer v)?> then\n            if <not < (clone id) contains [#]?>> then\n                set [menu - select v] to (clone id)\n                change size by (((90) - (size)) / (5))\n                if <mouse down?> then\n                    if <(clone id) = [Play]> then\n                        if <not <(Menu - SelectWorld) = []>> then\n                            start sound [Click v]\n                            broadcast (Menu - Close v)\n                        end\n                    else\n                        set [menu - selectworld v] to (Menu - Select)\n                    end\n                end\n            end\n        end\n        if <(clone id) = (Menu - SelectWorld)> then\n            set [brightness v] effect to (20)\n        else\n            if <not < (clone id) contains [#]?>> then\n                set [brightness v] effect to (0)\n                change size by (((80) - (size)) / (5))\n            end\n            if <(clone id) = (Menu - Select)> then\n                set [brightness v] effect to (12)\n            end\n        end\n    end\nend\n\nwhen I receive [menu - setup v]\nhide\nset size to (100) %\nswitch costume to (bg# v)\nset [clone id v] to (costume [name v])\ngo to x: (0) y: (0)\ncreate clone of (_myself_ v)\nswitch costume to (title# v)\nset [clone id v] to (costume [name v])\ngo to x: (0) y: (0)\ncreate clone of (_myself_ v)\nswitch costume to (splash# v)\nset [clone id v] to (costume [name v])\ngo to x: (0) y: (0)\ncreate clone of (_myself_ v)\nset size to (10) %\nswitch costume to (play v)\nset [clone id v] to (costume [name v])\ngo to x: (0) y: (-20)\ncreate clone of (_myself_ v)\nswitch costume to (select world v)\nset [clone id v] to (costume [name v])\ngo to x: (0) y: (-90)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nif <(#Gamemode) = (item (1) of [#gamemode v])> then\n    show\n    set [menu - select v] to [Play]\n    repeat until <not <(#Gamemode) = (item (1) of [#gamemode v])>>\n        if <<(clone id) = [Play]> or <(clone id) = [Select world]>> then\n            change size by (((90) - (size)) / (5))\n        else\n            change size by (((100) - (size)) / (5))\n        end\n        set [brightness v] effect to (0)\n        if <<key ((join [enter] []) v) pressed?> or <key (space v) pressed?>> then\n            start sound [Click v]\n            broadcast (Menu - Close v)\n        end\n        if <<touching (mouse-pointer v)?> and <<not <<key (w v) pressed?> or <key (up arrow v) pressed?>>> and <not <<key (s v) pressed?> or <key (down arrow v) pressed?>>>>> then\n            if <not < (clone id) contains [#]?>> then\n                set [menu - select v] to (clone id)\n                change size by (((110) - (size)) / (5))\n                if <mouse down?> then\n                    start sound [Click v]\n                    broadcast (Menu - Close v)\n                end\n            end\n        end\n        if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n            set [menu - select v] to [Play]\n            if <(clone id) = (Menu - Select)> then\n                change size by (((110) - (size)) / (5))\n            end\n        end\n        if <<key (s v) pressed?> or <key (down arrow v) pressed?>> then\n            set [menu - select v] to [Select world]\n            if <(clone id) = (Menu - Select)> then\n                change size by (((110) - (size)) / (5))\n            end\n        end\n        if <(clone id) = (Menu - Select)> then\n            set [brightness v] effect to (12)\n        end\n        if <(clone id) = [Splash#]> then\n            repeat (10)\n                change size by (-0.5)\n            end\n            repeat (10)\n                change size by (0.5)\n            end\n        end\n    end\nend\n\nwhen I receive [menu - close v]\nif <(Menu - Select) = [Play]> then\n    set [#gamemode v] to (item (3) of [#gamemode v])\nend\nif <(Menu - Select) = [Select world]> then\n    set [#gamemode v] to (item (2) of [#gamemode v])\nend\nhide\nrepeat (1)\n    delete this clone\nend\nset size to (100) %\nif <(#Gamemode) = (item (2) of [#gamemode v])> then\n    switch costume to (_bg# v)\n    set [clone id v] to (costume [name v])\n    go to x: (0) y: (0)\n    create clone of (_myself_ v)\n    switch costume to (_select world# v)\n    set [clone id v] to (costume [name v])\n    go to x: (0) y: (100)\n    create clone of (_myself_ v)\n    set size to (50) %\n    switch costume to (_plains v)\n    set [clone id v] to (costume [name v])\n    go to x: (-60) y: (-50)\n    create clone of (_myself_ v)\n    switch costume to (_desert v)\n    set [clone id v] to (costume [name v])\n    go to x: (60) y: (-50)\n    create clone of (_myself_ v)\n    switch costume to (play v)\n    set [clone id v] to (costume [name v])\n    go to x: (0) y: (-130)\n    create clone of (_myself_ v)\nend\n\n@UI\n\nwhen I receive [set - generate level v]\nhide\nclear graphic effects\nrepeat (1)\n    delete this clone\nend\nset [ui - select v] to []\nwait until <(Death) > [4]>\ngo to x: (260) y: (140)\nswitch costume to (skip button v)\nset [clone id v] to (costume [name v])\ncreate clone of (_myself_ v)\nif <(Skipped) = [0]> then\n    set [ghost v] effect to (100)\n    go to x: (0) y: (-180)\n    switch costume to (subtitle - skip v)\n    set [clone id v] to (costume [name v])\n    create clone of (_myself_ v)\n    go to x: (0) y: (-150)\n    switch costume to (background v)\n    set [clone id v] to (costume [name v])\n    create clone of (_myself_ v)\nend\n\nwhen I receive [layer sort v]\nif <(clone id) = [Skip Button]> then\n    Z-index Sprite by [1]\nend\nif <(clone id) = [Background]> then\n    Z-index Sprite by [-2]\nend\nif < (clone id) contains [Subtitle]?> then\n    Z-index Sprite by [-3]\nend\n\ndefine Z-index Sprite by (z-index)\nset [i v] to [1]\nrepeat until <not <(z-index) < (item (i) of [z-index v])>>\n    change [i v] by (1)\nend\ninsert (z-index) at (i) of [z-index v] \ngo [forward v] ((i) - (1)) layers\n\nwhen I receive [menu - setup v]\nhide\nset [skipped v] to [0]\n\nwhen I start as a clone\nwait (0.2) seconds\nif <(clone id) = [Skip Button]> then\n    show\n    set [j v] to [0]\n    repeat (10)\n        change x by ((-0.2) * ((j) * (j)))\n        change [j v] by (1)\n    end\nend\nset [j v] to (#Level)\nrepeat until <not <(j) = (#Level)>>\n    if <(clone id) = [Skip Button]> then\n        set [ui - select v] to []\n        change size by (((100) - (size)) / (5))\n        if <touching (mouse-pointer v)?> then\n            set [ui - select v] to [Skip Button]\n            change size by (((120) - (size)) / (5))\n            if <mouse down?> then\n                change [skipped v] by (1)\n                change [#level v] by (1)\n                broadcast (Set - Player Spawn v)\n            end\n        end\n        if <key (t v) pressed?> then\n            change [skipped v] by (1)\n            change [#level v] by (1)\n            broadcast (Set - Player Spawn v)\n        end\n    end\n    if <(clone id) = [Subtitle - Skip]> then\n        if <(UI - Select) = [Skip Button]> then\n            show\n            repeat (15)\n                change [ghost v] effect by ((-100) / (15))\n                change y by (((-150) - (y position)) / (5))\n            end\n            wait until <not <(UI - Select) = [Skip Button]>>\n        else\n            repeat (10)\n                change [ghost v] effect by (10)\n            end\n            hide\n            go to x: (0) y: (-180)\n            wait until <(UI - Select) = [Skip Button]>\n        end\n    end\n    if <(clone id) = [Background]> then\n        if <(UI - Select) = [Skip Button]> then\n            show\n            repeat (20)\n                change [ghost v] effect by ((-100) / (15))\n            end\n            wait until <not <(UI - Select) = [Skip Button]>>\n        else\n            repeat (10)\n                change [ghost v] effect by (10)\n            end\n            hide\n            wait until <(UI - Select) = [Skip Button]>\n        end\n    end\nend\n\n