Exρʅσɾҽɾ- A Mobile Platformer

Instructions: MADE IT MOBILE-FRIENDLY!\n25000 views? I must be dreaming!\nArrow keys to move. Avoid the obstacles (Spikes, Water, Lava)\nPart 2:\nhttps://scratch.mit.edu/projects/430471461\nPart 3:\nhttps://scratch.mit.edu/projects/435709534\nAnd here's this really cool game I made (in my opinion) called Super Phantom Cat, I'd really appreciate if you have a look at it:\nhttps://scratch.mit.edu/projects/550516118

@Stage\n\nwhen flag clicked\nset volume to (50) %\nforever\n    play sound (_MUSIC) until done\nend\n\nwhen flag clicked\nforever\n    switch backdrop to (join [back] (_BACKDROP))\nend\n\n@Thumbnail\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\nhide\n\n@Player\n\nwhen I receive [@player tick v]\nif <(invincible?) > [0]> then\n    change [invincible? v] by (-1)\n    if <([floor v] of (((TIMER) * (8)) mod (2)) ) > [0]> then\n        set [ghost v] effect to (0)\n    else\n        set [ghost v] effect to (50)\n    end\nelse\n    set [ghost v] effect to (0)\nend\nCheck States\nif <(_DEAD) < [1]> then\n    if <(__POWER UP LEVEL) > [0]> then\n        if <<<key (down arrow v) pressed?> or <key (s v) pressed?>> or <(__JOYSTICK Y) < [-20]>> then\n            if <(down pressed) = [0]> then\n                if <(__PLAYER IN AIR) = [0]> then\n                    set [crouch v] to [1]\n                    Set Height\n                    set [down pressed v] to [1]\n                end\n            end\n        else\n            set [crouch v] to [0]\n            Set Height\n            set [down pressed v] to [0]\n            if <(crouch) > [0]> then\n                if <([abs v] of (__PLAYER XV) ) < [0.1]> then\n                    if <(direction) > [0]> then\n                        set [__player xv v] to [-0.1]\n                    else\n                        set [__player xv v] to [0.1]\n                    end\n                end\n            end\n        end\n    end\n    set [speed v] to [0.18]\n    if <(crouch) > [0]> then\n        set [__player xv v] to ((__PLAYER XV) * (0.97))\n    else\n        if <(__PLAYER IN AIR) > [4]> then\n            set [__player xv v] to ((__PLAYER XV) * (0.8))\n        else\n            set [__player xv v] to ((__PLAYER XV) * (0.75))\n        end\n        if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <(__JOYSTICK X) > [10]>> then\n            point in direction (90)\n            set [__player xv v] to (speed)\n        else\n            if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <(__JOYSTICK X) < [-10]>> then\n                point in direction (-90)\n                set [__player xv v] to ((0) - (speed))\n            end\n        end\n    end\n    Change X by (__PLAYER XV)\n    if <(__PLAYER XV) > [0.03]> then\n        if <(scroll offset x) < [50]> then\n            change [scroll offset x v] by (4)\n        end\n    else\n        if <(__PLAYER XV) < [-0.03]> then\n            if <(scroll offset x) > [-50]> then\n                change [scroll offset x v] by (-4)\n            end\n        end\n    end\n    if <(__STATE - WATER) = [0]> then\n        if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <key (space v) pressed?>> or <(__JOYSTICK Y) > [15]>> then\n            if <(crouch) = [0]> then\n                if <(__PLAYER IN AIR) < [6]> then\n                    change [__player yv v] by (0.1)\n                    if <(is jump?) = [0]> then\n                        start sound [Jump v]\n                        set [is jump? v] to [1]\n                    end\n                end\n            end\n        end\n        if <(__PLAYER YV) > [0]> then\n            change [__player yv v] by (-0.035)\n        else\n            if <(__PLAYER YV) < [-0.4]> then\n                set [__player yv v] to [-0.4]\n            else\n                change [__player yv v] by (-0.08)\n            end\n        end\n        if <(__STATE - CLOUD) = [1]> then\n            if <(__PLAYER YV) > [0]> then\n        end\n    else\n        if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <key (space v) pressed?>> or <(__JOYSTICK Y) > [15]>> then\n            if <(crouch) = [0]> then\n                if <(up key pressed) = [0]> then\n                    set [up key pressed v] to [1]\n                    set [__player yv v] to [0.3]\n                end\n            end\n        else\n            set [up key pressed v] to [0]\n        end\n        if <(__PLAYER YV) > [0]> then\n            change [__player yv v] by (-0.02)\n        else\n            change [__player yv v] by (-0.04)\n            if <(__PLAYER YV) < [-0.5]> then\n                set [__player yv v] to [-0.5]\n            end\n        end\n        set [__player yv v] to ((__PLAYER YV) * (0.9))\n    end\n    change [__player in air v] by (1)\n    Change Y by (__PLAYER YV)\n    if <(__PLAYER Y) < [0.01]> then\n        set [_dead v] to [1]\n        set [invincible? v] to [0]\n    end\nend\nScroll [8]\n\nwhen flag clicked\nset [timer v] to [0]\nset [__is mobile? v] to [1]\nbroadcast (_START TRANSITION v) and wait\nif <(_EDITOR) = [1]> then\n    broadcast (_SAVE LEVEL v) and wait\nend\nset [__game level v] to [1]\nset [__game sub level v] to [0]\nClear NPC Data\nbroadcast (_CREATE CLONES v) and wait\nbroadcast (_INIT GUI v) and wait\nbroadcast (_INIT INVENTORY v) and wait\nforever\n    erase all\n    hide\n    delete all of [@mob spawns v]\n    delete all of [@particle spawns v]\n    broadcast (_DELETE OBJECTS v) and wait\n    broadcast (_LOAD LEVEL v) and wait\n    broadcast (_SIZE v) and wait\n    delete all of [_text to write v]\n    broadcast (DELETE TEXT CLONES v) and wait\n    set [_tiny v] to [0.01]\n    Find Spawn\n    set [__player x v] to (spawn x)\n    set [__player y v] to (spawn y)\n    set [__power up level v] to [0]\n    Spawn Mobs and Moving Platforms\n    Calculate Remaining Gifts\n    Init Player\n    set [_editor v] to [0]\n    hide variable [zoom v]\n    hide variable [_backdrop v]\n    Scroll [1]\n    broadcast (@Stamp Backdrop Tick v)\n    broadcast (@Stamp Tile Tick v)\n    broadcast (@Particle Spawn Tick v)\n    broadcast (@Mob Spawn Tick v)\n    broadcast (@Snow Tick v)\n    broadcast (@Animate v)\n    broadcast (_COMPLETE TRANSITION v) and wait\n    repeat until <(_EXIT) > [0]>\n        if <(__GAME MODE) > [0]> then\n            if <(_DEAD) > [0]> then\n                Scroll [99999]\n                start sound [Squish Pop v]\n                repeat (10)\n                    change size by (30)\n                    change [ghost v] effect by (10)\n                    broadcast (@First Tick v)\n                    broadcast (@Mob Spawn Tick v)\n                    broadcast (@Mob Tick v)\n                    broadcast (@Particle Spawn Tick v)\n                    broadcast (@Snow Tick v)\n                    broadcast (@Stamp Backdrop Tick v)\n                    broadcast (@Stamp Mid Layer Tick v)\n                    broadcast (@Stamp Tile Tick v)\n                    broadcast (@Animate v)\n                end\n                hide\n                repeat (15)\n                    broadcast (@First Tick v)\n                    broadcast (@Mob Spawn Tick v)\n                    broadcast (@Mob Tick v)\n                    broadcast (@Particle Spawn Tick v)\n                    broadcast (@Snow Tick v)\n                    broadcast (@Stamp Backdrop Tick v)\n                    broadcast (@Stamp Mid Layer Tick v)\n                    broadcast (@Stamp Tile Tick v)\n                    broadcast (@Animate v)\n                end\n                Init Player\n            end\n            if <<key (i v) pressed?> and <key (e v) pressed?>> then\n                Clear Text\n                set [__player in air v] to [0]\n                set [__player xv v] to [0]\n                set [__player yv v] to [0]\n                delete all of [@mob spawns v]\n                delete all of [@particle spawns v]\n                broadcast (_DELETE OBJECTS v) and wait\n                if <(_EDITOR) = [0]> then\n                    set [_editor v] to [1]\n                    show variable [zoom v]\n                    show variable [_backdrop v]\n                    broadcast (_LOAD LEVEL v) and wait\n                    if <(_MAP HEIGHT) < [50]> then\n                        Grow Level Height by ((50) - (_MAP HEIGHT)) blocks\n                    end\n                    if <(_MAP WIDTH) < [200]> then\n                        Grow Level Width by ((200) - (_MAP WIDTH)) blocks\n                    end\n                else\n                    set [_editor v] to [0]\n                    hide variable [zoom v]\n                    hide variable [_backdrop v]\n                    broadcast (_SAVE LEVEL v) and wait\n                    Find Spawn\n                    Spawn Mobs and Moving Platforms\n                    Calculate Remaining Gifts\n                end\n                wait until <not <key (i v) pressed?>>\n            end\n            if <([abs v] of ((ZOOM) - (_TILE SIZE)) ) > [0.3]> then\n                if <(ZOOM) > (_TILE SIZE)> then\n                    change [_tile size v] by (1)\n                else\n                    change [_tile size v] by (-1)\n                end\n                broadcast (_SIZE v)\n                Scroll [1]\n            end\n            if <(_EDITOR) > [0]> then\n                // [editor]\n                broadcast (@First Tick v)\n                broadcast (@Editor Tick v)\n                broadcast (@Stamp Backdrop Tick v)\n                broadcast (@Editor Tile Tick v)\n            else\n                if <(__GAME MODE) = [1]> then\n                    // [normal game]\n                    if <(__STATE - ENEMY COLLISION) > [0]> then\n                        if <(invincible?) < [1]> then\n                            set [_dead v] to [1]\n                        else\n                            set [_dead v] to [0]\n                        end\n                    end\n                    set [__state - enemy collision v] to [0]\n                    broadcast (@First Tick v)\n                    broadcast (@Mob Spawn Tick v)\n                    broadcast (@Mob Tick v)\n                    broadcast (@Player Tick v)\n                    broadcast (@Stamp Backdrop Tick v)\n                    broadcast (@Stamp Mid Layer Tick v)\n                    broadcast (@Stamp Tile Tick v)\n                else\n                    if <(__GAME MODE) = [2]> then\n                        // [text bubble open]\n                        if <<key (x v) pressed?> or <<(length of [_text to write v]) > [0]> and <(_TEXT TO WRITE) = []>>> then\n                            Clear Text\n                        else\n                            if <(length of [_text to write v]) > [0]> then\n                                broadcast (DELETE TEXT CLONES v)\n                                broadcast (@Text Tick v)\n                            end\n                        end\n                        broadcast (@First Tick v)\n                        broadcast (@Mob Spawn Tick v)\n                        broadcast (@Mob Tick v)\n                        broadcast (@Idle Player Tick v)\n                        broadcast (@Stamp Backdrop Tick v)\n                        broadcast (@Stamp Mid Layer Tick v)\n                        broadcast (@Stamp Tile Tick v)\n                    end\n                end\n            end\n        end\n        broadcast (@Joystick Tick v)\n        broadcast (@Particle Spawn Tick v)\n        broadcast (@Snow Tick v)\n        broadcast (@Animate v)\n    end\n    if <(_EXIT) = [1]> then\n        repeat (30)\n            broadcast (@First Tick v)\n            broadcast (@Mob Spawn Tick v)\n            broadcast (@Mob Tick v)\n            broadcast (@Idle Player Tick v)\n            broadcast (@Particle Spawn Tick v)\n            broadcast (@Snow Tick v)\n            broadcast (@Stamp Backdrop Tick v)\n            broadcast (@Stamp Mid Layer Tick v)\n            broadcast (@Stamp Tile Tick v)\n            broadcast (@Animate v)\n        end\n        if <(__GAME LEVEL) < (length of [levels - game v])> then\n            change [__game level v] by (1)\n            set [__game sub level v] to [0]\n        end\n    end\n    broadcast (_START TRANSITION v) and wait\nend\n\ndefine Get IsSolid at X (x) Y (y)\nif <(isSolid) = [0]> then\n    if <<(x) > (_MAP WIDTH)> or <(x) < [0]>> then\n        set [issolid v] to [1]\n    else\n        if <<(y) > (_MAP HEIGHT)> or <(y) < [0]>> then\n    end\nend\n\ndefine Change X by (x)\nchange [__player x v] by (x)\nset [issolid v] to [0]\nif <(x) > [0]> then\n    Get IsSolid at X ((__PLAYER X) + (width)) Y ((__PLAYER Y) + (_TINY))\n    Get IsSolid at X ((__PLAYER X) + (width)) Y ((__PLAYER Y) + ((height) / (2)))\n    Get IsSolid at X ((__PLAYER X) + (width)) Y ((__PLAYER Y) + ((height) - (_TINY)))\n    if <(isSolid) > [0]> then\n        set [__player x v] to (([floor v] of ((__PLAYER X) + (width)) ) - (width))\n        set [__player xv v] to [0]\n        set [issolid v] to [0]\n    end\n    Check For Moving Platforms\n    if <(isSolid) > [0]> then\n        set [__player x v] to (((item (i) of [_moving platforms v]) - (item ((i) + (2)) of [_moving platforms v])) - (width))\n        set [__player xv v] to [0]\n    end\nelse\n    Get IsSolid at X ((__PLAYER X) - (width)) Y ((__PLAYER Y) + (_TINY))\n    Get IsSolid at X ((__PLAYER X) - (width)) Y ((__PLAYER Y) + ((height) / (2)))\n    Get IsSolid at X ((__PLAYER X) - (width)) Y ((__PLAYER Y) + ((height) - (_TINY)))\n    if <(isSolid) > [0]> then\n        set [__player x v] to (([ceiling v] of ((__PLAYER X) - (width)) ) + (width))\n        set [__player xv v] to [0]\n        set [issolid v] to [0]\n    end\n    Check For Moving Platforms\n    if <(isSolid) > [0]> then\n        set [__player x v] to (((item (i) of [_moving platforms v]) + (item ((i) + (2)) of [_moving platforms v])) + (width))\n        set [__player xv v] to [0]\n    end\nend\n\ndefine Change Y by (y)\nchange [__player y v] by (y)\nset [issolid v] to [0]\nif <(y) > [0]> then\n    Get IsSolid at X ((__PLAYER X) + ((width) - (_TINY))) Y ((__PLAYER Y) + (height))\n    Get IsSolid at X ((__PLAYER X) - ((width) - (_TINY))) Y ((__PLAYER Y) + (height))\n    if <(isSolid) > [0]> then\n        set [__player y v] to (([floor v] of ((__PLAYER Y) + (height)) ) - (height))\n        set [__player yv v] to [0]\n        set [issolid v] to [0]\n    end\n    Check For Moving Platforms\n    if <(isSolid) > [0]> then\n        set [__player y v] to ((item ((i) + (1)) of [_moving platforms v]) - (height))\n        set [__player yv v] to [0]\n    end\nelse\n    Get IsSolid at X ((__PLAYER X) + ((width) - (_TINY))) Y (__PLAYER Y)\n    Get IsSolid at X ((__PLAYER X) - ((width) - (_TINY))) Y (__PLAYER Y)\n    if <(isSolid) > [0]> then\n        set [__player in air v] to [0]\n        set [__player yv v] to [0]\n        set [issolid v] to [0]\n        set [is jump? v] to [0]\n        if <(__POWER UP LEVEL) = [1]> then\n            if <(y) < [-0.1]> then\n                Get IsSolid at X (__PLAYER X) Y (__PLAYER Y)\n                if <(tile type) = [94]> then\n                    set [__player yv v] to [0.2]\n                    set [__player in air v] to [9999999999999]\n                    Particle Burst at X: (([floor v] of (__PLAYER X) ) + (0.5)) Y: ([floor v] of (__PLAYER Y) ) Size: [8] Type: [6]\n                    replace item (idx) of [#tile grid v] with [1]\n                end\n                set [issolid v] to [0]\n            end\n        end\n        set [__player y v] to ([ceiling v] of (__PLAYER Y) )\n    end\n    Check For Moving Platforms\n    if <(isSolid) > [0]> then\n        set [__player y v] to ((item ((i) + (1)) of [_moving platforms v]) + (item ((i) + (3)) of [_moving platforms v]))\n        set [__player in air v] to [0]\n        set [__player yv v] to [0]\n        set [is jump? v] to [0]\n    end\nend\n\ndefine Scroll (smoothness)\nchange [_scroll x v] by ((((((__PLAYER X) - (0.5)) * (_TILE SIZE)) + (scroll offset x)) - (_SCROLL X)) / (smoothness))\nif <(_SCROLL X) > (((_TILE SIZE) * ((_MAP WIDTH) - (0.5))) - (240))> then\n    set [_scroll x v] to (((_TILE SIZE) * ((_MAP WIDTH) - (0.5))) - (240))\nend\nif <(_SCROLL X) < ((240) - ((_TILE SIZE) / (2)))> then\n    set [_scroll x v] to ((240) - ((_TILE SIZE) / (2)))\nend\nchange [_scroll y v] by (((((__PLAYER Y) - (0.1)) * (_TILE SIZE)) - (_SCROLL Y)) / (smoothness))\nif <(_SCROLL Y) > (((_TILE SIZE) * ((_MAP HEIGHT) - (0.5))) - (180))> then\n    set [_scroll y v] to (((_TILE SIZE) * ((_MAP HEIGHT) - (0.5))) - (180))\nend\nif <(_SCROLL Y) < ((180) - ((_TILE SIZE) / (2)))> then\n    set [_scroll y v] to ((180) - ((_TILE SIZE) / (2)))\nend\n\ndefine Check States\nif <(__STATE - SOLID) = [1]> then\n    if <([abs v] of (__MOVING PLATFORM XV) ) > [0]> then\n        Check for Player Suffocation\n        if <(isSolid) > [0]> then\n            change [__player x v] by (__MOVING PLATFORM XV)\n        else\n            Change X by (__MOVING PLATFORM XV)\n        end\n    end\n    if <([abs v] of (__MOVING PLATFORM YV) ) > [0]> then\n        Check for Player Suffocation\n        if <(isSolid) > [0]> then\n            change [__player y v] by (__MOVING PLATFORM YV)\n        else\n            Change Y by (__MOVING PLATFORM YV)\n        end\n    end\n    set [__state - solid v] to [0]\nend\nset [old x v] to (__PLAYER X)\nset [old y v] to (__PLAYER Y)\nCheck for Player Suffocation\nif <(isSolid) > [0]> then\n    if <(__MOVING PLATFORM YV) < [0]> then\n        set [__player y v] to ([ceiling v] of (__PLAYER Y) )\n    else\n        if <(([ceiling v] of (__PLAYER Y) ) - (__PLAYER Y)) > [0.5]> then\n            change [__player y v] by (0.5)\n        else\n            set [__player y v] to ([ceiling v] of (__PLAYER Y) )\n        end\n    end\n    Check for Player Suffocation\n    if <(isSolid) > [0]> then\n        set [__player y v] to (old y)\n        change [__player x v] by (0.5)\n        Check for Player Suffocation\n        if <(isSolid) > [0]> then\n            change [__player x v] by (-1)\n            Check for Player Suffocation\n            if <(isSolid) > [0]> then\n                set [__player x v] to (old x)\n                change [__player y v] by (-0.2)\n                Check for Player Suffocation\n                if <(isSolid) > [0]> then\n                    set [__player x v] to (old x)\n                    set [__player y v] to (old y)\n                    set [_dead v] to [1]\n                end\n            end\n        end\n    end\nend\nif <(__STATE - WATER) = [0]> then\n    set [in water v] to [0]\nelse\n    set [__state - water v] to [0]\n    set [in water v] to [1]\nend\nset [__moving platform xv v] to [0]\nset [__moving platform yv v] to [0]\nGet State at X ((__PLAYER X) - ((width) - (_TINY))) Y ((__PLAYER Y) + ((height) - (_TINY)))\nGet State at X ((__PLAYER X) + ((width) - (_TINY))) Y ((__PLAYER Y) + ((height) - (_TINY)))\nset [__state - danger v] to [0]\nGet State at X ((__PLAYER X) + ((width) - (_TINY))) Y ((__PLAYER Y) + ((height) / (2)))\nGet State at X ((__PLAYER X) - ((width) - (_TINY))) Y ((__PLAYER Y) + ((height) / (2)))\nif <(__STATE - DANGER) = [1]> then\n    set [_dead v] to [1]\nend\nset [__state - cloud v] to [0]\nGet State at X ((__PLAYER X) + ((width) - (_TINY))) Y ((__PLAYER Y) + (_TINY))\nGet State at X ((__PLAYER X) - ((width) - (_TINY))) Y ((__PLAYER Y) + (_TINY))\nif <(__STATE - WATER) = [1]> then\n    if <(in water) = [0]> then\n        set [in water v] to [1]\n        start sound [Splash v]\n        Particle Burst at X: (__PLAYER X) Y: (__PLAYER Y) Size: [10] Type: [5]\n    end\nend\n\ndefine Get State at X (x) Y (y)\nif <<<(x) > (_MAP WIDTH)> or <(y) > (_MAP HEIGHT)>> or <<(x) < [0]> or <(y) < [0]>>> then\n    stop [this script v]\nelse\n    set [idx v] to (((([floor v] of (x) ) * (_MAP HEIGHT)) + ([floor v] of (y) )) + (1))\n    set [tile type v] to (item (idx) of [#tile grid v])\n    set [tile shape v] to []\n    set [tile shape v] to (item (tile type) of [#tile shape v])\n    if <(tile shape) > []> then\n        if <(tile shape) = [~]> then\n            set [__state - water v] to [1]\n        else\n            if <(tile shape) = [m]> then\n                set [__state - cloud v] to [1]\n            else\n                if <(tile shape) = [^]> then\n                    set [__state - danger v] to [1]\n                else\n                    if <(tile shape) = [$]> then\n                        replace item (idx) of [#tile grid v] with [1]\n                        if <(tile type) = [35]> then\n                            // [checkpoint]\n                            Particle | Type: [3] X: ([floor v] of (x) ) Y: ([floor v] of (y) )\n                            set [spawn x v] to (([floor v] of (x) ) + (0.5))\n                            set [spawn y v] to ([floor v] of (y) )\n                        else\n                            if <(tile type) = [69]> then\n                                // [cookie - large power up]\n                                set [spawn x v] to (([floor v] of (x) ) + (0.5))\n                                set [spawn y v] to ([floor v] of (y) )\n                                set [__power up level v] to [1]\n                                Set Height\n                            else\n                                Particle | Type: [2] X: ([floor v] of (x) ) Y: ([floor v] of (y) )\n                            end\n                        end\n                        start sound (pick random (4) to (14))\n                        Particle Burst at X: (([floor v] of (x) ) + (0.5)) Y: ([floor v] of (y) ) Size: [10] Type: [1]\n                        change [_gifts collected v] by (1)\n                        if <not <(_GIFTS COLLECTED) < (_TOTAL GIFTS)>> then\n                            if <(__GAME LEVEL) < (length of [levels - game v])> then\n                                set [_exit v] to [1]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Check For Moving Platforms\nset [i v] to [1]\nrepeat ((length of [_moving platforms v]) / (4))\n    if <([abs v] of ((item (i) of [_moving platforms v]) - (__PLAYER X)) ) < (((item ((i) + (2)) of [_moving platforms v]) + (width)) - (_TINY))> then\n        if <([abs v] of (((__PLAYER Y) + ((height) / (2))) - ((item ((i) + (1)) of [_moving platforms v]) + ((item ((i) + (3)) of [_moving platforms v]) / (2)))) ) < ((((item ((i) + (3)) of [_moving platforms v]) / (2)) + ((height) / (2))) - (_TINY))> then\n            set [issolid v] to [1]\n            stop [this script v]\n        end\n    end\n    change [i v] by (4)\nend\n\nwhen I receive [@first tick v]\ndelete all of [_moving platforms v]\ndelete all of [@particle spawns v]\nchange [timer v] by (0.0333)\nset [__mob count v] to [0]\nset [_targeted npc x v] to []\nset [_targeted npc y v] to []\nerase all\n\ndefine Check for Player Suffocation\nset [issolid v] to [0]\nGet IsSolid at X ((__PLAYER X) + ((width) - (_TINY))) Y ((__PLAYER Y) + (_TINY))\nGet IsSolid at X ((__PLAYER X) + ((width) - (_TINY))) Y ((__PLAYER Y) + ((height) / (2)))\nGet IsSolid at X ((__PLAYER X) + ((width) - (_TINY))) Y ((__PLAYER Y) + ((height) - (_TINY)))\nGet IsSolid at X ((__PLAYER X) - ((width) - (_TINY))) Y ((__PLAYER Y) + (_TINY))\nGet IsSolid at X ((__PLAYER X) - ((width) - (_TINY))) Y ((__PLAYER Y) + ((height) / (2)))\nGet IsSolid at X ((__PLAYER X) - ((width) - (_TINY))) Y ((__PLAYER Y) + ((height) - (_TINY)))\nCheck For Moving Platforms\n\nwhen I receive [@editor tick v]\nif <key (z v) pressed?> then\n    set [speed v] to [0.8]\nelse\n    set [speed v] to [0.4]\nend\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    point in direction (90)\n    change [__player x v] by (speed)\nelse\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        point in direction (-90)\n        change [__player x v] by ((0) - (speed))\n    end\nend\nif <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n    change [__player y v] by (0.3)\nelse\n    if <<key (down arrow v) pressed?> or <key (s v) pressed?>> then\n        change [__player y v] by (-0.3)\n    end\nend\nScroll [2]\n\ndefine Grow Level Height by (#) blocks\nset [scanner v] to [1]\nrepeat (_MAP WIDTH)\n    change [scanner v] by (_MAP HEIGHT)\n    repeat (#)\n        insert [1] at (scanner) of [#tile grid v] \n        insert [0] at (scanner) of [@mob grid v] \n        insert [0] at (scanner) of [%data grid v] \n        change [scanner v] by (1)\n    end\nend\nset [_map height v] to ((_MAP HEIGHT) + (#))\n\ndefine Grow Level Width by (#) blocks\nrepeat ((#) * (_MAP HEIGHT))\n    add [1] to [#tile grid v]\n    add [0] to [@mob grid v]\n    add [0] to [%data grid v]\nend\nset [_map width v] to ((_MAP WIDTH) + (#))\n\ndefine Spawn Mobs and Moving Platforms\nreplace item (item # of [34] in [@mob grid v]) of [@mob grid v] with [0]\nset [idx v] to [0]\nrepeat (length of [@mob grid v])\n    change [idx v] by (1)\n    if <(item (idx) of [@mob grid v]) > [0]> then\n        add (item (item (idx) of [@mob grid v]) of [@mob tiles v]) to [@mob spawns v]\n        add (([floor v] of (((idx) - (1)) / (_MAP HEIGHT)) ) + (0.5)) to [@mob spawns v]\n        add (((idx) - (1)) - ((_MAP HEIGHT) * ([floor v] of (((idx) - (1)) / (_MAP HEIGHT)) ))) to [@mob spawns v]\n    end\nend\n\ndefine Clear NPC Data\ndelete all of [_npc data v]\nrepeat (1000)\n    add [1] to [_npc data v]\nend\n\ndefine Decode Command (command)\nset [i v] to [1]\nset [command id v] to []\nset [command data v] to []\nif <(letter (i) of (command)) = [/]> then\n    change [i v] by (1)\n    repeat until <(letter (i) of (command)) = [ ]>\n        set [command id v] to (join (command id) (letter (i) of (command)))\n        change [i v] by (1)\n        if <(i) > (length of (command))> then\n            set [command id v] to []\n            set [command data v] to []\n            stop [this script v]\n        end\n    end\n    repeat until <(i) > (length of (command))>\n        set [command data v] to (join (command data) (letter (i) of (command)))\n        change [i v] by (1)\n    end\nend\n\nwhen I receive [_size v]\nset size to (((_TILE SIZE) / (8)) * (100)) %\n\ndefine Animate | Stand: (stand) Walk: (walk) Jump: (jump) Swim: (swim) Crouch: (crouch)\nif <(crouch) > [0]> then\n    switch costume to (crouch)\nelse\n    if <(__PLAYER IN AIR) > [2]> then\n        if <(__STATE - WATER) = [0]> then\n            switch costume to (jump)\n        else\n            switch costume to (swim)\n        end\n    else\n        if <([abs v] of (__PLAYER XV) ) > [0.01]> then\n            switch costume to (walk)\n        else\n            switch costume to (stand)\n        end\n    end\nend\n\nwhen I receive [@animate v]\nset [score v] to (join (join (_GIFTS COLLECTED) [/]) (_TOTAL GIFTS))\nswitch costume to (big v)\ngo to x: ((((__PLAYER X) - (0.5)) * (_TILE SIZE)) - (_SCROLL X)) y: ((((__PLAYER Y) - (0.5)) * (_TILE SIZE)) - (_SCROLL Y))\nif <(__POWER UP LEVEL) = [0]> then\n    Animate | Stand: (([floor v] of (((TIMER) * (0.3)) mod (1.04)) ) + (1)) Walk: (([floor v] of (((TIMER) * (8)) mod (2)) ) + (3)) Jump: [5] Swim: (([floor v] of (((TIMER) * (8)) mod (8)) ) + (6)) Crouch: []\nelse\n    if <(__POWER UP LEVEL) = [1]> then\n        Animate | Stand: (([floor v] of (((TIMER) * (0.3)) mod (1.04)) ) + (14)) Walk: (([floor v] of (((TIMER) * (8)) mod (2)) ) + (16)) Jump: [18] Swim: (([floor v] of (((TIMER) * (12)) mod (8)) ) + (19)) Crouch: [27]\n    end\nend\n\nwhen I receive [@idle player tick v]\nCheck States\nif <(_DEAD) < [1]> then\n    Change X by (__PLAYER XV)\n    if <(__PLAYER IN AIR) > [4]> then\n        set [__player xv v] to ((__PLAYER XV) * (0.85))\n    else\n        set [__player xv v] to ((__PLAYER XV) * (0.7))\n    end\n    if <(__STATE - WATER) = [0]> then\n        if <(__PLAYER YV) > [0]> then\n            change [__player yv v] by (-0.02)\n        else\n            change [__player yv v] by (-0.04)\n            if <(__PLAYER YV) < [-0.5]> then\n                set [__player yv v] to [-0.5]\n            end\n        end\n    else\n        if <(__PLAYER YV) > [0]> then\n            change [__player yv v] by (-0.02)\n        else\n            change [__player yv v] by (-0.04)\n            if <(__PLAYER YV) < [-0.5]> then\n                set [__player yv v] to [-0.5]\n            end\n        end\n        set [__player yv v] to ((__PLAYER YV) * (0.9))\n    end\n    change [__player in air v] by (1)\n    Change Y by (__PLAYER YV)\n    if <(__PLAYER Y) < [0.01]> then\n        set [_dead v] to [1]\n    end\nend\nScroll [8]\n\ndefine Calculate Remaining Gifts\nset [idx v] to [0]\nset [_gifts collected v] to [0]\nset [_total gifts v] to [0]\nrepeat (length of [#tile grid v])\n    change [idx v] by (1)\n    if <(item (item (idx) of [#tile grid v]) of [#tile shape v]) = [$]> then\n        change [_total gifts v] by (1)\n    end\nend\nset [score v] to (join (join (_GIFTS COLLECTED) [/]) (_TOTAL GIFTS))\n\ndefine // (comment)\n\ndefine Particle | Type: (type) X: (x) Y: (y)\nadd (type) to [@particle spawns v]\nadd (x) to [@particle spawns v]\nadd (y) to [@particle spawns v]\n\ndefine Init Player\nset [__joystick x v] to [0]\nset [__joystick y v] to [0]\nset [__player x v] to (spawn x)\nset [__player y v] to (spawn y)\nset [_exit v] to [0]\nset [_dead v] to [0]\nset [_active npc v] to [0]\nset [__player yv v] to [0]\nset [__player xv v] to [0]\nset [in water v] to [1]\nset [__state - solid v] to [0]\nset [__state - water v] to [0]\nset [__state - cloud v] to [0]\nset [__state - enemy collision v] to [0]\nset [__game mode v] to [1]\nset [scroll offset x v] to [0]\nset [_targeted npc x v] to []\nset [_targeted npc y v] to []\nset [invincible? v] to [60]\nset [width v] to [0.2]\nchange [down pressed v] by (0)\nchange [crouch v] by (0)\nSet Height\nbroadcast (_SIZE v) and wait\nshow\nclear graphic effects\nset rotation style [left-right v]\npoint in direction (90)\n\ndefine Find Spawn\nif <(item # of [34] in [@mob grid v]) > [0]> then\n    set [spawn x v] to (([floor v] of (((item # of [34] in [@mob grid v]) - (1)) / (_MAP HEIGHT)) ) + (0.5))\n    set [spawn y v] to (((item # of [34] in [@mob grid v]) - (1)) - ((_MAP HEIGHT) * ([floor v] of (((item # of [34] in [@mob grid v]) - (1)) / (_MAP HEIGHT)) )))\nelse\n    set [spawn x v] to [4.5]\n    set [spawn y v] to [2]\nend\n\ndefine Clear Text\ndelete all of [_text to write v]\nbroadcast (DELETE TEXT CLONES v)\nset [__game mode v] to [1]\nset [_active npc v] to [0]\n\ndefine Particle Burst at X: (x) Y: (y) Size: (size) Type: (type)\nrepeat (size)\n    Particle | Type: (type) X: ((x) - (0.5)) Y: (y)\nend\n\ndefine Set Height\nif <(__POWER UP LEVEL) = [0]> then\n    set [height v] to [0.8]\n    set [crouch v] to [0]\nelse\n    if <(crouch) = [1]> then\n        set [height v] to [0.8]\n    else\n        set [height v] to [1.5]\n        set [issolid v] to [0]\n        Get IsSolid at X ((__PLAYER X) + ((width) - (_TINY))) Y ((__PLAYER Y) + ((height) - (_TINY)))\n        Get IsSolid at X ((__PLAYER X) - ((width) - (_TINY))) Y ((__PLAYER Y) + ((height) - (_TINY)))\n        if <(isSolid) > [0]> then\n            set [crouch v] to [1]\n            set [height v] to [0.8]\n        end\n    end\nend\n\n@Tiles\n\ndefine Draw Tile\nswitch costume to (big v)\ngo to x: (((x) * (_TILE SIZE)) - (_SCROLL X)) y: (((y) * (_TILE SIZE)) - (_SCROLL Y))\nif <(tile) < [23]> then\n    if <(tile) = [4]> then\n        switch costume to (([floor v] of ((((TIMER) * (5)) + (x)) mod (6)) ) + (tile))\n        stop [this script v]\n    else\n        if <(tile) = [14]> then\n            switch costume to (([floor v] of ((((TIMER) * (5)) + (x)) mod (6)) ) + (tile))\n            stop [this script v]\n        else\n            if <(tile) = [22]> then\n                switch costume to (([floor v] of (((TIMER) * (10)) mod (5)) ) + (tile))\n                stop [this script v]\n            end\n        end\n    end\nelse\n    if <(tile) < [59]> then\n        if <(tile) = [35]> then\n            switch costume to (([floor v] of ((((TIMER) * (5)) + (x)) mod (6)) ) + (tile))\n            stop [this script v]\n        else\n            if <(tile) = [51]> then\n                switch costume to (([floor v] of ((((TIMER) * (5)) + (x)) mod (6)) ) + (tile))\n                stop [this script v]\n            else\n                if <(tile) = [58]> then\n                    switch costume to (([floor v] of (((TIMER) * (10)) mod (5)) ) + (tile))\n                    stop [this script v]\n                end\n            end\n        end\n    end\nend\nif <(tile) = [69]> then\n    switch costume to (([floor v] of ((((TIMER) * (5)) + (x)) mod (5)) ) + (tile))\n    stop [this script v]\nend\nswitch costume to (tile)\n\ndefine Render Game Tile Grid\nset [y v] to ([floor v] of (((_SCROLL Y) + ((180) + ((_TILE SIZE) / (2)))) / (_TILE SIZE)) )\nrepeat (tile grid height)\n    set [x v] to ([floor v] of (((_SCROLL X) - ((240) - ((_TILE SIZE) / (2)))) / (_TILE SIZE)) )\n    repeat (tile grid width)\n        set [idx v] to ((((x) * (_MAP HEIGHT)) + (y)) + (1))\n        set [tile v] to (item (idx) of [#tile grid v])\n        if <(tile) > [1]> then\n            Draw Tile\n            stamp\n        end\n        change [x v] by (1)\n    end\n    change [y v] by (-1)\nend\n\nwhen I receive [@stamp tile tick v]\nset [ghost v] effect to (0)\nhide\nRender Game Tile Grid\n\nwhen I receive [_size v]\nset size to ([ceiling v] of (((_TILE SIZE) / (8)) * (100)) ) %\nset [tile grid width v] to (([ceiling v] of ((480) / (_TILE SIZE)) ) + (1))\nset [tile grid height v] to (([ceiling v] of ((360) / (_TILE SIZE)) ) + (1))\n\ndefine Draw Mob (mob)\nswitch costume to (big v)\ngo to x: (((x) * (_TILE SIZE)) - (_SCROLL X)) y: ((((y) - (0.5)) * (_TILE SIZE)) - (_SCROLL Y))\nswitch costume to (mob)\n\nwhen I receive [@editor tile tick v]\nset [ghost v] effect to (0)\nset [brush x v] to (x)\nset [brush y v] to (y)\nRender Editor Tile Grid\nset [x v] to (brush x)\nset [y v] to (brush y)\nchange [x v] by ((([x v] of [editor v]) - (x)) / (2))\nchange [y v] by ((([y v] of [editor v]) - (y)) / (2))\nset [tile v] to (_EDITOR BRUSH)\nset [ghost v] effect to (35)\nif <(item (tile) of [@mob tiles v]) > [0]> then\n    Draw Mob (tile)\nelse\n    Draw Special Editor Tile\n    Draw Tile\nend\nshow\n\ndefine Render Editor Tile Grid\nset [y v] to ([floor v] of (((_SCROLL Y) + ((180) + ((_TILE SIZE) / (2)))) / (_TILE SIZE)) )\nrepeat (tile grid height)\n    set [x v] to ([floor v] of (((_SCROLL X) - ((240) - ((_TILE SIZE) / (2)))) / (_TILE SIZE)) )\n    repeat (tile grid width)\n        set [idx v] to ((((x) * (_MAP HEIGHT)) + (y)) + (1))\n        set [tile v] to (item (idx) of [#tile grid v])\n        if <(tile) > [1]> then\n            Draw Special Editor Tile\n            Draw Tile\n            stamp\n        end\n        if <(item (idx) of [@mob grid v]) > [0]> then\n            Draw Mob (item (idx) of [@mob grid v])\n            stamp\n        end\n        change [x v] by (1)\n    end\n    change [y v] by (-1)\nend\n\ndefine Draw Special Editor Tile\nif <(tile) = [28]> then\n    set [tile v] to [29]\nend\n\n@Editor\n\nwhen I receive [@editor tick v]\nset [x v] to ([floor v] of ((((mouse x) + (_SCROLL X)) / (_TILE SIZE)) + (0.5)) )\nset [y v] to ([floor v] of ((((mouse y) + (_SCROLL Y)) / (_TILE SIZE)) + (0.5)) )\nset [idx v] to ((((x) * (_MAP HEIGHT)) + (y)) + (1))\nif <not <(item (idx) of [%data grid v]) = [0]>> then\n    go to x: (((x) * (_TILE SIZE)) - (_SCROLL X)) y: (((y) * (_TILE SIZE)) - (_SCROLL Y))\n    say (item (idx) of [%data grid v])\nelse\n    say []\nend\nif <key ((join [] [/]) v) pressed?> then\n    set [__game mode v] to [0]\n    ask (join (join [| Current Data: ] (item (idx) of [%data grid v])) [ | Type a new command or leave blank to close.]) and wait\n    if <(answer) > []> then\n        replace item (idx) of [%data grid v] with (answer)\n    end\n    set [__game mode v] to [1]\nelse\n    if <mouse down?> then\n        if <(_EDITOR BRUSH) = [1]> then\n            if <(mouse down) = [0]> then\n                if <(item (idx) of [@mob grid v]) > [0]> then\n                    set [layer v] to [2]\n                else\n                    set [layer v] to [1]\n                end\n            end\n            if <(layer) = [1]> then\n                replace item (idx) of [#tile grid v] with [1]\n            else\n                replace item (idx) of [@mob grid v] with [0]\n            end\n            replace item (idx) of [%data grid v] with [0]\n        else\n            if <(item (_EDITOR BRUSH) of [@mob tiles v]) > []> then\n                if <(_EDITOR BRUSH) = [34]> then\n                    replace item (item # of [34] in [@mob grid v]) of [@mob grid v] with [0]\n                end\n                replace item (idx) of [@mob grid v] with (_EDITOR BRUSH)\n                set [layer v] to [2]\n            else\n                replace item (idx) of [#tile grid v] with (_EDITOR BRUSH)\n                set [layer v] to [1]\n            end\n        end\n        if <(layer) = [1]> then\n            Create Recipe | X: (x) Y: (y)\n            if <not <key (space v) pressed?>> then\n                Create Recipe | X: (x) Y: ((y) + (1))\n                Create Recipe | X: ((x) + (1)) Y: (y)\n                Create Recipe | X: (x) Y: ((y) - (1))\n                Create Recipe | X: ((x) - (1)) Y: (y)\n                Create Recipe | X: ((x) + (1)) Y: ((y) + (1))\n                Create Recipe | X: ((x) + (1)) Y: ((y) - (1))\n                Create Recipe | X: ((x) - (1)) Y: ((y) - (1))\n                Create Recipe | X: ((x) - (1)) Y: ((y) + (1))\n            end\n        end\n        set [mouse down v] to [1]\n    else\n        set [mouse down v] to [0]\n    end\nend\n\ndefine Create Recipe | X: (x) Y: (y)\nif <not <<<not <(x) < (_MAP WIDTH)>> or <not <(y) < (_MAP HEIGHT)>>> or <<(x) < [0]> or <(y) < [0]>>>> then\n    set [tile recipe v] to []\n    set [check idx v] to ([floor v] of ((((x) * (_MAP HEIGHT)) + (y)) + (1)) )\n    Get Tile Type at X (x) Y ((y) + (1))\n    Add information to recipe\n    Get Tile Type at X ((x) + (1)) Y (y)\n    Add information to recipe\n    Get Tile Type at X (x) Y ((y) - (1))\n    Add information to recipe\n    Get Tile Type at X ((x) - (1)) Y (y)\n    Add information to recipe\n    Get Tile Type at X ((x) + (1)) Y ((y) + (1))\n    Add information to recipe\n    Get Tile Type at X ((x) + (1)) Y ((y) - (1))\n    Add information to recipe\n    Get Tile Type at X ((x) - (1)) Y ((y) - (1))\n    Add information to recipe\n    Get Tile Type at X ((x) - (1)) Y ((y) + (1))\n    Add information to recipe\n    Find correct tile for recipe (check idx)\nend\n\ndefine Get Tile Type at X (x) Y (y)\nset [get tile v] to (((([floor v] of (x) ) * (_MAP HEIGHT)) + ([floor v] of (y) )) + (1))\nset [tile type v] to (item (get tile) of [#tile grid v])\nif <not <(tile type) = [28]>> then\n    if <<<not <(x) < (_MAP WIDTH)>> or <not <(y) < (_MAP HEIGHT)>>> or <<(x) < [0]> or <(y) < [0]>>> then\n        set [tile shape v] to [#]\n    else\n        set [tile shape v] to (item (tile type) of [#tile shape v])\n    end\nelse\n    set [tile shape v] to []\nend\n\ndefine Add information to recipe\nif <<(item (item (check idx) of [#tile grid v]) of [#tile groups v]) > []> and <(item (tile type) of [#tile groups v]) = (item (item (check idx) of [#tile grid v]) of [#tile groups v])>> then\n    if <(tile shape) = [#]> then\n        set [tile recipe v] to (join (tile recipe) [=])\n    else\n        set [tile recipe v] to (join (tile recipe) [1])\n    end\nelse\n    if <(tile shape) = [#]> then\n        set [tile recipe v] to (join (tile recipe) [#])\n    else\n        set [tile recipe v] to (join (tile recipe) [-])\n    end\nend\n\ndefine Find correct tile for recipe (idx)\nset [i2 v] to [1]\nset [tile group v] to (item (item (idx) of [#tile grid v]) of [#tile groups v])\nif <(tile group) > []> then\n    repeat (length of [#tile recipes v])\n        if <(item (i2) of [#tile groups v]) = (tile group)> then\n            if <(item (i2) of [#tile recipes v]) = (tile recipe)> then\n                replace item (idx) of [#tile grid v] with (i2)\n                stop [this script v]\n            else\n                set [i v] to [1]\n                repeat (length of (item (i2) of [#tile recipes v]))\n                    if <<<(letter (i) of (tile recipe)) = (letter (i) of (item (i2) of [#tile recipes v]))> or <<<(letter (i) of (item (i2) of [#tile recipes v])) = [=]> and <<(letter (i) of (tile recipe)) = [#]> or <(letter (i) of (tile recipe)) = [1]>>> or <(letter (i) of (item (i2) of [#tile recipes v])) = [*]>>> or <<(letter (i) of (item (i2) of [#tile recipes v])) = [0]> and <not <<(letter (i) of (tile recipe)) = [=]> or <(letter (i) of (tile recipe)) = [1]>>>>> then\n                        change [i v] by (1)\n                    end\n                end\n                if <(i) = ((length of (item (i2) of [#tile recipes v])) + (1))> then\n                    replace item (idx) of [#tile grid v] with (i2)\n                    stop [this script v]\n                end\n            end\n        end\n        change [i2 v] by (1)\n    end\nend\n\nwhen [1 v] key pressed\nSelect Brush [1]\n\ndefine Select Brush (key)\nif <(item (_EDITOR BRUSH) of [%editor keys v]) = (key)> then\n    change [_editor brush v] by (1)\n    repeat until <(item (_EDITOR BRUSH) of [%editor keys v]) = (key)>\n        change [_editor brush v] by (1)\n        if <(_EDITOR BRUSH) > (length of [%editor keys v])> then\n            set [_editor brush v] to (item # of (key) in [%editor keys v])\n            stop [this script v]\n        end\n    end\nelse\n    set [_editor brush v] to (item # of (key) in [%editor keys v])\nend\n\nwhen [2 v] key pressed\nSelect Brush [2]\n\nwhen [3 v] key pressed\nSelect Brush [3]\n\nwhen [4 v] key pressed\nSelect Brush [4]\n\nwhen [5 v] key pressed\nSelect Brush [5]\n\n@Backdrop\n\ndefine Render Tile Grid\nset [y v] to ([floor v] of ((((_SCROLL Y) - (180)) / (2)) / ((360) * (size))) )\nrepeat (([ceiling v] of ((360) / ((360) * (size))) ) + (1))\n    set [x v] to ([floor v] of ((((_SCROLL X) - (240)) / (2)) / ((480) * (size))) )\n    repeat (([ceiling v] of ((480) / ((480) * (size))) ) + (1))\n        Draw Tile\n        change [x v] by (1)\n    end\n    change [y v] by (1)\nend\n\nwhen I receive [@stamp backdrop tick v]\nRender Tile Grid\n\ndefine Draw Tile\nset [costume v] to (join (join [back] (_BACKDROP)) (join [ y] (y)))\nswitch costume to (costume)\nif <(costume [name v]) = (costume)> then\n    switch costume to (big v)\n    go to x: (round ((((x) * ((480) * (size))) - (((_SCROLL X) - (240)) / (2))) - ((240) * ((1) - (size))))) y: (round ((((y) * ((360) * (size))) - (((_SCROLL Y) - (180)) / (2))) - ((180) * ((1) - (size)))))\n    switch costume to (costume)\n    stamp\nend\n\nwhen I receive [_size v]\nset [size v] to ((_TILE SIZE) / (40))\nset size to ((size) * (400)) %\n\n@Fps Count\n\nwhen flag clicked\nset [last timer v] to [0]\nset [fps count v] to [0]\nforever\n    change [fps count v] by (1)\n    if <(timer) > ((last timer) + (1))> then\n        set [_fps v] to (fps count)\n        set [fps count v] to [0]\n        set [last timer v] to (timer)\n    end\nend\n\n@Mob\n\nwhen I receive [_size v]\nset size to (((_TILE SIZE) / (8)) * (100)) %\n\nwhen I receive [@mob tick v]\nif <(id) > []> then\n    change [__mob count v] by (1)\n    if <(id) < [6]> then\n        if <(id) = [1]> then\n            // [horizontal moving platform]\n            _Tick Moving Platform\n            set [costume v] to [2]\n            stop [this script v]\n        end\n        if <(id) = [2]> then\n            // [vertical moving platform up]\n            _Tick Moving Platform\n            set [costume v] to [3]\n            stop [this script v]\n        end\n        if <(id) = [3]> then\n            // [vertical moving platform down]\n            _Tick Moving Platform\n            set [costume v] to [3]\n            stop [this script v]\n        end\n        if <(id) = [4]> then\n            // [fast vertical platform]\n            _Tick Moving Platform\n            set [costume v] to [4]\n            stop [this script v]\n        end\n        if <(id) = [5]> then\n            // [fast horizontal platform]\n            _Tick Moving Platform\n            set [costume v] to [5]\n            stop [this script v]\n        end\n    else\n        if <(id) = [6]> then\n            // [full snowman enemy]\n            Check For Player Collision\n            Smart Mob Tick\n            if <(is stomped?) = [1]> then\n                bounce player\n                start sound (pick random (1) to (4))\n                set [id v] to [7]\n                Particle Burst at X: (x) Y: ((y) + (height)) Size: [5] Type: [1]\n                set [delay v] to [0]\n                set [temp v] to (speed x)\n                Init Mob\n            end\n            set [costume v] to (([floor v] of (((TIMER) * (8)) mod (4)) ) + (6))\n            stop [this script v]\n        end\n        if <(id) = [7]> then\n            // [medium snowman]\n            if <(speed x) = [0]> then\n                if <(delay) > [5]> then\n                    set [speed x v] to (temp)\n                else\n                    change [delay v] by (1)\n                end\n            end\n            Check For Player Collision\n            Smart Mob Tick\n            if <(is stomped?) = [1]> then\n                bounce player\n                start sound (pick random (1) to (4))\n                set [id v] to [8]\n                Particle Burst at X: (x) Y: ((y) + (height)) Size: [5] Type: [1]\n                set [delay v] to [0]\n                set [temp v] to (speed x)\n                Init Mob\n            end\n            set [costume v] to (([floor v] of (((TIMER) * (16)) mod (2)) ) + (10))\n            stop [this script v]\n        end\n        if <(id) = [8]> then\n            // [snowman bottom]\n            if <(speed x) = [0]> then\n                if <(delay) > [5]> then\n                    set [speed x v] to (temp)\n                else\n                    change [delay v] by (1)\n                end\n            end\n            Check For Player Collision\n            Smart Mob Tick\n            if <(is stomped?) = [1]> then\n                bounce player\n                start sound (pick random (1) to (4))\n                Particle Burst at X: (x) Y: ((y) + (height)) Size: [5] Type: [1]\n                set [id v] to []\n            end\n            set [costume v] to (([floor v] of (((TIMER) * (16)) mod (2)) ) + (12))\n            stop [this script v]\n        end\n        if <(id) = [10]> then\n            // [santa npc]\n            _Tick NPC\n            set [costume v] to [14]\n            stop [this script v]\n        end\n        if <(id) = [11]> then\n            // [slime]\n            Check For Player Collision\n            Basic Mob Tick\n            if <(is stomped?) = [1]> then\n                bounce player\n                set [__player yv v] to [0.65]\n                Particle Burst at X: (x) Y: (y) Size: [5] Type: [4]\n                start sound [Boing v]\n                set [status v] to [-4]\n            end\n            if <(status) < [0]> then\n                set [costume v] to [17]\n                change [status v] by (1)\n            else\n                if <(in air) = [0]> then\n                    change [delay v] by (1)\n                    set [speed x v] to [0]\n                    if <(delay) > [15]> then\n                        set [costume v] to [18]\n                        if <(delay) > [20]> then\n                            set [yv v] to [0.2]\n                            set [delay v] to [0]\n                            if <([abs v] of ((x) - (__PLAYER X)) ) < [10]> then\n                                if <([abs v] of ((y) - (__PLAYER Y)) ) < [7]> then\n                                    set [issolid v] to [0]\n                                    if <(__PLAYER X) > (x)> then\n                                        Get IsSolid at X ((x) + (1)) Y ((y) - (0.1))\n                                        if <(isSolid) > [0]> then\n                                            set [issolid v] to [0]\n                                            Get IsSolid at X ((x) + (1)) Y (y)\n                                            if <(isSolid) = [0]> then\n                                                set [speed x v] to [0.05]\n                                            end\n                                        end\n                                    else\n                                        Get IsSolid at X ((x) - (1)) Y ((y) - (0.1))\n                                        if <(isSolid) > [0]> then\n                                            set [issolid v] to [0]\n                                            Get IsSolid at X ((x) - (1)) Y (y)\n                                            if <(isSolid) = [0]> then\n                                                set [speed x v] to [-0.05]\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    else\n                        set [costume v] to [15]\n                    end\n                else\n                    set [delay v] to [0]\n                    if <(yv) > [0]> then\n                        set [costume v] to [16]\n                    else\n                        set [costume v] to [15]\n                    end\n                end\n            end\n            stop [this script v]\n        end\n        if <(id) = [12]> then\n            // [frombie]\n            Check For Player Collision\n            if <([abs v] of ((__PLAYER Y) - (y)) ) < [6]> then\n                if <([abs v] of ((__PLAYER X) - (x)) ) < [10]> then\n                    change [delay v] by (1)\n                    if <(delay) > (pick random (12) to (45))> then\n                        set [delay v] to [0]\n                        if <(__PLAYER X) > ((x) + (1))> then\n                            set [speed x v] to [0.08]\n                        else\n                            if <(__PLAYER X) < ((x) - (1))> then\n                                set [speed x v] to [-0.08]\n                            end\n                        end\n                    end\n                else\n                    set [speed x v] to ((0.04) * ((speed x) / ([abs v] of (speed x) )))\n                end\n            end\n            Smart Mob Tick\n            if <(is stomped?) = [1]> then\n                bounce player\n                Particle Burst at X: (x) Y: (y) Size: [10] Type: [1]\n                start sound [Zombie Death v]\n                set [id v] to []\n            end\n            set [costume v] to (([floor v] of (((timer) * (4)) mod (4)) ) + (19))\n        end\n        if <(id) = [13]> then\n            // [falling icicle]\n            if <(status) = [0]> then\n                if <([abs v] of ((__PLAYER X) - (x)) ) < [0.7]> then\n                    if <<(__PLAYER Y) < (y)> and <([abs v] of ((__PLAYER Y) - (y)) ) < [10]>> then\n                        set [status v] to [1]\n                    end\n                end\n            else\n                Check For Player Collision\n                Basic Mob Tick\n                if <(in air) < [1]> then\n                    Particle Burst at X: (x) Y: (y) Size: [10] Type: [1]\n                    start sound [Glass Breaking v]\n                    set [id v] to []\n                end\n            end\n            set [costume v] to [23]\n        end\n        if <(id) = [14]> then\n            // [crushy]\n            _Tick Moving Platform\n            if <(contact y) > [0]> then\n                if <(status) = [0]> then\n                    set [speed y v] to [0.08]\n                    set [delay v] to [20]\n                    if <([abs v] of ((((x) - (0.5)) * (_TILE SIZE)) - (_SCROLL X)) ) < [240]> then\n                        if <([abs v] of ((((y) - (0.5)) * (_TILE SIZE)) - (_SCROLL Y)) ) < [180]> then\n                            start sound [Thump v]\n                            Particle Burst at X: (x) Y: (y) Size: [3] Type: [1]\n                            Particle Burst at X: ((x) - (width)) Y: (y) Size: [3] Type: [1]\n                            Particle Burst at X: ((x) + (width)) Y: (y) Size: [3] Type: [1]\n                            change [_scroll y v] by (-5)\n                            if <(_SCROLL Y) < ((180) - ((_TILE SIZE) / (2)))> then\n                                set [_scroll y v] to ((180) - ((_TILE SIZE) / (2)))\n                            end\n                        end\n                    end\n                else\n                    if <(status) = [1]> then\n                        set [speed y v] to [-0.4]\n                        set [delay v] to [14]\n                    end\n                end\n                change [status v] by (1)\n                if <(status) > [1]> then\n                    set [status v] to [0]\n                end\n            end\n            if <(status) = [1]> then\n                if <(stop time) < ((delay) / (2))> then\n                    set [costume v] to [26]\n                else\n                    if <(stop time) < (delay)> then\n                        set [costume v] to [25]\n                    else\n                        set [costume v] to [27]\n                    end\n                end\n            else\n                if <(status) = [0]> then\n                    set [costume v] to [24]\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [@animate v]\nif <(id) > []> then\n    Animate\nelse\n    hide\nend\n\ndefine Create Clones\nset [mob# v] to [1]\nrepeat (50)\n    create clone of (_myself_ v)\n    change [mob# v] by (1)\nend\n\nwhen I receive [_create clones v]\nset [id v] to []\nCreate Clones\n\nwhen I receive [_delete objects v]\nset [id v] to []\n\ndefine Get IsSolid at X (x) Y (y)\nif <(isSolid) = [0]> then\n    if <<(x) > (_MAP WIDTH)> or <(x) < [0]>> then\n        set [issolid v] to [1]\n    else\n        if <<(y) > (_MAP HEIGHT)> or <(y) < [0]>> then\n    end\nend\n\ndefine Change X by (x)\nchange [x v] by (x)\nset [issolid v] to [0]\nif <(x) > [0]> then\n    Get IsSolid at X ((x) + (width)) Y ((y) + (_TINY))\n    if <(height) > [0.999]> then\n        Get IsSolid at X ((x) + (width)) Y ((y) + ((height) / (2)))\n    end\n    Get IsSolid at X ((x) + (width)) Y ((y) + ((height) - (_TINY)))\n    if <(isSolid) > [0]> then\n        set [x v] to (([floor v] of ((x) + (width)) ) - (width))\n    end\nelse\n    Get IsSolid at X ((x) - (width)) Y ((y) + (_TINY))\n    if <(height) > [0.999]> then\n        Get IsSolid at X ((x) - (width)) Y ((y) + ((height) / (2)))\n    end\n    Get IsSolid at X ((x) - (width)) Y ((y) + ((height) - (_TINY)))\n    if <(isSolid) > [0]> then\n        set [x v] to (([ceiling v] of ((x) - (width)) ) + (width))\n    end\nend\n\ndefine Init Mob\nset [delay v] to [0]\nset [status v] to [0]\nset [stop time v] to [99999999999]\nset [dialogue # v] to [1]\nif <(id) = [1]> then\n    // [horizontal platform]\n    Stats | Width: [1.25] Height: [0.99999] Speed X: [0] Speed Y: [0] Costume: [2]\n    set [issolid v] to [0]\n    Get IsSolid at X ((x) + ((width) + (0.3))) Y (y)\n    if <(isSolid) > [0]> then\n        Stats | Width: [1.25] Height: [0.99999] Speed X: [-0.1] Speed Y: [0] Costume: [2]\n    else\n        Stats | Width: [1.25] Height: [0.99999] Speed X: [0.1] Speed Y: [0] Costume: [2]\n    end\n    set [delay v] to [15]\n    set [activated? v] to [0]\n    set rotation style [don't rotate v]\n    stop [this script v]\nend\nif <(id) = [2]> then\n    // [vertical platform up]\n    Stats | Width: [1.25] Height: [0.99999] Speed X: [0] Speed Y: [0.1] Costume: [3]\n    set [delay v] to [15]\n    set [activated? v] to [0]\n    set rotation style [don't rotate v]\n    stop [this script v]\nend\nif <(id) = [3]> then\n    // [vertical platform down]\n    Stats | Width: [1.25] Height: [0.99999] Speed X: [0] Speed Y: [-0.1] Costume: [3]\n    set [delay v] to [15]\n    set [activated? v] to [0]\n    set rotation style [don't rotate v]\n    stop [this script v]\nend\nif <(id) = [4]> then\n    // [fast blackstone up/down]\n    Stats | Width: [1] Height: [0.99999] Speed X: [0] Speed Y: [-0.15] Costume: [4]\n    set [delay v] to [0]\n    set [activated? v] to [1]\n    set rotation style [don't rotate v]\n    stop [this script v]\nend\nif <(id) = [5]> then\n    // [fast red left/right]\n    Stats | Width: [1] Height: [0.99999] Speed X: [-0.15] Speed Y: [0] Costume: [5]\n    set [delay v] to [0]\n    set [activated? v] to [1]\n    set rotation style [don't rotate v]\n    stop [this script v]\nend\nif <(id) = [6]> then\n    set rotation style [left-right v]\n    // [full snowman enemy]\n    Stats | Width: [0.6] Height: [1] Speed X: [-0.05] Speed Y: [0] Costume: [6]\n    stop [this script v]\nend\nif <(id) = [7]> then\n    set rotation style [left-right v]\n    // [medium snowman enemy]\n    Stats | Width: [0.6] Height: [0.8] Speed X: [0] Speed Y: [0] Costume: [10]\n    stop [this script v]\nend\nif <(id) = [8]> then\n    set rotation style [left-right v]\n    // [tiny snowman enemy]\n    Stats | Width: [0.6] Height: [0.5] Speed X: [0] Speed Y: [0] Costume: [12]\n    stop [this script v]\nend\nif <(id) = [10]> then\n    // [santa]\n    set rotation style [left-right v]\n    Stats NPC | id: [1]\n    set [costume v] to [14]\n    stop [this script v]\nend\nif <(id) = [11]> then\n    set rotation style [left-right v]\n    Stats | Width: [0.3] Height: [0.5] Speed X: [0] Speed Y: [0] Costume: [15]\n    set [delay v] to ([floor v] of ((((x) * (5.3)) + (y)) mod (15)) )\n    stop [this script v]\nend\nif <(id) = [12]> then\n    // [frombie]\n    set rotation style [left-right v]\n    Stats | Width: [0.3] Height: [0.8] Speed X: [0.04] Speed Y: [0] Costume: [19]\n    stop [this script v]\nend\nif <(id) = [13]> then\n    // [icicle]\n    set rotation style [left-right v]\n    Stats | Width: [0.1] Height: [0.8] Speed X: [0] Speed Y: [0] Costume: [23]\n    stop [this script v]\nend\nif <(id) = [14]> then\n    // [crushy]\n    if <(item (((([floor v] of (x) ) * (_MAP HEIGHT)) + ([floor v] of (y) )) + (1)) of [%data grid v]) > [0]> then\n        set [stop time v] to ((0) - (item (((([floor v] of (x) ) * (_MAP HEIGHT)) + ([floor v] of (y) )) + (1)) of [%data grid v]))\n    end\n    set [activated? v] to [1]\n    set rotation style [left-right v]\n    Stats | Width: [1] Height: [2] Speed X: [0] Speed Y: [-0.4] Costume: [24]\n    stop [this script v]\nend\nAnimate\n\ndefine _Tick Moving Platform\nset [contact x v] to [0]\nset [contact y v] to [0]\nset [old x v] to (x)\nset [old y v] to (y)\nset [player collision v] to [0]\nif <([abs v] of ((x) - (__PLAYER X)) ) < (((width) + ([width v] of [player v])) - (_TINY))> then\n    if <([abs v] of ((((y) + (0.02)) + ((height) / (2))) - ((__PLAYER Y) + (([height v] of [player v]) / (2)))) ) < (((((height) / (2)) + (([height v] of [player v]) / (2))) + ((0.02) * <(__PLAYER Y) > ((y) + ((height) / (2)))>)) - (_TINY))> then\n        set [__state - solid v] to [1]\n        set [activated? v] to [1]\n        set [player collision v] to [1]\n    end\nend\nif <(activated?) = [1]> then\n    if <not <(stop time) < (delay)>> then\n        if <([abs v] of (speed x) ) > [0]> then\n            Change X by (speed x)\n            if <(isSolid) > [0]> then\n                set [stop time v] to [1]\n                if <(item (idx) of [#tile grid v]) = [70]> then\n                    set [speed y v] to (speed x)\n                    set [speed x v] to [0]\n                else\n                    if <(item (idx) of [#tile grid v]) = [71]> then\n                        set [speed y v] to ((0) - (speed x))\n                        set [speed x v] to [0]\n                    else\n                        set [speed x v] to ((0) - (speed x))\n                        set [contact x v] to [1]\n                    end\n                end\n            end\n        end\n        if <([abs v] of (speed y) ) > [0]> then\n            if <not <(stop time) < (delay)>> then\n                Change Y by (speed y)\n                if <(isSolid) > [0]> then\n                    set [stop time v] to [0]\n                    if <(item (idx) of [#tile grid v]) = [70]> then\n                        set [speed x v] to ((0) - (speed y))\n                        set [speed y v] to [0]\n                    else\n                        if <(item (idx) of [#tile grid v]) = [71]> then\n                            set [speed x v] to (speed y)\n                            set [speed y v] to [0]\n                        else\n                            set [speed y v] to ((0) - (speed y))\n                            set [contact y v] to [1]\n                        end\n                    end\n                end\n            end\n        end\n    else\n        change [stop time v] by (1)\n    end\nend\nset [xv v] to ((x) - (old x))\nset [yv v] to ((y) - (old y))\nif <(player collision) = [1]> then\n    set [__moving platform xv v] to (xv)\n    set [__moving platform yv v] to (yv)\nelse\n    if <([abs v] of ((x) - (__PLAYER X)) ) < (((width) + ([width v] of [player v])) - (_TINY))> then\n        if <([abs v] of (((y) + ((height) / (2))) - ((__PLAYER Y) + (([height v] of [player v]) / (2)))) ) < (((((height) / (2)) + (([height v] of [player v]) / (2))) + ((0.02) * <(__PLAYER Y) > ((y) + ((height) / (2)))>)) - (_TINY))> then\n            set [__state - solid v] to [1]\n            set [__moving platform xv v] to (xv)\n            set [__moving platform yv v] to (yv)\n        end\n    end\nend\nif <([abs v] of ((x) - (__PLAYER X)) ) < ((([width v] of [player v]) + (width)) + (1.5))> then\n    if <([abs v] of (((y) + ((height) / (2))) - ((__PLAYER Y) + (([height v] of [player v]) / (2)))) ) < ((((height) / (2)) + (([height v] of [player v]) / (2))) + (1.5))> then\n        add (x) to [_moving platforms v]\n        add (y) to [_moving platforms v]\n        add (width) to [_moving platforms v]\n        add (height) to [_moving platforms v]\n    end\nend\n\ndefine // (comment)\n\ndefine Change Y by (y)\nchange [y v] by (y)\nset [issolid v] to [0]\nif <(y) > [0]> then\n    Get IsSolid at X ((x) + ((width) - (_TINY))) Y ((y) + (height))\n    if <(width) > [0.4999]> then\n        Get IsSolid at X (x) Y ((y) + (height))\n    end\n    Get IsSolid at X ((x) - ((width) - (_TINY))) Y ((y) + (height))\n    if <(isSolid) > [0]> then\n        set [y v] to (([floor v] of ((y) + (height)) ) - (height))\n        set [yv v] to [0]\n    end\nelse\n    Get IsSolid at X ((x) + ((width) - (_TINY))) Y (y)\n    if <(width) > [0.4999]> then\n        Get IsSolid at X (x) Y (y)\n    end\n    Get IsSolid at X ((x) - ((width) - (_TINY))) Y (y)\n    if <(isSolid) > [0]> then\n        set [y v] to ([ceiling v] of (y) )\n        set [in air v] to [0]\n        set [yv v] to [0]\n    end\nend\n\ndefine _Tick NPC\nif <(__PLAYER X) > (x)> then\n    point in direction (90)\nelse\n    point in direction (-90)\nend\nif <(_ACTIVE NPC) > [0]> then\n    if <not <(_ACTIVE NPC) = (npc id)>> then\n        stop [this script v]\n    end\nend\nif <([abs v] of ((x) - (__PLAYER X)) ) < (((width) / (2)) + (0.8))> then\n    if <([abs v] of (((y) + ((height) / (2))) - ((__PLAYER Y) + (([height v] of [player v]) / (2)))) ) < ((height) + (0.8))> then\n        if <((_TARGETED NPC X) + (_TARGETED NPC Y)) > [0]> then\n            stop [this script v]\n        else\n            set [_targeted npc x v] to (x)\n            set [_targeted npc y v] to (y)\n        end\n        if <(__IS MOBILE?) > [0]> then\n            if <mouse down?> then\n                if <(z pressed) = [0]> then\n                    if <([abs v] of (([floor v] of ((((mouse x) + (_SCROLL X)) / (_TILE SIZE)) + (0.5)) ) - (x)) ) < [2]> then\n                        if <([abs v] of (([floor v] of ((((mouse y) + (_SCROLL Y)) / (_TILE SIZE)) + (0.5)) ) - (y)) ) < [2]> then\n                            Talk\n                        end\n                    end\n                    set [z pressed v] to [1]\n                end\n            else\n                set [z pressed v] to [0]\n            end\n        else\n            if <key (z v) pressed?> then\n                if <(z pressed) = [0]> then\n                    Talk\n                    set [z pressed v] to [1]\n                end\n            else\n                set [z pressed v] to [0]\n            end\n        end\n    else\n        stop [this script v]\n    end\nelse\n    stop [this script v]\nend\n\ndefine Stats | Width: (width) Height: (height) Speed X: (sx) Speed Y: (sy) Costume: (costume)\nset [width v] to (width)\nset [height v] to (height)\nset [speed x v] to (sx)\nset [speed y v] to (sy)\nset [costume v] to (costume)\n\ndefine Stats NPC | id: (id)\nset [npc id v] to (id)\nset [status v] to (item (npc id) of [_npc data v])\n\ndefine Animate\nswitch costume to (large v)\ngo to x: ((((x) - (0.5)) * (_TILE SIZE)) - (_SCROLL X)) y: ((((y) - (0.5)) * (_TILE SIZE)) - (_SCROLL Y))\nswitch costume to (costume)\nshow\n\nwhen I receive [@mob spawn tick v]\nif <(id) = []> then\n    if <(length of [@mob spawns v]) > [0]> then\n        set [id v] to (item (1) of [@mob spawns v])\n        set [x v] to (item (2) of [@mob spawns v])\n        set [y v] to (item (3) of [@mob spawns v])\n        delete (1) of [@mob spawns v]\n        delete (1) of [@mob spawns v]\n        delete (1) of [@mob spawns v]\n        set rotation style [left-right v]\n        point in direction (90)\n        set [temp v] to [0]\n        set [yv v] to [0]\n        set [xv v] to [0]\n        Init Mob\n    end\nend\n\ndefine Check For Player Collision\nset [is stomped? v] to [0]\nif <([abs v] of ((x) - (__PLAYER X)) ) < (((width) + ([width v] of [player v])) - (_TINY))> then\n    if <([abs v] of ((((y) + (0.02)) + ((height) / (2))) - ((__PLAYER Y) + (([height v] of [player v]) / (2)))) ) < (((((height) / (2)) + (([height v] of [player v]) / (2))) + ((0.02) * <(__PLAYER Y) > ((y) + ((height) / (2)))>)) - (_TINY))> then\n        if <(_DEAD) = [0]> then\n            if <<<not <(__PLAYER YV) > [0]>> or <(yv) > [0]>> and <(__PLAYER Y) > (y)>> then\n                set [is stomped? v] to [1]\n            else\n                set [__state - enemy collision v] to [1]\n            end\n        end\n    end\nend\n\ndefine Basic Mob Tick\nchange [in air v] by (1)\nChange X by (speed x)\nif <(isSolid) > [0]> then\n    set [speed x v] to ((0) - (speed x))\nend\nif <(speed x) > [0]> then\n    point in direction (90)\nelse\n    if <(speed x) < [0]> then\n        point in direction (-90)\n    end\nend\nchange [yv v] by (-0.02)\nChange Y by (yv)\n\ndefine bounce player\nset [__player in air v] to [999999]\nset [__player y v] to (((y) + (height)) + (0.1))\nset [__player yv v] to [0.3]\n\ndefine Particle | Type: (type) X: (x) Y: (y)\nadd (type) to [@particle spawns v]\nadd (x) to [@particle spawns v]\nadd (y) to [@particle spawns v]\n\ndefine Particle Burst at X: (x) Y: (y) Size: (size) Type: (type)\nrepeat (size)\n    Particle | Type: (type) X: ((x) - (0.5)) Y: (y)\nend\n\ndefine Smart Mob Tick\nif <(speed x) > [0]> then\n    point in direction (90)\nelse\n    if <(speed x) < [0]> then\n        point in direction (-90)\n    end\nend\nchange [in air v] by (1)\nset [issolid v] to [0]\nGet IsSolid at X ((x) + ((width) * ((speed x) / ([abs v] of (speed x) )))) Y ((y) - (0.1))\nif <(isSolid) = [0]> then\n    set [speed x v] to ((0) - (speed x))\nelse\n    Change X by (speed x)\n    if <(isSolid) > [0]> then\n        set [speed x v] to ((0) - (speed x))\n    end\nend\nchange [yv v] by (-0.02)\nChange Y by (yv)\n\nwhen I receive [@stamp mid layer tick v]\nif <(id) > []> then\n    if <(id) = [14]> then\n        switch costume to (large v)\n        go to x: ((((x) - (0.5)) * (_TILE SIZE)) - (_SCROLL X)) y: (((((y) + (height)) - (0.5)) * (_TILE SIZE)) - (_SCROLL Y))\n        switch costume to (crushy pillar v)\n        stamp\n    end\nend\n\ndefine Talk\nif <(__GAME MODE) = [1]> then\n    set [__game mode v] to [2]\n    set [_active npc v] to (npc id)\n    set [status v] to (item (npc id) of [_npc data v])\n    set [dialogue # v] to [1]\nend\nif <not <(item (((([floor v] of (x) ) * (_MAP HEIGHT)) + ([floor v] of (y) )) + (1)) of [%data grid v]) = [0]>> then\n    set [speech v] to (item ((dialogue #) + (item # of (item (((([floor v] of (x) ) * (_MAP HEIGHT)) + ([floor v] of (y) )) + (1)) of [%data grid v]) in [npc dialogue v])) of [npc dialogue v])\nelse\n    set [speech v] to (item ((dialogue #) + (item # of (join [#NPC] (npc id)) in [npc dialogue v])) of [npc dialogue v])\nend\nif <<(speech) = []> or <(letter (1) of (speech)) = [#]>> then\n    set [dialogue # v] to [1]\n    add [] to [_text to write v]\n    replace item (npc id) of [_npc data v] with (status)\nelse\n    delete all of [_text to write v]\n    if <(letter (1) of (speech)) = [ ]> then\n        add [Player] to [_text to write v]\n        add (speech) to [_text to write v]\n    else\n        add (join [NPC] (npc id)) to [_text to write v]\n        add (join [ ] (speech)) to [_text to write v]\n    end\n    change [dialogue # v] by (1)\nend\n\n@Save/Load\n\ndefine Read Value\nset [invalid code v] to [0]\nset [decoded v] to []\nchange [scanner v] by (1)\nrepeat until <[delimiters v] contains (letter (scanner) of (level to load))?>\n    if <(letter (scanner) of (level to load)) = []> then\n        set [invalid code v] to [1]\n        stop [this script v]\n    else\n        set [decoded v] to (join (decoded) (letter (scanner) of (level to load)))\n        change [scanner v] by (1)\n    end\nend\nif <(decoded) = []> then\n    set [decoded v] to [1]\nend\nset [delimiter found v] to (letter (scanner) of (level to load))\n\ndefine Fill level with (tile type)\nif <(tile type) > []> then\n    delete all of [level v]\n    repeat ((_MAP HEIGHT) * (_MAP WIDTH))\n        add (tile type) to [level v]\n    end\nend\n\ndefine Load Tile Level | Code: (level save code)\nset [level to load v] to (level save code)\nFill level with [1]\nset [y v] to [0]\nrepeat (_MAP HEIGHT)\n    set [x v] to [0]\n    repeat until <not <(x) < (_MAP WIDTH)>>\n        Read Value\n        if <(invalid code) = [1]> then\n            stop [this script v]\n        end\n        repeat (item # of (delimiter found) in [delimiters v])\n            replace item ((((x) * (_MAP HEIGHT)) + (y)) + (1)) of [level v] with (decoded)\n            change [x v] by (1)\n        end\n    end\n    change [y v] by (1)\nend\n\ndefine Save Map\nShrink Level Width Intelligently\nShrink Level Height Intelligently\nWrite to save code (join (join (_MAP HEIGHT) [_]) (join (_MAP WIDTH) [_]))\nWrite to save code (join (_BACKDROP) [_])\nWrite to save code (join (_MUSIC) [_])\nset [idx v] to [0]\ndelete all of [level v]\nrepeat (length of [#tile grid v])\n    change [idx v] by (1)\n    add (item (idx) of [#tile grid v]) to [level v]\nend\nsave tile grid\nWrite to save code [|]\nset [idx v] to [0]\ndelete all of [level v]\nrepeat (length of [@mob grid v])\n    change [idx v] by (1)\n    add (item (idx) of [@mob grid v]) to [level v]\nend\nsave tile grid\nWrite to save code [|]\nset [idx v] to [0]\ndelete all of [level v]\nrepeat (length of [%data grid v])\n    change [idx v] by (1)\n    Encode Letters to Numbers (item (idx) of [%data grid v])\n    add (encoded) to [level v]\nend\nsave tile grid\nWrite to save code [|]\n\nwhen I receive [_load level v]\nset [game level code v] to (item (__GAME LEVEL) of [levels - game v])\nforever\n    if <(game level code) > []> then\n        set [scanner v] to [0]\n        set [level to load v] to (game level code)\n        Read Value\n        Decode Numbers to Letters (decoded)\n        set [___level name v] to (decoded)\n        Read Value\n        Decode Numbers to Letters (decoded)\n        set [___level creator v] to (decoded)\n        Read Value\n        set [_tile size v] to (decoded)\n        set [zoom v] to (_TILE SIZE)\n        change [scanner v] by (1)\n        Separate Sub Levels (game level code)\n        set [#level code v] to (decoded)\n        Separate Sub Levels (game level code)\n        set [#sub level 1 v] to (decoded)\n        Separate Sub Levels (game level code)\n        set [#sub level 2 v] to (decoded)\n        Separate Sub Levels (game level code)\n        set [#sub level 3 v] to (decoded)\n        Separate Sub Levels (game level code)\n        set [#sub level 4 v] to (decoded)\n        Separate Sub Levels (game level code)\n        set [#sub level 5 v] to (decoded)\n        Separate Sub Levels (game level code)\n        set [#sub level 6 v] to (decoded)\n        Separate Sub Levels (game level code)\n        set [#sub level 7 v] to (decoded)\n        Separate Sub Levels (game level code)\n        set [#sub level 8 v] to (decoded)\n        Separate Sub Levels (game level code)\n        set [#sub level 9 v] to (decoded)\n        Separate Sub Levels (game level code)\n        set [#sub level 10 v] to (decoded)\n        if <(__GAME SUB LEVEL) = [0]> then\n            if <(#LEVEL CODE) > []> then\n                Load Map (#LEVEL CODE)\n            else\n                set [invalid code v] to [1]\n            end\n        else\n            if <(__GAME SUB LEVEL) = [1]> then\n                if <(#SUB LEVEL 1) > []> then\n                    Load Map (#SUB LEVEL 1)\n                else\n                    set [invalid code v] to [1]\n                end\n            else\n                if <(__GAME SUB LEVEL) = [2]> then\n                    if <(#SUB LEVEL 2) > []> then\n                        Load Map (#SUB LEVEL 2)\n                    else\n                        set [invalid code v] to [1]\n                    end\n                else\n                    if <(__GAME SUB LEVEL) = [3]> then\n                        if <(#SUB LEVEL 3) > []> then\n                            Load Map (#SUB LEVEL 3)\n                        else\n                            set [invalid code v] to [1]\n                        end\n                    else\n                        if <(__GAME SUB LEVEL) = [4]> then\n                            if <(#SUB LEVEL 4) > []> then\n                                Load Map (#SUB LEVEL 4)\n                            else\n                                set [invalid code v] to [1]\n                            end\n                        else\n                            if <(__GAME SUB LEVEL) = [5]> then\n                                if <(#SUB LEVEL 5) > []> then\n                                    Load Map (#SUB LEVEL 5)\n                                else\n                                    set [invalid code v] to [1]\n                                end\n                            else\n                                if <(__GAME SUB LEVEL) = [6]> then\n                                    if <(#SUB LEVEL 6) > []> then\n                                        Load Map (#SUB LEVEL 6)\n                                    else\n                                        set [invalid code v] to [1]\n                                    end\n                                else\n                                    if <(__GAME SUB LEVEL) = [7]> then\n                                        if <(#SUB LEVEL 7) > []> then\n                                            Load Map (#SUB LEVEL 7)\n                                        else\n                                            set [invalid code v] to [1]\n                                        end\n                                    else\n                                        if <(__GAME SUB LEVEL) = [8]> then\n                                            if <(#SUB LEVEL 8) > []> then\n                                                Load Map (#SUB LEVEL 8)\n                                            else\n                                                set [invalid code v] to [1]\n                                            end\n                                        else\n                                            if <(__GAME SUB LEVEL) = [9]> then\n                                                if <(#SUB LEVEL 9) > []> then\n                                                    Load Map (#SUB LEVEL 9)\n                                                else\n                                                    set [invalid code v] to [1]\n                                                end\n                                            else\n                                                if <(__GAME SUB LEVEL) = [10]> then\n                                                    if <(#SUB LEVEL 10) > []> then\n                                                        Load Map (#SUB LEVEL 10)\n                                                    else\n                                                        set [invalid code v] to [1]\n                                                    end\n                                                end\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        if <(invalid code) = [0]> then\n            stop [this script v]\n        else\n            ask [Invalid level code.] and wait\n            set [game level code v] to (answer)\n            set [_loaded level code v] to (game level code)\n        end\n    else\n        stop [all v]\n    end\nend\n\nwhen I receive [_save level v]\nCreate Save Code\nreplace item (__GAME LEVEL) of [levels - game v] with (save code)\n\ndefine Write to save code (info)\nset [save code v] to (join (save code) (info))\n\ndefine Load Map (code)\ndelete all of [#tile grid v]\ndelete all of [@mob grid v]\ndelete all of [%data grid v]\nset [scanner v] to [0]\nset [decoded v] to []\nrepeat until <(letter (scanner) of (code)) = [|]>\n    set [decoded v] to (join (decoded) (letter (scanner) of (code)))\n    change [scanner v] by (1)\n    if <(scanner) > (length of (code))> then\n        set [invalid code v] to [1]\n        stop [this script v]\n    end\nend\nset [temp v] to (scanner)\nset [scanner v] to [0]\nset [level to load v] to (decoded)\nRead Value\nset [_map height v] to (decoded)\nRead Value\nset [_map width v] to (decoded)\nRead Value\nset [_backdrop v] to (decoded)\nRead Value\nset [_music v] to (decoded)\nset [_level music v] to (_MUSIC)\nLoad Tile Level | Code: (level to load)\nif <(invalid code) = [1]> then\n    stop [this script v]\nend\nset [idx v] to [0]\nrepeat (length of [level v])\n    change [idx v] by (1)\n    add (item (idx) of [level v]) to [#tile grid v]\nend\nset [decoded v] to []\nset [scanner v] to ((temp) + (1))\nrepeat until <(letter (scanner) of (code)) = [|]>\n    set [decoded v] to (join (decoded) (letter (scanner) of (code)))\n    change [scanner v] by (1)\n    if <(scanner) > (length of (code))> then\n        set [invalid code v] to [1]\n        stop [this script v]\n    end\nend\nset [temp v] to (scanner)\nset [scanner v] to [0]\nset [level to load v] to (decoded)\nLoad Tile Level | Code: (level to load)\nif <(invalid code) = [1]> then\n    stop [this script v]\nend\nset [idx v] to [0]\nrepeat (length of [level v])\n    change [idx v] by (1)\n    add (item (idx) of [level v]) to [@mob grid v]\nend\nset [decoded v] to []\nset [scanner v] to ((temp) + (1))\nrepeat until <(letter (scanner) of (code)) = [|]>\n    set [decoded v] to (join (decoded) (letter (scanner) of (code)))\n    change [scanner v] by (1)\n    if <(scanner) > (length of (code))> then\n        stop [this script v]\n    end\nend\nset [temp v] to (scanner)\nset [scanner v] to [0]\nset [level to load v] to (decoded)\nLoad Tile Level | Code: (level to load)\nif <(invalid code) = [1]> then\n    stop [this script v]\nend\nset [idx v] to [0]\nrepeat (length of [level v])\n    change [idx v] by (1)\n    Decode Numbers to Letters (item (idx) of [level v])\n    add (decoded) to [%data grid v]\nend\n\ndefine save tile grid\nset [repeatcount v] to [1]\nset [y v] to [0]\nrepeat (_MAP HEIGHT)\n    set [x v] to [0]\n    set [lastdiscovery v] to (item ((((x) * (_MAP HEIGHT)) + (y)) + (1)) of [level v])\n    repeat (_MAP WIDTH)\n        change [x v] by (1)\n        set [idx v] to ((((x) * (_MAP HEIGHT)) + (y)) + (1))\n        if <<(item (idx) of [level v]) = (lastDiscovery)> and <(repeatCount) < (length of [delimiters v])>> then\n            change [repeatcount v] by (1)\n        else\n            if <(item ((idx) - (_MAP HEIGHT)) of [level v]) = [1]> then\n                Write to save code (item (repeatCount) of [delimiters v])\n                set [repeatcount v] to [1]\n            else\n                Write to save code (join (item ((idx) - (_MAP HEIGHT)) of [level v]) (item (repeatCount) of [delimiters v]))\n                set [repeatcount v] to [1]\n            end\n        end\n        set [lastdiscovery v] to (item (idx) of [level v])\n    end\n    change [y v] by (1)\nend\n\ndefine Create New Level\nset [_map height v] to [40]\nset [_map width v] to [80]\nset [__player x v] to [5.5]\nset [__player y v] to [4]\nset [_tile size v] to [32]\nset [___level name v] to [UNTITLED WORLD]\nset [___level creator v] to (username)\nset [__game level v] to ((length of [levels - game v]) + (1))\nset [__game sub level v] to [0]\ndelete all of [@mob spawns v]\ndelete all of [#tile grid v]\ndelete all of [@mob grid v]\ndelete all of [%data grid v]\nrepeat ((_MAP HEIGHT) * (_MAP WIDTH))\n    add [1] to [#tile grid v]\n    add [0] to [@mob grid v]\n    add [0] to [%data grid v]\nend\nset [_music v] to [1]\nset [_backdrop v] to [1]\nset [save code v] to []\nSave Map\nSave Map\nEncode Letters to Numbers (___LEVEL NAME)\nEncode Letters to Numbers (___LEVEL CREATOR)\nadd (join (join (join (join (encoded level name) [_]) (join (encoded level creator) [_])) (join (_TILE SIZE) [_])) (save code)) to [levels - game v]\nstop all sounds\n\nwhen flag clicked\nhide\n\ndefine Shorten Level Height by (#) blocks\nset [scanner v] to [1]\nrepeat (_MAP WIDTH)\n    change [scanner v] by ((_MAP HEIGHT) - (#))\n    repeat (#)\n        delete (scanner) of [#tile grid v]\n        delete (scanner) of [@mob grid v]\n        delete (scanner) of [%data grid v]\n    end\nend\nset [_map height v] to ((_MAP HEIGHT) - (#))\n\ndefine Grow Level Height by (#) blocks\nset [scanner v] to [1]\nrepeat (_MAP WIDTH)\n    change [scanner v] by (_MAP HEIGHT)\n    repeat (#)\n        insert [1] at (scanner) of [#tile grid v] \n        insert [0] at (scanner) of [@mob grid v] \n        insert [0] at (scanner) of [%data grid v] \n        change [scanner v] by (1)\n    end\nend\nset [_map height v] to ((_MAP HEIGHT) + (#))\n\ndefine Separate Sub Levels (code)\nset [decoded v] to []\nrepeat (3)\n    repeat until <<(letter (scanner) of (code)) = [|]> or <(scanner) > (length of (code))>>\n        set [decoded v] to (join (decoded) (letter (scanner) of (code)))\n        change [scanner v] by (1)\n    end\n    set [decoded v] to (join (decoded) (letter (scanner) of (code)))\n    change [scanner v] by (1)\nend\n\ndefine Shorten Level Width by (#) blocks\nrepeat ((#) * (_MAP HEIGHT))\n    delete (length of [#tile grid v]) of [#tile grid v]\n    delete (length of [@mob grid v]) of [@mob grid v]\n    delete (length of [%data grid v]) of [%data grid v]\nend\nset [_map width v] to ((_MAP WIDTH) - (#))\n\ndefine Grow Level Width by (#) blocks\nrepeat ((#) * (_MAP HEIGHT))\n    add [1] to [#tile grid v]\n    add [0] to [@mob grid v]\n    add [0] to [%data grid v]\nend\nset [_map width v] to ((_MAP WIDTH) + (#))\n\ndefine Shrink Level Width Intelligently\nrepeat ((_MAP WIDTH) - (18))\n    set [idx v] to (length of [#tile grid v])\n    repeat (_MAP HEIGHT)\n        if <<(item (idx) of [#tile grid v]) > [1]> or <<(item (idx) of [@mob grid v]) > [0]> or <(item (idx) of [%data grid v]) > [0]>>> then\n            stop [this script v]\n        end\n        change [idx v] by (-1)\n    end\n    Shorten Level Width by [1] blocks\nend\n\ndefine Shrink Level Height Intelligently\nrepeat ((_MAP HEIGHT) - (13))\n    set [idx v] to [0]\n    repeat (_MAP WIDTH)\n        change [idx v] by (_MAP HEIGHT)\n        if <<(item (idx) of [#tile grid v]) > [1]> or <<(item (idx) of [@mob grid v]) > [0]> or <(item (idx) of [%data grid v]) > [0]>>> then\n            stop [this script v]\n        end\n    end\n    Shorten Level Height by [1] blocks\nend\n\ndefine Encode Letters to Numbers (encode)\nset [encoded v] to []\nset [temp v] to (scanner)\nset [scanner v] to [1]\nrepeat (length of (encode))\n    set [encoded v] to (join (encoded) (item # of (letter (scanner) of (encode)) in [letters v]))\n    change [scanner v] by (1)\nend\nset [scanner v] to (temp)\n\ndefine Decode Numbers to Letters (decode)\nset [decoded v] to []\nset [temp v] to (scanner)\nset [scanner v] to [1]\nrepeat (length of (decode))\n    set [decoded v] to (join (decoded) (item (join (letter (scanner) of (decode)) (letter ((scanner) + (1)) of (decode))) of [letters v]))\n    change [scanner v] by (2)\nend\nset [scanner v] to (temp)\n\ndefine Create Save Code\nset [___level creator v] to (username)\nset [save code v] to []\nset [level to load v] to (item (__GAME LEVEL) of [levels - game v])\nSave Map\nset [scanner v] to [0]\nRead Value\nRead Value\nRead Value\nchange [scanner v] by (1)\nSeparate Sub Levels (level to load)\nset [#level code v] to (decoded)\nSeparate Sub Levels (level to load)\nset [#sub level 1 v] to (decoded)\nSeparate Sub Levels (level to load)\nset [#sub level 2 v] to (decoded)\nSeparate Sub Levels (level to load)\nset [#sub level 3 v] to (decoded)\nSeparate Sub Levels (level to load)\nset [#sub level 4 v] to (decoded)\nSeparate Sub Levels (level to load)\nset [#sub level 5 v] to (decoded)\nSeparate Sub Levels (level to load)\nset [#sub level 6 v] to (decoded)\nSeparate Sub Levels (level to load)\nset [#sub level 7 v] to (decoded)\nSeparate Sub Levels (level to load)\nset [#sub level 8 v] to (decoded)\nSeparate Sub Levels (level to load)\nset [#sub level 9 v] to (decoded)\nSeparate Sub Levels (level to load)\nset [#sub level 10 v] to (decoded)\nif <(__GAME SUB LEVEL) = [0]> then\n    set [#level code v] to (save code)\nelse\n    if <(__GAME SUB LEVEL) = [1]> then\n        set [#sub level 1 v] to (save code)\n    else\n        if <(__GAME SUB LEVEL) = [2]> then\n            set [#sub level 2 v] to (save code)\n        else\n            if <(__GAME SUB LEVEL) = [3]> then\n                set [#sub level 3 v] to (save code)\n            else\n                if <(__GAME SUB LEVEL) = [4]> then\n                    set [#sub level 4 v] to (save code)\n                else\n                    if <(__GAME SUB LEVEL) = [5]> then\n                        set [#sub level 5 v] to (save code)\n                    else\n                        if <(__GAME SUB LEVEL) = [6]> then\n                            set [#sub level 6 v] to (save code)\n                        else\n                            if <(__GAME SUB LEVEL) = [7]> then\n                                set [#sub level 7 v] to (save code)\n                            else\n                                if <(__GAME SUB LEVEL) = [8]> then\n                                    set [#sub level 8 v] to (save code)\n                                else\n                                    if <(__GAME SUB LEVEL) = [9]> then\n                                        set [#sub level 9 v] to (save code)\n                                    else\n                                        if <(__GAME SUB LEVEL) = [10]> then\n                                            set [#sub level 10 v] to (save code)\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nEncode Letters to Numbers (___LEVEL NAME)\nset [encoded level name v] to (encoded)\nEncode Letters to Numbers (___LEVEL CREATOR)\nset [encoded level creator v] to (encoded)\nset [save code v] to (join (join (encoded level name) (join (join [_] (join (encoded level creator) [_])) (join (_TILE SIZE) [_]))) (join (join (join (#LEVEL CODE) (#SUB LEVEL 1)) (#SUB LEVEL 2)) (join (join (join (#SUB LEVEL 3) (#SUB LEVEL 4)) (#SUB LEVEL 5)) (join (join (join (#SUB LEVEL 6) (#SUB LEVEL 7)) (#SUB LEVEL 8)) (join (#SUB LEVEL 9) (#SUB LEVEL 10))))))\n\nwhen I receive [__generate save code v]\nCreate Save Code\ndelete all of [here is your save code! v]\nadd [Select the entire code below by triple clicking it.] to [here is your save code! v]\nadd [] to [here is your save code! v]\nadd (save code) to [here is your save code! v]\nadd [] to [here is your save code! v]\nadd [Right click and select 'copy'.] to [here is your save code! v]\nadd [Paste it in the discussion forum in the Notes and Credits to share your level.] to [here is your save code! v]\nadd [Or into a text document to keep it safe.] to [here is your save code! v]\nadd [!!DO NOT PASTE CODES IN COMMENTS!!] to [here is your save code! v]\nadd [Click or press any key to close this popup.] to [here is your save code! v]\nhide list [here is your save code! v]\nwait until <not <<key (any v) pressed?> or <mouse down?>>>\nwait until <<key (any v) pressed?> or <mouse down?>>\nshow list [here is your save code! v]\n\nCreate New Level\n\nCreate New Level\n\nCreate New Level\n\n@Particles\n\ndefine Create Clones\nset [mob# v] to [1]\nrepeat (50)\n    create clone of (_myself_ v)\n    change [mob# v] by (1)\nend\n\nwhen I receive [_create clones v]\nset [id v] to []\nCreate Clones\n\ndefine Get IsSolid at X (x) Y (y)\nif <(isSolid) = [0]> then\n    set [idx v] to (((([floor v] of (x) ) * (_MAP HEIGHT)) + ([floor v] of (y) )) + (1))\n    if <(item (item (idx) of [#tile grid v]) of [#tile shape v]) = [#]> then\n        set [issolid v] to [1]\n    end\nend\n\nwhen I receive [@animate v]\nif <(id) > []> then\n    if <(id) = [1]> then\n        // [snowflake]\n        change [x v] by (xv)\n        change [y v] by (yv)\n        set [xv v] to ((xv) * (0.95))\n        change [yv v] by (-0.01)\n        change [life v] by (5)\n        set [ghost v] effect to (life)\n    else\n        if <(id) = [2]> then\n            // [gift]\n            change [y v] by (0.1)\n            change [life v] by (5)\n            set [ghost v] effect to (life)\n        else\n            if <(id) = [3]> then\n                // [checkpoint]\n                change [y v] by (0.1)\n                change [life v] by (5)\n                set [ghost v] effect to (life)\n            else\n                if <(id) = [4]> then\n                    // [slime]\n                    change [x v] by (xv)\n                    change [y v] by (yv)\n                    set [xv v] to ((xv) * (0.95))\n                    change [yv v] by (-0.01)\n                    change [life v] by (5)\n                    set [ghost v] effect to (life)\n                else\n                    if <(id) = [5]> then\n                        // [water drop]\n                        change [x v] by (xv)\n                        change [y v] by (yv)\n                        set [xv v] to ((xv) * (0.95))\n                        change [yv v] by (-0.01)\n                        change [life v] by (5)\n                        set [ghost v] effect to (life)\n                    else\n                        if <(id) = [6]> then\n                            // [gingerbread]\n                            change [x v] by (xv)\n                            change [y v] by (yv)\n                            set [xv v] to ((xv) * (0.95))\n                            change [yv v] by (-0.01)\n                            change [life v] by (5)\n                            set [ghost v] effect to (life)\n                        end\n                    end\n                end\n            end\n        end\n    end\n    if <(life) > [99]> then\n        set [id v] to []\n    end\n    Animate\nelse\n    hide\nend\n\ndefine // (comment)\n\nwhen I receive [@particle spawn tick v]\nif <(id) > []> then\n\ndefine Init Particle\nset size to (((_TILE SIZE) / (8)) * (100)) %\ngo to [front v] layer\npoint in direction (90)\nset rotation style [all around v]\nif <(id) = [1]> then\n    set [costume v] to (pick random (1) to (3))\n    set [xv v] to (pick random (-0.2) to (0.2))\n    set [yv v] to (pick random (0.04) to (0.2))\n    set [life v] to [0]\nelse\n    if <(id) = [2]> then\n        set [costume v] to [4]\n        set [life v] to [0]\n    else\n        if <(id) = [3]> then\n            set [costume v] to [5]\n            set [life v] to [0]\n        else\n            if <(id) = [4]> then\n                set [costume v] to [6]\n                set [xv v] to (pick random (-0.2) to (0.2))\n                set [yv v] to (pick random (0.04) to (0.2))\n                set [life v] to [0]\n            else\n                if <(id) = [5]> then\n                    set [costume v] to [7]\n                    set [xv v] to (pick random (-0.2) to (0.2))\n                    set [yv v] to (pick random (0.04) to (0.2))\n                    set [life v] to [0]\n                else\n                    if <(id) = [6]> then\n                        set [costume v] to [8]\n                        set [xv v] to (pick random (-0.25) to (0.25))\n                        set [yv v] to (pick random (0.04) to (0.2))\n                        set [life v] to [0]\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Animate\nswitch costume to (large v)\ngo to x: (((x) * (_TILE SIZE)) - (_SCROLL X)) y: (((y) * (_TILE SIZE)) - (_SCROLL Y))\nswitch costume to (costume)\nshow\n\nwhen I receive [_delete objects v]\nset [id v] to []\n\n@Text Engine\n\ndefine Write Text (text) At X: (x) Y: (y) | Width: (width) Size: (size) Colour: (clr) Brightness: (bright)\nset [text i v] to [1]\nset [id v] to (item (1) of [_text to write v])\nswitch costume to (id)\nif <(costume [name v]) = (id)> then\n    set [x v] to (x)\n    set [y v] to ((y) - (22))\n    Position\n    set size to (400) %\n    create clone of (_myself_ v)\n    set [x v] to ((x) + (30))\n    set [y v] to ((y) - (18))\nelse\n    set [x v] to (x)\n    set [y v] to (y)\nend\nset size to (size) %\nset [color v] effect to (clr)\nset [brightness v] effect to (bright)\nforever\n    Position\n    set [new i v] to (text i)\n    repeat until <<(letter (new i) of (text)) = [ ]> or <(new i) > (length of (text))>>\n        set [id v] to (letter (new i) of (text))\n        switch costume to (id)\n        change x by (((item (costume [number v]) of [letter width v]) - (1)) * ((size) / (100)))\n        change [new i v] by (1)\n    end\n    if <(x position) > ((x) + (width))> then\n        set [x v] to (x)\n        change [y v] by ((-22) * ((size) / (100)))\n    end\n    repeat until <(letter (text i) of (text)) = [ ]>\n        Position\n        set [id v] to (letter (text i) of (text))\n        if <<(x position) > ((x) + ((width) + (30)))> or <(id) = [|]>> then\n            set [x v] to (x)\n            change [y v] by ((-22) * ((size) / (100)))\n        end\n        if <not <(id) = [|]>> then\n            create clone of (_myself_ v)\n            switch costume to (id)\n            change [x v] by (((item (costume [number v]) of [letter width v]) - (1)) * ((size) / (100)))\n        end\n        change [text i v] by (1)\n        if <(text i) > (length of (text))> then\n            set [id v] to []\n            stop [this script v]\n        end\n    end\n    change [x v] by (((item (length of [letter width v]) of [letter width v]) - (1)) * ((size) / (100)))\n    change [text i v] by (1)\n    if <(text i) > (length of (text))> then\n        set [id v] to []\n        stop [this script v]\n    end\nend\n\nwhen I start as a clone\nswitch costume to (id)\ngo to [front v] layer\nset [ghost v] effect to (100)\nshow\nPosition\nchange y by (-50)\n\nwhen I receive [delete text clones v]\ndelete this clone\n\ndefine Position\ngo to x: (x) y: (y)\n\nwhen I receive [@animate v]\nif <(id) > []> then\n    if <(text i) > [0]> then\n        change [text i v] by (-3)\n    else\n        change [ghost v] effect by (-10)\n        change y by (((y) - (y position)) / (8))\n    end\nelse\n    if <(frame) > [0]> then\n        if <(__IS MOBILE?) > [0]> then\n            switch costume to (frame mobile v)\n        else\n            switch costume to (frame v)\n        end\n        set [brightness v] effect to (0)\n        set [color v] effect to (0)\n        set x to (0)\n        change [ghost v] by (((20) - (ghost)) / (8))\n        set [ghost v] effect to (ghost)\n        change y by (((0) - (y position)) / (8))\n        show\n        if <(__GAME MODE) = [2]> then\n    else\n        if <(ghost) < [99]> then\n            change [ghost v] by (((100) - (ghost)) / (4))\n            change y by (((-50) - (y position)) / (4))\n            set [ghost v] effect to (ghost)\n            show\n        else\n            hide\n        end\n    end\nend\n\nwhen flag clicked\nset [id v] to []\nset [text i v] to [0]\nset [ghost v] to [100]\nhide\n\nwhen I receive [_init v]\nhide\n\nwhen I receive [@text tick v]\nif <(id) > []> then\n\n@Z\n\nwhen I receive [@animate v]\nif <(_TARGETED NPC X) > []> then\n    switch costume to (big v)\n    go to x: ((((_TARGETED NPC X) - (0.5)) * (_TILE SIZE)) - (_SCROLL X)) y: (((((_TARGETED NPC Y) + (1.4)) + (([sin v] of ((timer) * (100)) ) * (0.15))) * (_TILE SIZE)) - (_SCROLL Y))\n    if <(__IS MOBILE?) > [0]> then\n        switch costume to (([floor v] of (((timer) * (2)) mod (2)) ) + (3))\n    else\n        switch costume to (([floor v] of (((timer) * (2)) mod (2)) ) + (1))\n    end\n    show\nelse\n    hide\nend\n\nwhen I receive [_size v]\nset size to ([ceiling v] of (((_TILE SIZE) / (8)) * (100)) ) %\n\n@Snow Particles\n\nwhen I receive [@snow tick v]\nSnow Tick\n\nwhen flag clicked\nset size to (400) %\ngo to [front v] layer\nshow\nset [y v] to [0]\nset [x v] to [0]\ncreate clone of (_myself_ v)\nset [y v] to [360]\nset [x v] to [0]\ncreate clone of (_myself_ v)\nset [y v] to [0]\nset [x v] to [480]\ncreate clone of (_myself_ v)\nset [y v] to [360]\nset [x v] to [480]\n\ndefine Snow Tick\nchange [y v] by (-2)\nrepeat until <((y) - (_SCROLL Y)) > [-360]>\n    change [y v] by (720)\nend\nrepeat until <((y) - (_SCROLL Y)) < [360]>\n    change [y v] by (-720)\nend\nchange [x v] by (-1)\nrepeat until <((x) - (_SCROLL X)) > [-480]>\n    change [x v] by (960)\nend\nrepeat until <((x) - (_SCROLL X)) < [480]>\n    change [x v] by (-960)\nend\nswitch costume to (big v)\ngo to x: (round ((x) - (_SCROLL X))) y: (round ((y) - (_SCROLL Y)))\nswitch costume to (snow v)\n\n@Transition\n\nwhen I receive [_start transition v]\nshow\ngo to [front v] layer\ngo to x: (-480) y: (0)\nrepeat until <(round (x position)) = [0]>\n    change x by (((0) - (x position)) / (4))\nend\n\nwhen I receive [_complete transition v]\nshow\ngo to [front v] layer\ngo to x: (0) y: (0)\nrepeat until <(round (x position)) > [470]>\n    change x by (((480) - (x position)) / (6))\nend\nhide\n\n@Score Display\n\nwhen I receive [@animate v]\nset [costume v] to (letter (id) of (SCORE))\nif <(costume) > []> then\n    go to x: ((((length of (SCORE)) / (2)) * (-12)) + ((id) * (12))) y: (160)\n    if <not <(costume [name v]) = (costume)>> then\n        switch costume to (costume)\n        set size to (140) %\n    else\n        change size by (((101) - (size)) / (5))\n    end\n    show\nelse\n    hide\nend\n\nwhen flag clicked\nset size to (101) %\nCreate Score Clones\n\ndefine Create Score Clones\nset [id v] to [1]\nrepeat (7)\n    create clone of (_myself_ v)\n    change [id v] by (1)\nend\n\n@Joystick\n\nwhen I receive [@joystick tick v]\nif <key (any v) pressed?> then\n    set [__is mobile? v] to [0]\nend\nif <(__IS MOBILE?) > [0]> then\n    if <(id) > []> then\n        show\n        switch costume to (stick v)\n        if <mouse down?> then\n            if <(mouse down?) = [0]> then\n                if <not <(distance to [mouse-pointer v]) > (max power)>> then\n                    set [joystick active? v] to [1]\n                end\n            end\n            set [mouse down? v] to [1]\n        else\n            go to (join [Joystick] [])\n            set [__joystick x v] to [0]\n            set [__joystick y v] to [0]\n            set [mouse down? v] to [0]\n            set [joystick active? v] to [0]\n        end\n        if <(joystick active?) = [1]> then\n            point towards (mouse-pointer v)\n            move (distance to [mouse-pointer v]) steps\n            if <(distance to [(join [Joystick] []) v]) > (max power)> then\n                move ((0) - ((distance to [(join [Joystick] []) v]) - (max power))) steps\n            end\n            set [__joystick x v] to (round ((x position) - ([x position v] of (join [Joystick] []))))\n            set [__joystick y v] to (round ((y position) - ([y position v] of (join [Joystick] []))))\n        end\n    else\n        switch costume to (base v)\n        go to x: (170) y: (-115)\n        show\n    end\nelse\n    set [__joystick x v] to [0]\n    set [__joystick y v] to [0]\n    hide\nend\n\nwhen flag clicked\nset rotation style [don't rotate v]\nset size to (100) %\nhide\nset [id v] to []\nset [joystick active? v] to [0]\nset [max power v] to ((size) / (3))\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nset [id v] to [1]\n\n