platformer
@Stage\n\nwhen I receive [position tiles v]\n\nif <(backdrop [number v]) = (BACKGROUND)> then\n    stop [this script v]\nend\n\nwhen [n v] key pressed\nset [mouse v] to (join (round ((mouse x) + (CAMERA X))) (join [ ] ((mouse y) + (CAMERA Y))))\n\n@Player\n\nwhen flag clicked\nset [editor v] to [0]\nhide\nset [geo v] to []\ndelete all of [inventory v]\nset [particle intensity v] to [Full]\nset [sound volume v] to [5]\nset [music volume v] to [5]\nset [player action v] to [idle]\nset [menu screen v] to [main]\nbroadcast (Main Menu v)\nrepeat until <(MENU SCREEN) = []>\n    broadcast (tick menu v)\nend\n\ndefine move camera\nchange [camera x v] by (round (((x) - (CAMERA X)) / (4)))\nif <<([down v] of [controls v]) > [15]> and <(falling) = [0]>> then\n    change [camera y v] by (round ((((y) - (64)) - (CAMERA Y)) / (15)))\nelse\n    if <<([up v] of [controls v]) > [15]> and <(falling) = [0]>> then\n        change [camera y v] by (round ((((y) + (64)) - (CAMERA Y)) / (15)))\n    else\n        change [camera y v] by (round (((y) - (CAMERA Y)) / (4)))\n    end\nend\nif <(SCREEN SHAKE) > [0]> then\n    set [camera x v] to (x)\n    set [camera y v] to (y)\n    change [camera x v] by (pick random (round ((SCREEN SHAKE) / (2))) to ((0) - (round ((SCREEN SHAKE) / (2)))))\n    change [camera y v] by (pick random (round ((SCREEN SHAKE) / (2))) to ((0) - (round ((SCREEN SHAKE) / (2)))))\n    change [screen shake v] by (-1)\nend\nlimit camera edge x: [240] edge y: [180]\n\ndefine reset player\ngo to [front v] layer\ngo [backward v] ((LAYERS - UI) + (3)) layers\nset rotation style [left-right v]\nset [tiny - v] to [-0.000001]\nset [speed x v] to [0]\nset [speed y v] to [0]\nset [height v] to [5]\nset [width v] to [5]\nset [camera x v] to (x)\nset [camera y v] to (y)\nset [falling v] to [-4]\nset [jumping v] to [99]\nset [invulnerable v] to [0]\nset [map v] to [0]\nset [arena progress v] to [0]\nset [screen shake v] to [0]\nset size to (140) %\nif <(x) < [550]> then\n    point in direction (90)\nelse\n    point in direction (-90)\nend\nset [ghost v] effect to (0)\nmove camera\n\ndefine game loop\nforever\n    broadcast (check controls v)\n    broadcast (swing nail v)\n    broadcast (move player v)\n    broadcast (move enemy v)\n    broadcast (move player after enemy v)\n    broadcast (animate npcs v)\n    broadcast (position tiles v)\n    broadcast (position enemy v)\nend\n\nwhen I receive [move player v]\nset [bump index v] to []\nif <([pause v] of [controls v]) = [1]> then\n    broadcast (game - pause v)\nend\nif <(EDITOR) > [0]> then\n    handle - God mode\nelse\n    if <(player action) = [sit]> then\n        change [player frame v] by (1)\n        if <(player frame) > [20]> then\n            if <<([down v] of [controls v]) = [1]> or <([abs v] of ([x axis v] of [controls v]) ) = [1]>> then\n                set [player action v] to [idle]\n                set [player frame v] to [0]\n            end\n        end\n    else\n        handle keys - left right\n        handle keys - jump/crouch\n        move sprite x\n        move sprite y\n        check around player\n    end\nend\nmove camera\npaint sprite\nif <(GEO) > [9999]> then\n    set [geo v] to [9999]\nend\n\ndefine get tile at x: (x) y: (y)\nset [tile grid x v] to ([floor v] of ((x) / (32)) )\nset [tile grid y v] to ([floor v] of ((y) / (32)) )\nset [tile index v] to (((1) + (tile grid y)) + ((tile grid x) * (GRID HEIGHT)))\nif <(tile grid y) < [0]> then\n    set [tile v] to []\nelse\n    set [tile v] to (item (tile index) of [tile grid v])\nend\nset [tile shape v] to (item (tile) of [tile shape v])\n\ndefine fix collision in direction dx: (dx) dy: (dy)\nset [fix dx v] to (dx)\nset [fix dy v] to (dy)\nset [solid v] to []\nrepeat (2)\n    fix collision at point x: ((x) - (width)) y: ((y) - (height)) part: [feet]\n    fix collision at point x: ((x) - (width)) y: (y) part: []\n    fix collision at point x: ((x) + ((width) + (TINY -))) y: ((y) - (height)) part: [feet]\n    fix collision at point x: ((x) + ((width) + (TINY -))) y: (y) part: []\n    fix collision at point x: ((x) - (width)) y: ((y) + (height)) part: []\n    fix collision at point x: ((x) + ((width) + (TINY -))) y: ((y) + (height)) part: []\n    if <(solid) < [1]> then\n        stop [this script v]\n    end\nend\n\ndefine fix collision at point x: (x) y: (y) part: (part)\nget tile at x: (x) y: (y)\nif <(tile shape) = []> then\n    stop [this script v]\nend\nset [mod x v] to ((x) mod (32))\nset [mod y v] to ((y) mod (32))\nset [temp v] to (letter (1) of (tile shape))\nif <(tile shape) = [=]> then\n    if <<not <(part) = [feet]>> or <((mod y) - (fix dy)) < [32]>> then\n        stop [this script v]\n    end\nend\nset [solid v] to [10]\nif <(fix dy) < [0]> then\n    change [y v] by ((32) - (mod y))\nend\nif <(fix dx) < [0]> then\n    change [x v] by ((32) - (mod x))\n    if <(special action) = [start]> then\n        set [special action v] to []\n    end\nend\nif <(fix dy) > [0]> then\n    change [y v] by ((TINY -) - (mod y))\nend\nif <(fix dx) > [0]> then\n    change [x v] by ((TINY -) - (mod x))\n    if <(special action) = [start]> then\n        set [special action v] to []\n    end\nend\n\ndefine handle keys - left right\nif <([focus v] of [controls v]) > [0]> then\n    set [speed x v] to [0]\n    set [speed y v] to [0]\n    set [player action v] to [heal]\n    stop [this script v]\nend\nset [key walk v] to ([x axis v] of [controls v])\nif <<(solid) > []> and <<<(player action) = [crouch]> or <(player action) = [look up]>> or <(player action) = [heal]>>> then\n    set [key walk v] to [0]\nend\nif <(KEY WALK) = [0]> then\n    set [player action v] to [idle]\n    Decrease Speed x\nelse\n    if <([abs v] of (speed x) ) < [0.2]> then\n        if <(MAP) < [1]> then\n            set [special action v] to [start]\n            set [special action frame v] to [3]\n        end\n    end\n    if <not <(direction) = ((90) * (KEY WALK))>> then\n        set [special action v] to [turn]\n        set [special action frame v] to [1]\n    end\n    point in direction ((90) * (KEY WALK))\n    set [player action v] to [walk]\n    if <(MAP) > [0]> then\n        set [speed x v] to ((KEY WALK) * (3))\n    else\n        set [speed x v] to ((KEY WALK) * (5))\n    end\nend\nset [temp v] to (([abs v] of (speed x) ) / (10))\nif <(temp) < [0.2]> then\n    set [temp v] to [0.2]\nend\nchange [player frame v] by (temp)\n\ndefine handle keys - jump/crouch\nchange [speed y v] by (-2)\nif <(speed y) < [-16]> then\n    set [speed y v] to [-16]\nend\nif <([focus v] of [controls v]) < [1]> then\n    if <([y axis v] of [controls v]) < [0]> then\n        set [player action v] to [crouch]\n    else\n        if <(player action) = [crouch]> then\n            handle - get up\n        end\n    end\n    if <([y axis v] of [controls v]) > [0]> then\n        set [player action v] to [look up]\n    else\n        if <(player action) = [look up]> then\n            handle - get up\n        end\n    end\nend\nif <([jump v] of [controls v]) > [0]> then\n    if <<(falling) < [2]> or <(jumping) > [0]>> then\n        change [jumping v] by (1)\n        if <(jumping) < [8]> then\n            set [speed y v] to [11]\n            if <(jumping) = [1]> then\n                start sound [hero_jump v]\n                set [jumping v] to [3]\n            end\n        end\n    end\nelse\n    set [jumping v] to [0]\nend\n\ndefine move sprite x\nset [orig y v] to (y)\nchange [x v] by (speed x)\nfix collision in direction dx: [0] dy: [-1]\nif <(y) > ((orig y) + (([abs v] of (speed x) ) + (4)))> then\n    set [y v] to (orig y)\n    fix collision in direction dx: (speed x) dy: [0]\n    if <(solid) > [0]> then\n        set [speed x v] to [0]\n    end\nelse\n    if <(y) > (orig y)> then\n        set [speed x v] to ((speed x) * (0.9))\n    end\nend\nif <<(falling) < [2]> and <([abs v] of (speed x) ) > [0]>> then\n    if <(([floor v] of ((player frame) * (2)) ) mod (8)) = [0]> then\n        start sound (join [footsteps] (pick random (1) to (6)))\n    end\nend\n\ndefine move sprite y\nchange [falling v] by (1)\nchange [y v] by (speed y)\nfix collision in direction dx: [0] dy: (speed y)\nif <(solid) > [0]> then\n    if <(speed y) < [0]> then\n        if <(falling) > [1]> then\n            if <(falling) > [30]> then\n                start sound [hero_land_hard v]\n                set [special action v] to [land hard]\n                set [special action frame v] to [4]\n                set [screen shake v] to [10]\n                set [speed x v] to [0]\n                if <<(SPAWN Y) = [1550]> and <(SPAWN LEVEL) = [1]>> then\n                    start sound [Boss Defeat2 v]\n                    set [spawn y v] to (HAZARD RESPAWN Y)\n                    set [screen shake v] to [25]\n                    set [text v] to [KING'S PASS]\n                    broadcast (New title v)\n                end\n            else\n                start sound [hero_land_soft v]\n                set [special action v] to [land]\n                set [special action frame v] to [3]\n            end\n        end\n        set [falling v] to [0]\n    else\n        set [jumping v] to [99]\n    end\n    set [speed y v] to [0]\nend\nif <<(falling) > [3]> and <(speed y) < [1]>> then\n    if <((falling) mod (4)) = [0]> then\n        start sound (join [falling] ((([floor v] of ((falling) / (4)) ) mod (6)) + (1)))\n    end\nend\n\ndefine paint sprite\nswitch costume to (big v)\ngo to x: ((x) - (CAMERA X)) y: ((y) - (CAMERA Y))\ngo to [front v] layer\ngo [backward v] ((LAYERS - UI) + (2)) layers\nif <([sword v] of [controls v]) = [1]> then\n    if <([nail stage v] of [nail v]) = [1]> then\n        if <(player action) = [look up]> then\n            set [special action v] to [sword2]\n            set [special action frame v] to [4]\n        else\n            if <(player action) = [crouch]> then\n                if <(falling) > [0]> then\n                    set [special action v] to [sword3]\n                    set [special action frame v] to [2]\n                end\n            else\n                set [special action v] to [sword1]\n                set [special action frame v] to [3]\n            end\n        end\n    end\nend\nif <(HEALTH) < [2]> then\n    if <([floor v] of (((timer) * (30)) mod (5)) ) = [0]> then\n        add [low health puff] to [particles v]\n        add ((x) + (pick random (-10) to (10))) to [particles v]\n        add ((y) + (pick random (-10) to (10))) to [particles v]\n    end\nend\nif <(player action) = [lose life]> then\n    stop [this script v]\nend\nif <(player action) = [hurt]> then\n    switch costume to (knighthurt v)\n    switch costume to ((costume [number v]) + ([floor v] of (player frame) ))\n    stop [this script v]\nend\nif <(player action) = [enter door]> then\n    switch costume to (knightenterdoor4 v)\n    switch costume to ((costume [number v]) + ([floor v] of (player frame) ))\n    stop [this script v]\nend\nif <(player action) = [flip]> then\n    switch costume to (knightflip3 v)\n    switch costume to ((costume [number v]) - ([ceiling v] of (player frame) ))\n    if <(player frame) < [-0.5]> then\n        switch costume to (knightflip1 v)\n    end\n    change [player frame v] by (-0.5)\n    stop [this script v]\nend\nif <(special action) = [sword1]> then\n    switch costume to (knightnailswing5 v)\n    switch costume to ((costume [number v]) - ([ceiling v] of (special action frame) ))\n    change [special action frame v] by (-0.25)\n    if <(special action frame) < [-0.75]> then\n        set [special action v] to []\n    end\n    stop [this script v]\nend\nif <(special action) = [sword2]> then\n    switch costume to (knightupslash6 v)\n    switch costume to ((costume [number v]) - ([ceiling v] of (special action frame) ))\n    change [special action frame v] by (-0.5)\n    if <(special action frame) < [-0.5]> then\n        set [special action v] to []\n    end\n    stop [this script v]\nend\nif <(special action) = [sword3]> then\n    switch costume to (knightpogo2 v)\n    switch costume to ((costume [number v]) - ([ceiling v] of (special action frame) ))\n    change [special action frame v] by (-0.25)\n    if <(special action frame) < [-0.25]> then\n        set [special action v] to []\n    end\n    stop [this script v]\nend\nif <(special action) = [land hard]> then\n    switch costume to (knightlandhard5 v)\n    switch costume to ((costume [number v]) - ([ceiling v] of (special action frame) ))\n    if <(costume [name v]) = [KnightLandHard3]> then\n        change [special action frame v] by (-0.1)\n    else\n        change [special action frame v] by (-0.5)\n    end\n    if <(special action frame) < [-0.5]> then\n        set [special action v] to []\n    end\n    stop [this script v]\nend\nif <(special action) = [land]> then\n    switch costume to (knightland3 v)\n    switch costume to ((costume [number v]) - ([ceiling v] of (special action frame) ))\n    change [special action frame v] by (-0.5)\n    if <(special action frame) < [-0.5]> then\n        set [special action v] to []\n    end\n    stop [this script v]\nend\nif <(player action) = [sit]> then\n    if <(MAP) > [0]> then\n        switch costume to (knightsitmap v)\n    else\n        switch costume to (knightsit v)\n    end\n    stop [this script v]\nend\nif <(falling) > [1]> then\n    if <(falling) > [5]> then\n        if <(falling) < [21]> then\n            switch costume to (knightfall1 v)\n            switch costume to ((costume [number v]) + ([floor v] of (((falling) - (5)) / (2)) ))\n        else\n            switch costume to (knightfall11 v)\n            switch costume to ((costume [number v]) + (([floor v] of ((falling) / (2)) ) mod (3)))\n        end\n    else\n        switch costume to (knightjumping2 v)\n    end\n    stop [this script v]\nend\nif <(special action) = [heal]> then\n    switch costume to (knightfinishheal3 v)\n    switch costume to ((costume [number v]) - ([ceiling v] of (special action frame) ))\n    change [special action frame v] by (-0.25)\n    if <(special action frame) < [-0.25]> then\n        set [special action v] to []\n    end\n    stop [this script v]\nend\nif <(player action) = [heal]> then\n    switch costume to (knightheal1 v)\n    switch costume to ((costume [number v]) + (([floor v] of ((timer) * (10)) ) mod (5)))\n    stop [this script v]\nend\nif <(special action) = [turn]> then\n    if <(MAP) > [0]> then\n        switch costume to (knightmapturn3 v)\n        change [special action frame v] by (-0.25)\n    else\n        switch costume to (knightturning4 v)\n    end\n    switch costume to ((costume [number v]) - ([ceiling v] of (special action frame) ))\n    change [special action frame v] by (-0.25)\n    if <(special action frame) < [-0.75]> then\n        set [special action v] to []\n    end\n    stop [this script v]\nend\nif <(special action) = [start]> then\n    switch costume to (knightstarting3 v)\n    switch costume to ((costume [number v]) - ([ceiling v] of (special action frame) ))\n    change [special action frame v] by (-0.25)\n    if <(special action frame) < [-0.8]> then\n        set [special action v] to []\n    end\n    stop [this script v]\nend\nif <(special action) = [stop]> then\n    switch costume to (knightstopping3 v)\n    switch costume to ((costume [number v]) - ([ceiling v] of (special action frame) ))\n    change [special action frame v] by (-0.25)\n    if <(special action frame) < [-0.75]> then\n        set [special action v] to []\n    end\n    stop [this script v]\nend\nif <(player action) = [crouch]> then\n    switch costume to (knightlookdown1 v)\n    switch costume to ((costume [number v]) + (([floor v] of ((timer) * (10)) ) mod (3)))\n    stop [this script v]\nend\nif <(player action) = [look up]> then\n    switch costume to (knightlookup1 v)\n    switch costume to ((costume [number v]) + (([floor v] of ((timer) * (10)) ) mod (3)))\n    stop [this script v]\nend\nif <(player action) = [walk]> then\n    if <(MAP) > [0]> then\n        switch costume to (knightwalkmap1 v)\n        switch costume to ((costume [number v]) + (([floor v] of (player frame) ) mod (4)))\n    else\n        switch costume to (knightwalk1 v)\n        switch costume to ((costume [number v]) + (([floor v] of (player frame) ) mod (4)))\n    end\n    stop [this script v]\nend\nif <(MAP) > [0]> then\n    switch costume to (knightidlemap1 v)\n    switch costume to ((costume [number v]) + (([floor v] of ((timer) * (10)) ) mod (4)))\nelse\n    if <(HEALTH) = [1]> then\n        switch costume to (knightslouch1 v)\n        switch costume to ((costume [number v]) + (([floor v] of ((timer) * (8)) ) mod (4)))\n    else\n        switch costume to (knightidle1 v)\n        switch costume to ((costume [number v]) + (([floor v] of ((timer) * (10)) ) mod (4)))\n    end\nend\n\ndefine handle - God mode\nchange [speed x v] by ((6) * ([x axis v] of [controls v]))\nchange [speed y v] by ((6) * ([y axis v] of [controls v]))\nset [speed x v] to ((0.7) * (speed x))\nset [speed y v] to ((0.7) * (speed y))\nchange [x v] by (speed x)\nchange [y v] by (speed y)\nget tile at x: (x) y: (y)\n\ndefine check around player\nif <(y) < [0]> then\n    broadcast (player - die v)\nend\nif <(player action) = [crouch]> then\n    if <([nail stage v] of [nail v]) = [1]> then\n        set [invulnerable v] to [4]\n    end\nend\nif <(player action) = [look up]> then\n    if <([nail stage v] of [nail v]) = [1]> then\n        set [invulnerable v] to [4]\n    end\nend\nif <([focus v] of [controls v]) = [32]> then\n    set [invulnerable v] to [10]\nend\nget tile at x: (x) y: ((y) - ((height) + (16)))\nif <(tile) = [151]> then\n    set [falling v] to [15]\nend\nif <(tile) = [155]> then\n    broadcast (player - hurt - spikes v)\nend\nget tile at x: (x) y: ((y) + ((height) + (16)))\nif <(tile) = [155]> then\n    broadcast (player - hurt - spikes v)\nend\nget tile at x: ((x) - ((width) + (16))) y: (y)\nif <(tile) = [155]> then\n    broadcast (player - hurt - spikes v)\nend\nget tile at x: ((x) + ((width) + (16))) y: (y)\nif <(tile) = [155]> then\n    broadcast (player - hurt - spikes v)\nend\nget tile at x: (x) y: (y)\nif <<(tile) = [18]> or <(tile) = [155]>> then\n    broadcast (player - hurt - spikes v)\nend\nif <<(ARENA PROGRESS) < [1]> and <not <[game data v] contains (join [are] (ROOM))?>>> then\n    if <<(ROOM) = [16]> and <<<(tile index) = [321]> or <(tile index) = [322]>> or <<(tile index) = [540]> or <(tile index) = [541]>>>> then\n        broadcast (Begin Arena v)\n    end\n    if <<(ROOM) = [27]> and <<(tile index) = [417]> or <(tile index) = [418]>>> then\n        broadcast (Begin Arena v)\n    end\nend\n\ndefine limit camera edge x: (edge x) edge y: (edge y)\nif <(CAMERA X) < (edge x)> then\n    set [camera x v] to (edge x)\nend\nif <(CAMERA Y) < (edge y)> then\n    set [camera y v] to (edge y)\nend\nif <(CAMERA X) > (((32) * (GRID WIDTH)) - (edge x))> then\n    set [camera x v] to (((32) * (GRID WIDTH)) - (edge x))\nend\nif <(CAMERA Y) > (((32) * (GRID HEIGHT)) - (edge y))> then\n    set [camera y v] to (((32) * (GRID HEIGHT)) - (edge y))\nend\n\nwhen I receive [level - stop v]\nstop [other scripts in sprite v]\n\nwhen I receive [level - start game loop v]\nstop [other scripts in sprite v]\nset [arena progress v] to [0]\ngame loop\n\nwhen I receive [level - start game loop - respawn v]\nhide\nset [health v] to (MAX HEALTH)\nset [soul v] to [0]\nset [lifeblood health v] to [0]\nset [x v] to (SPAWN X)\nset [y v] to (SPAWN Y)\nset [room v] to (SPAWN LEVEL)\nbroadcast (LEVEL - Load v) and wait\nreset player\nif <not <(ROOM) = [1]>> then\n    set [player action v] to [sit]\nend\nshow\ngame loop\n\nwhen I receive [move player after enemy v]\npaint sprite\n\nwhen I receive [player - die v]\nset [player action v] to [lose life]\nset [player frame v] to [0]\nstop all sounds\nstart sound [hero_damage v]\nstart sound [hero_death_extra_details v]\npoint in direction (90)\nwait (0) seconds\nstop [other scripts in sprite v]\nif <[game data v] contains [shade]?> then\n    set [temp v] to (item # of [shade] in [game data v])\n    replace item ((temp) + (1)) of [game data v] with (tile index)\n    replace item ((temp) + (2)) of [game data v] with (ROOM)\n    replace item ((temp) + (3)) of [game data v] with (GEO)\nelse\n    add [shade] to [game data v]\n    add (tile index) to [game data v]\n    add (ROOM) to [game data v]\n    add (GEO) to [game data v]\nend\nswitch costume to (knightdeath1 v)\nrepeat (50)\n    change [player frame v] by (1)\n    if <(player frame) < [29]> then\n        if <((player frame) mod (2)) = [0]> then\n            next costume\n        end\n    else\n        set rotation style [all around v]\n        set [speed y v] to [-5]\n        if <not <(solid) > [0]>> then\n            turn left (15) degrees\n        end\n        move sprite y\n    end\n    paint sprite\n    broadcast (position tiles v)\n    broadcast (position enemy v)\nend\nrepeat (20)\n    broadcast (position tiles v)\n    broadcast (position enemy v)\nend\nset [geo v] to [0]\nbroadcast (LEVEL - Load v) and wait\nbroadcast (LEVEL - Start Game Loop - Respawn v)\n\nwhen I receive [player - exit room v]\nstop [other scripts in sprite v]\nset [speed x v] to [0]\nrepeat until <<(falling) < [1]> or <([abs v] of (y position) ) > [160]>>\n    if <(y position) > [-130]> then\n        handle keys - jump/crouch\n        move sprite x\n        move sprite y\n    else\n        change [y v] by (speed y)\n    end\n    paint sprite\n    broadcast (position tiles v)\n    broadcast (position enemy v)\nend\nrepeat until <<([abs v] of (x position) ) > [237]> or <([abs v] of (y position) ) > [140]>>\n    if <(MAP) < [1]> then\n        set [speed x v] to (((direction) / (90)) * (5))\n    else\n        set [speed x v] to (((direction) / (90)) * (3))\n    end\n    change [x v] by (speed x)\n    change [player frame v] by ([abs v] of ((speed x) / (15)) )\n    paint sprite\n    broadcast (position tiles v)\n    broadcast (position enemy v)\nend\nrepeat (25)\n    change [ghost v] effect by (10)\n    change [y v] by (speed y)\n    paint sprite\n    broadcast (position tiles v)\n    broadcast (position enemy v)\nend\nset [room v] to (NEW LEVEL)\nbroadcast (LEVEL - Load v) and wait\nbroadcast (LEVEL - Start Game Loop - New Level v)\n\nwhen I receive [level - continue game loop v]\ngame loop\n\nwhen I receive [player - hurt v]\nset [player action v] to [hurt]\nget tile at x: (x) y: (y)\nif <<(invulnerable) > [0]> or <<(tile) = [18]> and <([nail stage v] of [nail v]) > [0]>>> then\n    stop [this script v]\nend\nstop [other scripts in sprite v]\nstart sound [hero_damage v]\nif <(LIFEBLOOD HEALTH) > [0]> then\n    change [lifeblood health v] by (-1)\nelse\n    change [health v] by (-1)\nend\nif <(HEALTH) < [1]> then\n    broadcast (player - die v)\n    stop [this script v]\nend\nset [invulnerable v] to [40]\nset [player frame v] to [0]\nrepeat (5)\n    paint sprite\n    change [player frame v] by (0.5)\nend\nbroadcast (LEVEL - Continue Game Loop v)\n\nwhen I receive [position tiles v]\nif <(player action) = [lose life]> then\n    stop [this script v]\nend\nif <(player action) = [sit]> then\n    stop [this script v]\nend\nif <(invulnerable) > [0]> then\n    change [invulnerable v] by (-1)\nend\nif <<(invulnerable) > [30]> and <(invulnerable) < [75]>> then\n    if <((invulnerable) mod (4)) < [2]> then\n        set [brightness v] effect to (0)\n    else\n        set [brightness v] effect to (40)\n    end\nelse\n    if <((invulnerable) mod (2)) < [1]> then\n        set [brightness v] effect to (0)\n    else\n        set [brightness v] effect to (40)\n    end\nend\n\nwhen I receive [attacked enemy v]\nif <([up v] of [controls v]) > [0]> then\n    set [speed y v] to [0]\nelse\n    if <([down v] of [controls v]) > [0]> then\n        set [speed y v] to [18]\n    else\n        set [speed x v] to (((direction) / (-90)) * (4))\n    end\nend\nchange [soul v] by (8)\nif <(SOUL) > (MAX SOUL)> then\n    set [soul v] to (MAX SOUL)\nend\nif <(falling) > [5]> then\n    set [falling v] to [5]\nend\n\nwhen I receive [attacked object v]\nif <([up v] of [controls v]) > [0]> then\n    set [speed y v] to [0]\nelse\n    if <([down v] of [controls v]) > [0]> then\n        set [speed y v] to [18]\n    else\n        set [speed x v] to (((direction) / (-90)) * (4))\n    end\nend\nif <(falling) > [5]> then\n    set [falling v] to [5]\nend\n\nwhen I receive [new diolouge v]\nset [jumping v] to [20]\nset [special action v] to []\nset [player action v] to [look up]\npaint sprite\n\nwhen I receive [sit on bench v]\nset [player action v] to [sit]\nset [player frame v] to [0]\nset [health v] to (MAX HEALTH)\nset [x v] to (SPAWN X)\nset [y v] to (SPAWN Y)\nset [brightness v] effect to (50)\nrepeat (10)\n    add [dot] to [particles v]\n    add (x) to [particles v]\n    add ((y) + (2)) to [particles v]\nend\nset [brightness v] effect to (0)\n\ndefine Decrease Speed x\nif <([abs v] of (speed x) ) > [4]> then\n    if <(MAP) < [1]> then\n        set [special action v] to [stop]\n        set [special action frame v] to [2]\n    end\nend\nif <(speed x) > [1]> then\n    change [speed x v] by (-1)\nelse\n    if <(speed x) < [-1]> then\n        change [speed x v] by (1)\n    else\n        set [speed x v] to [0]\n        set [player frame v] to [0]\n    end\nend\n\nwhen I receive [level - start game loop - new level v]\nset [x v] to (HAZARD RESPAWN X)\nset [y v] to (HAZARD RESPAWN Y)\nreset player\nif <<(ROOM) = [3]> and <<(x) > [700]> and <(x) < [900]>>> then\n    set [falling v] to [30]\n    set [text v] to [FORGOTTEN CROSSROADS]\n    broadcast (New title v)\nend\ngame loop\n\nwhen I receive [game - pause v]\nstop [other scripts in sprite v]\nrepeat (10)\n    broadcast (check controls v)\n    wait (0) seconds\nend\nrepeat until <(MENU SCREEN) = []>\n    broadcast (check controls v)\n    broadcast (tick menu v)\nend\nrepeat (2)\n    broadcast (check controls v)\nend\nbroadcast (LEVEL - Continue Game Loop v)\n\nwhen I receive [game - new game v]\nset [spawn x v] to [530]\nset [spawn y v] to [1550]\nset [spawn level v] to [1]\nset [hazard respawn x v] to [530]\nset [hazard respawn y v] to [1550]\nset [max health v] to [5]\nset [max soul v] to [99]\nset [geo v] to [0]\nset [grubs v] to [0]\nset [grub rewards v] to [0]\ndelete all of [game data v]\nbroadcast (generate level v) and wait\nshow\nbroadcast (LEVEL - Start Game Loop - Respawn v)\n\nwhen I receive [player - exit room - up v]\nstop [other scripts in sprite v]\nset [speed x v] to [0]\nrepeat (25)\n    change [ghost v] effect by (10)\n    change [y v] by (speed y)\n    paint sprite\nend\nset [room v] to (NEW LEVEL)\nbroadcast (LEVEL - Load v) and wait\nbroadcast (LEVEL - Start Game Loop - New Level v)\n\ndefine handle - get up\nset [player action v] to [idle]\nset [orig y v] to (y)\nfix collision in direction dx: [0] dy: [1]\nif <(solid) > [0]> then\n    set [player action v] to [crouch]\n    set [y v] to (orig y)\nend\n\nwhen I receive [player - hurt - double v]\nset [player action v] to [hurt]\nget tile at x: (x) y: (y)\nif <<(invulnerable) > [0]> or <<(tile) = [18]> and <([nail stage v] of [nail v]) > [0]>>> then\n    stop [this script v]\nend\nstop [other scripts in sprite v]\nstart sound [hero_double_damage v]\nrepeat (2)\n    if <(LIFEBLOOD HEALTH) > [0]> then\n        change [lifeblood health v] by (-1)\n    else\n        change [health v] by (-1)\n    end\n    if <(HEALTH) < [1]> then\n        broadcast (player - die v)\n        stop [this script v]\n    end\nend\nset [speed x v] to (PLAYER KNOCKBACK)\nset [speed y v] to [2]\nset [invulnerable v] to [40]\nrepeat (5)\n    paint sprite\nend\nbroadcast (LEVEL - Continue Game Loop v)\n\nwhen I receive [player - hurt - spikes v]\nget tile at x: (x) y: (y)\nif <<<(invulnerable) > [0]> and <(invulnerable) < [10]>> or <<(tile) = [18]> and <([nail stage v] of [nail v]) > [0]>>> then\n    stop [this script v]\nend\nstop [other scripts in sprite v]\nset [player action v] to [flip]\nstart sound [hero_damage v]\nif <(LIFEBLOOD HEALTH) > [0]> then\n    change [lifeblood health v] by (-1)\nelse\n    change [health v] by (-1)\nend\nif <(HEALTH) < [1]> then\n    broadcast (player - die v)\n    stop [this script v]\nend\nset [speed x v] to [0]\nset [speed y v] to [0]\nset [player frame v] to [2]\nrepeat (6)\n    paint sprite\nend\nset [x v] to (HAZARD RESPAWN X)\nset [y v] to (HAZARD RESPAWN Y)\nset [camera x v] to (x)\nset [camera y v] to (y)\nset [invulnerable v] to [10]\nbroadcast (position tiles v) and wait\nbroadcast (position enemy v) and wait\nbroadcast (LEVEL - Continue Game Loop v)\n\nwhen I receive [change menu v]\nset volume to ((SOUND VOLUME) * (10)) %\n\nwhen I receive [health healed v]\nset [special action v] to [heal]\nset [special action frame v] to [2]\n\nwhen I receive [main menu v]\nerase all\n\nset [hazard respawn x v] to (x)\nset [hazard respawn y v] to (y)\n\nwhen I receive [player - exit room - in v]\nstop [other scripts in sprite v]\nset [speed x v] to [0]\nset [player action v] to [enter door]\nset [player frame v] to [0]\nrepeat (7)\n    paint sprite\n    change [player frame v] by (0.5)\nend\nrepeat (20)\n    change [ghost v] effect by (10)\n    change [y v] by (0.75)\n    paint sprite\nend\nset [room v] to (NEW LEVEL)\nbroadcast (LEVEL - Load v) and wait\nbroadcast (LEVEL - Start Game Loop - New Level v)\n\nwhen [r v] key pressed\nif <key ((join [!] []) v) pressed?> then\n    broadcast (LEVEL - Start Game Loop v)\nend\n\nwhen I receive [level - start game loop - new level v]\nif <(ROOM) = [1]> then\n    set [text v] to [KING'S PASS]\n    broadcast (New title v)\nend\nif <(ROOM) = [2]> then\n    set [text v] to [DIRTMOUTH]\n    broadcast (New title v)\nend\nif <(ROOM) = [48]> then\n    set [text v] to [BLACK EGG TEMPLE]\n    broadcast (New title v)\nend\n\n@Tiles\n\ndefine Stamp Tiles - Top to bottom\nif <(tile index) > []> then\n    stop [this script v]\nend\nshow\nclear graphic effects\nset [tile y v] to (((([floor v] of ((CAMERA Y) / (32)) ) + ((CLONE COUNT Y) - (1))) * (32)) + ((4) - (180)))\nrepeat (14)\n    set [tile x v] to ((([floor v] of ((CAMERA X) / (32)) ) * (32)) + ((0) - (240)))\n    repeat (17)\n        get tile at x: (tile x) y: (tile y)\n        if <<[clone tiles v] contains (tile)?> and <(ROOM) = (NEW LEVEL)>> then\n            Position Tiles\n            stamp\n            create clone of (_myself_ v)\n        else\n            Position Tiles\n            stamp\n        end\n        change [tile x v] by (32)\n    end\n    change [tile y v] by (-32)\nend\nset [tile index v] to []\nPosition Tiles\nstamp\nhide\n\ndefine editor brush\nif <<(EDITOR) < [1]> or <mouse down?>> then\n    hide\n    stop [this script v]\nend\nset [tile x v] to (((32) * ([tile grid x v] of [editor v])) + (16))\nset [tile y v] to (((32) * ([tile grid y v] of [editor v])) + (16))\nset [tile v] to ([chosen brush v] of [editor v])\nset [ghost v] effect to (50)\nshow\n\ndefine Animate Tiles\nif <<(tile) = [111]> or <(tile) = [120]>> then\n    change [tile v] by (([floor v] of ((timer) * (15)) ) mod (9))\nend\nif <(tile) = [168]> then\n    change [tile v] by (([floor v] of ((timer) * (10)) ) mod (6))\nend\nif <(tile) = [174]> then\n    change [tile v] by (([floor v] of ((timer) * (10)) ) mod (5))\nend\n\ndefine Update Tiles\nif <(tile) = [38]> then\n    if <(item ((tile index) - (1)) of [tile grid v]) = [37]> then\n        replace item (tile index) of [tile grid v] with [2]\n    end\nend\nif <(tile) = [102]> then\n    if <(EDITOR) < [1]> then\n        if <[game data v] contains (join (join [grub ] (tile index)) (join [ ] (ROOM)))?> then\n            replace item (tile index) of [tile grid v] with [2]\n        end\n    end\nend\nif <(ARENA PROGRESS) > [0]> then\n    if <<(tile) < [108]> and <(tile) > [103]>> then\n        replace item (tile index) of [tile grid v] with ((tile) + (1))\n    end\nelse\n    if <<(tile) < [108]> and <(tile) > [103]>> then\n        replace item (tile index) of [tile grid v] with ((tile) - (1))\n    end\nend\nif <(tile) = [138]> then\n    replace item (tile index) of [tile grid v] with [2]\nend\nif <<(tile) < [138]> and <(tile) > [132]>> then\n    replace item (tile index) of [tile grid v] with ((tile) + (1))\nend\nif <(tile) = [2]> then\n    if <(item ((tile index) + (1)) of [tile grid v]) = [108]> then\n        replace item (tile index) of [tile grid v] with [104]\n    end\nend\nif <(tile) = [103]> then\n    if <(item ((tile index) + (1)) of [tile grid v]) = [103]> then\n        replace item (tile index) of [tile grid v] with [2]\n    end\nend\nif <(tile) = [132]> then\n    if <not <<(item ((tile index) - (1)) of [tile grid v]) < [138]> and <(item ((tile index) - (1)) of [tile grid v]) > [131]>>> then\n        replace item (tile index) of [tile grid v] with [133]\n    end\nend\nif <<(tile) = [149]> or <(tile) = [150]>> then\n    if <(([floor v] of ((timer) * (20)) ) mod (5)) = [0]> then\n        start sound [breakable_wall_hit_1 v]\n        replace item (tile index) of [tile grid v] with ((tile) + (1))\n        add [rock] to [particles v]\n        add (tile x) to [particles v]\n        add (tile y) to [particles v]\n    end\nend\nif <(tile) = [151]> then\n    if <(([floor v] of ((timer) * (20)) ) mod (5)) = [0]> then\n        start sound [breakable_wall_death v]\n        replace item (tile index) of [tile grid v] with [2]\n        repeat (3)\n            add [rock] to [particles v]\n            add (tile x) to [particles v]\n            add (tile y) to [particles v]\n        end\n    end\nend\nif <(tile) = [148]> then\n    if <([tile index v] of [player v]) = ((tile index) + (1))> then\n        start sound [breakable_wall_hit_1 v]\n        replace item (tile index) of [tile grid v] with [149]\n        add [rock] to [particles v]\n        add (tile x) to [particles v]\n        add ((tile y) + (16)) to [particles v]\n    end\n    if <(item ((tile index) + (GRID HEIGHT)) of [tile grid v]) = [149]> then\n        replace item (tile index) of [tile grid v] with [149]\n    end\n    if <(item ((tile index) - (GRID HEIGHT)) of [tile grid v]) = [149]> then\n        replace item (tile index) of [tile grid v] with [149]\n    end\n    if <(item ((tile index) - ((GRID HEIGHT) * (2))) of [tile grid v]) = [149]> then\n        replace item (tile index) of [tile grid v] with [149]\n    end\n    if <(item ((tile index) - ((GRID HEIGHT) * (3))) of [tile grid v]) = [149]> then\n        replace item (tile index) of [tile grid v] with [149]\n    end\nend\nif <<<(tile) = [27]> or <(tile) = [30]>> or <(tile) = [94]>> then\n    if <([tile index v] of [player v]) = (tile index)> then\n        change [grass wave v] by (((([speed x v] of [player v]) * (2)) - (GRASS WAVE)) / (5))\n    end\nend\nif <not <<<([tile v] of [player v]) = [27]> or <([tile v] of [player v]) = [30]>> or <([tile v] of [player v]) = [94]>>> then\n    set [grass wave v] to [0]\nend\nif <<(tile) = [152]> or <(tile) = [153]>> then\n    if <(item ((tile index) + (1)) of [tile grid v]) = ((tile) + (1))> then\n        replace item (tile index) of [tile grid v] with ((tile) + (1))\n    end\n    if <(item ((tile index) - (1)) of [tile grid v]) = ((tile) + (1))> then\n        replace item (tile index) of [tile grid v] with ((tile) + (1))\n    end\nend\nif <(tile) = [154]> then\n    if <(item ((tile index) + (1)) of [tile grid v]) = [2]> then\n        replace item (tile index) of [tile grid v] with [2]\n    end\n    if <(item ((tile index) - (1)) of [tile grid v]) = [2]> then\n        replace item (tile index) of [tile grid v] with [2]\n    end\nend\nif <(tile) = [11]> then\n    if <(item ((tile index) + (1)) of [tile grid v]) = [2]> then\n        replace item (tile index) of [tile grid v] with [5]\n    end\nend\nif <(tile) = [22]> then\n    if <(item ((tile index) - (1)) of [tile grid v]) = [2]> then\n        replace item (tile index) of [tile grid v] with [15]\n    end\nend\nif <(tile) = [158]> then\n    if <(([floor v] of ((timer) * (20)) ) mod (2)) = [0]> then\n        add [dot] to [particles v]\n        add ((tile x) + (pick random (-16) to (16))) to [particles v]\n        add ((tile y) + (pick random (-24) to (0))) to [particles v]\n    end\nend\nif <<(tile) < [167]> and <(tile) > [158]>> then\n    replace item (tile index) of [tile grid v] with ((tile) + (1))\n    if <(tile) = [163]> then\n        repeat (2)\n            add [10] to [geo drops v]\n            add (tile x) to [geo drops v]\n            add (tile y) to [geo drops v]\n            add [12] to [geo drops v]\n        end\n        repeat (6)\n            add [6] to [geo drops v]\n            add (tile x) to [geo drops v]\n            add (tile y) to [geo drops v]\n            add [15] to [geo drops v]\n        end\n        repeat (20)\n            add [2] to [geo drops v]\n            add (tile x) to [geo drops v]\n            add (tile y) to [geo drops v]\n            add [16] to [geo drops v]\n        end\n    end\nend\n\nwhen I receive [prepare diolouge v]\nStamp Tiles - Bottom to Top\n\nwhen I receive [begin arena v]\nif <(tile index) = []> then\n    repeat until <not <[tile grid v] contains [103]?>>\n        replace item (item # of [103] in [tile grid v]) of [tile grid v] with [104]\n    end\nelse\n    if <(tile) = [103]> then\n        replace item (tile index) of [tile grid v] with [104]\n    end\nend\n\ndefine get tile at x: (x) y: (y)\nset [tile grid x v] to ([floor v] of ((x) / (32)) )\nset [tile grid y v] to ([floor v] of ((y) / (32)) )\nset [tile index v] to (((1) + (tile grid y)) + ((tile grid x) * (GRID HEIGHT)))\nset [tile v] to (item (tile index) of [tile grid v])\n\nwhen I receive [finish arena v]\nif <(tile index) = []> then\n    repeat until <not <[tile grid v] contains [108]?>>\n        replace item (item # of [108] in [tile grid v]) of [tile grid v] with [107]\n    end\nend\n\nwhen I receive [lever flipped v]\nif <(tile index) = []> then\n    repeat until <not <[tile grid v] contains [108]?>>\n        replace item (item # of [108] in [tile grid v]) of [tile grid v] with [107]\n    end\n    repeat until <not <[tile grid v] contains [131]?>>\n        replace item (item # of [131] in [tile grid v]) of [tile grid v] with [132]\n    end\nend\n\nwhen I receive [level - start game loop - new level v]\nif <(tile index) = []> then\n    if <<[game data v] contains (join [are] (ROOM))?> or <[game data v] contains (join [lvr] (ROOM))?>> then\n        repeat until <not <[tile grid v] contains [108]?>>\n            replace item (item # of [108] in [tile grid v]) of [tile grid v] with [103]\n        end\n        repeat until <not <[tile grid v] contains [131]?>>\n            replace item (item # of [131] in [tile grid v]) of [tile grid v] with [2]\n        end\n    end\n    if <[game data v] contains (join [che] (ROOM))?> then\n        repeat until <not <[tile grid v] contains [158]?>>\n            replace item (item # of [158] in [tile grid v]) of [tile grid v] with [167]\n        end\n    end\n    if <<(ROOM) = [15]> and <[game data v] contains [lvr28]?>> then\n        replace item (707) of [tile grid v] with [2]\n        replace item (708) of [tile grid v] with [2]\n        replace item (737) of [tile grid v] with [2]\n        replace item (738) of [tile grid v] with [2]\n        replace item (706) of [tile grid v] with [45]\n        replace item (736) of [tile grid v] with [45]\n        replace item (709) of [tile grid v] with [56]\n        replace item (739) of [tile grid v] with [57]\n    end\nend\n\ndefine Position Tiles\npoint in direction (90)\nif <(tile index) = []> then\n    editor brush\nelse\n    set [tile v] to (item (tile index) of [tile grid v])\nend\nswitch costume to (big v)\ngo to x: ((tile x) - (CAMERA X)) y: ((tile y) - (CAMERA Y))\nif <(tile) < [2]> then\n    set [tile v] to [2]\nelse\n    Animate Tiles\n    if <<(tile index) > []> and <(EDITOR) < [1]>> then\n        Update Tiles\n    end\nend\nswitch costume to (tile)\nif <<(tile) > [110]> and <(tile) < [129]>> then\n    set size to (25) %\n    change y by (-8)\nelse\n    if <<(tile) > [167]> and <(tile) < [181]>> then\n        set size to (75) %\n        change y by (-2)\n    else\n        set size to (100) %\n    end\nend\nif <<(tile) > [140]> and <(tile) < [147]>> then\n    go to [back v] layer\n    go [forward v] (1) layers\nend\nif <<<(tile) > [26]> and <(tile) < [33]>> or <<(tile) > [93]> and <(tile) < [97]>>> then\n    change y by (-24)\n    if <not <<<(tile) = [29]> or <(tile) = [32]>> or <(tile) = [96]>>> then\n        turn right (([sin v] of (((timer) + (tile)) * (50)) ) * (10)) degrees\n        if <(tile index) = ([tile index v] of [player v])> then\n            turn right (GRASS WAVE) degrees\n            if <(GRASS WAVE) > [0.4]> then\n                change [grass wave v] by (-0.5)\n            else\n                if <(GRASS WAVE) < [-0.4]> then\n                    change [grass wave v] by (0.5)\n                else\n                    set [grass wave v] to [0]\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [position tiles v]\nif <(ROOM) = [5]> then\n    Stamp Tiles - Top to bottom\nelse\n    Stamp Tiles - Bottom to Top\nend\n\nwhen I receive [check controls v]\nif <(MENU SCREEN) = []> then\n    delete this clone\nend\n\nwhen I receive [level - stop v]\ndelete this clone\n\ndefine Stamp Tiles - Bottom to Top\nif <(tile index) > []> then\n    stop [this script v]\nend\nshow\nclear graphic effects\nset [tile y v] to ((([floor v] of ((CAMERA Y) / (32)) ) * (32)) + ((4) - (180)))\nrepeat (14)\n    set [tile x v] to ((([floor v] of ((CAMERA X) / (32)) ) * (32)) + ((0) - (240)))\n    repeat (17)\n        get tile at x: (tile x) y: (tile y)\n        if <<[clone tiles v] contains (tile)?> and <(ROOM) = (NEW LEVEL)>> then\n            Position Tiles\n            stamp\n            create clone of (_myself_ v)\n        else\n            Position Tiles\n            stamp\n        end\n        change [tile x v] by (32)\n    end\n    change [tile y v] by (32)\nend\nset [tile index v] to []\nPosition Tiles\nstamp\nhide\n\nwhen flag clicked\nset size to (100) %\ngo to [back v] layer\ngo [forward v] (LAYERS - BACKGROUND) layers\nset [clone count x v] to [17]\nset [clone count y v] to [14]\nset [tile index v] to []\n\n@Entity\n\ndefine get tile at x: (x) y: (y)\nset [tile grid x v] to ([floor v] of ((x) / (32)) )\nset [tile grid y v] to ([floor v] of ((y) / (32)) )\nset [tile index v] to (((1) + (tile grid y)) + ((tile grid x) * (GRID HEIGHT)))\nif <(tile grid y) < [0]> then\n    set [tile v] to []\nelse\n    set [tile v] to (item (tile index) of [tile grid v])\nend\nset [tile shape v] to (item (tile) of [tile shape v])\n\ndefine fix collision at point x: (x) y: (y) part: (part)\nget tile at x: (x) y: (y)\nif <(tile shape) = []> then\n    stop [this script v]\nend\nset [mod x v] to ((x) mod (32))\nset [mod y v] to ((y) mod (32))\nset [temp v] to (letter (1) of (tile shape))\nif <(tile shape) = [=]> then\n    if <<not <(part) = [feet]>> or <((mod y) - (fix dy)) < [32]>> then\n        stop [this script v]\n    end\nend\nset [solid v] to [10]\nif <(fix dy) < [0]> then\n    change [y v] by ((32) - (mod y))\nend\nif <(fix dx) < [0]> then\n    change [x v] by ((32) - (mod x))\nend\nif <(fix dy) > [0]> then\n    change [y v] by ((TINY -) - (mod y))\nend\nif <(fix dx) > [0]> then\n    change [x v] by ((TINY -) - (mod x))\nend\n\ndefine fix collision in direction dx: (dx) dy: (dy)\nset [fix dx v] to (dx)\nset [fix dy v] to (dy)\nset [solid v] to []\nrepeat (2)\n    fix collision at point x: ((x) - (width)) y: ((y) - (height)) part: [feet]\n    fix collision at point x: ((x) - (width)) y: (y) part: []\n    fix collision at point x: ((x) - (width)) y: ((y) + (height)) part: []\n    fix collision at point x: ((x) + ((width) + (TINY -))) y: ((y) - (height)) part: [feet]\n    fix collision at point x: ((x) + ((width) + (TINY -))) y: (y) part: []\n    fix collision at point x: ((x) + ((width) + (TINY -))) y: ((y) + (height)) part: []\n    if <(solid) < [1]> then\n        stop [this script v]\n    end\nend\n\ndefine move sprite x\nset [orig y v] to (y)\nchange [x v] by (speed x)\nfix collision in direction dx: [0] dy: [-1]\nif <(y) > ((orig y) + (([abs v] of (speed x) ) + (4)))> then\n    set [y v] to (orig y)\n    fix collision in direction dx: (speed x) dy: [0]\n    if <(solid) > [0]> then\n        set [speed x v] to [0]\n        if <(special action) = []> then\n            if <<<(type) = [crawlid]> or <(type) = [gruzzer]>> or << (type) contains [husk]?> and <(falling) < [2]>>> then\n                turn right (180) degrees\n                set [special action v] to [turn]\n                set [special action timer v] to [1]\n            end\n            if <(type) = [lifeseed]> then\n                set [speed x v] to (((direction) / (90)) * (-5))\n            end\n            if <(type) = [tiktik]> then\n                if <(direction) = [90]> then\n                    turn left (90) degrees\n                    set [special action v] to [turn left]\n                    set [special action timer v] to [0]\n                end\n            end\n        end\n    end\nelse\n    if <(y) > (orig y)> then\n        set [speed x v] to ((speed x) * (0.9))\n    end\nend\n\ndefine move sprite y\nchange [y v] by (speed y)\nchange [falling v] by (1)\nfix collision in direction dx: [0] dy: (speed y)\nif <(solid) > [0]> then\n    if <(type) = [tiktik]> then\n        if <(direction) = [180]> then\n            turn left (90) degrees\n            set [special action v] to [turn left]\n            set [special action timer v] to [0]\n        end\n    end\n    if << [crawlid lifeseed] contains (type)?> or << (type) contains [husk]?> and <(angered) < [1]>>> then\n        Check Below Feet\n    end\n    if <(type) = [leaping husk]> then\n        if <(falling) > [1]> then\n            set [angered v] to [51]\n            set [speed x v] to [0]\n        end\n    end\n    if <(speed y) < [0]> then\n        set [falling v] to [0]\n    else\n        set [jumping v] to [99]\n    end\n    set [speed y v] to [0]\nend\n\nwhen flag clicked\nset size to (200) %\nhide\nset rotation style [left-right v]\nset [type v] to []\nset [speed x v] to [0]\nset [speed y v] to [0]\nset [visible v] to []\nset [special action v] to []\nset [special action timer v] to [0]\nset [action v] to []\n\ndefine paint sprite\nswitch costume to (big v)\ngo to x: ((x) - (CAMERA X)) y: ((y) - (CAMERA Y))\nswitch costume to (costume)\n\nwhen I receive [move enemy v]\nif <<(EDITOR) > [0]> or <(type) = []>> then\n    hide\n    stop [this script v]\nend\nMove Enemy\nif <(visible) < [2]> then\n    hide\nelse\n    show\nend\n\ndefine Tick Crawlid\nAccelerate y [1] Max: [20] Direction: [-1]\nmove sprite y\nAccelerate x [0.25] Max: [2.5] Direction: (direction)\nmove sprite x\nchange [frame v] by (0.4)\nif <(special action) = [turn]> then\n    set [costume v] to (((root costume) + (5)) - (special action timer))\n    Decrease Special Action Timer [2]\nelse\n    set [costume v] to ((root costume) + ([floor v] of ((frame) mod (4)) ))\nend\npaint sprite\nif <((frame) mod (7)) = [0]> then\n    start sound [crawler v]\nend\nif <(invulnerable) < [1]> then\n    if <touching (nail v)?> then\n        Take Damage\n        if <(health) < [1]> then\n            Die with corpse: ((root costume) + (6)) frames: [3]\n        end\n    end\nend\nif <touching (player v)?> then\n    set [player knockback v] to ((direction) / (10))\n    broadcast (player - hurt v)\nend\n\ndefine spawn type (tile type)\nset [frame v] to []\nif <(tile type) = [16]> then\n    Set Type: [crawlid] Costume: [2] Width: [16] Height: [0] Size: [50] HP: [8] Geo: [2] [0] [0]\nend\nif <(tile type) = [17]> then\n    Set Type: [vengefly] Costume: [12] Width: [12] Height: [8] Size: [60] HP: [8] Geo: [3] [0] [0]\nend\nif <(tile type) = [35]> then\n    Set Type: [geo] Costume: [29] Width: [16] Height: [8] Size: [175] HP: [3] Geo: [10] [1] [0]\nend\nif <(tile type) = [39]> then\n    Set Type: [cocoon] Costume: [169] Width: [24] Height: [40] Size: [150] HP: [1] Geo: [0] [0] [0]\nend\nif <(tile type) = [41]> then\n    Set Type: [object] Costume: [31] Width: [128] Height: [90] Size: [100] HP: [1] Geo: [0] [0] [0]\nend\nif <(tile type) = [42]> then\n    Set Type: [object] Costume: [32] Width: [128] Height: [88] Size: [100] HP: [1] Geo: [0] [0] [0]\nend\nif <(tile type) = [43]> then\n    Set Type: [object] Costume: [33] Width: [128] Height: [76] Size: [100] HP: [1] Geo: [0] [0] [0]\nend\nif <(tile type) = [44]> then\n    Set Type: [bench] Costume: [34] Width: [32] Height: [12] Size: [100] HP: [1] Geo: [0] [0] [0]\nend\nif <(tile type) = [62]> then\n    Set Type: [wandering husk] Costume: [55] Width: [12] Height: [10] Size: [80] HP: [15] Geo: [3] [0] [0]\nend\nif <(tile type) = [63]> then\n    Set Type: [tiktik] Costume: [38] Width: [5] Height: [0] Size: [60] HP: [8] Geo: [2] [0] [0]\nend\nif <(tile type) = [69]> then\n    Set Type: [gruzzer] Costume: [45] Width: [12] Height: [12] Size: [60] HP: [8] Geo: [2] [0] [0]\nend\nif <(tile type) = [70]> then\n    Set Type: [husk hornhead] Costume: [87] Width: [12] Height: [8] Size: [80] HP: [15] Geo: [3] [0] [0]\nend\nif <(tile type) = [75]> then\n    Set Type: [object] Costume: [35] Width: [200] Height: [120] Size: [100] HP: [1] Geo: [0] [0] [0]\nend\nif <(tile type) = [76]> then\n    Set Type: [object] Costume: [36] Width: [128] Height: [100] Size: [100] HP: [1] Geo: [0] [0] [0]\nend\nif <(tile type) = [77]> then\n    Set Type: [leaping husk] Costume: [116] Width: [12] Height: [16] Size: [80] HP: [15] Geo: [3] [0] [0]\nend\nif <(tile type) = [83]> then\n    Set Type: [object] Costume: [37] Width: [200] Height: [150] Size: [150] HP: [0] Geo: [0] [0] [0]\nend\nif <(tile type) = [84]> then\n    Set Type: [husk bully] Costume: [174] Width: [12] Height: [10] Size: [80] HP: [15] Geo: [3] [0] [0]\nend\nif <(tile type) = [86]> then\n    Set Type: [aspid hunter] Costume: [202] Width: [10] Height: [10] Size: [100] HP: [15] Geo: [6] [0] [0]\nend\nif <(tile type) = [87]> then\n    Set Type: [goam 90 out] Costume: [220] Width: [12] Height: [64] Size: [80] HP: [1] Geo: [0] [0] [0]\nend\nif <(tile type) = [88]> then\n    Set Type: [goam 90 in] Costume: [220] Width: [12] Height: [64] Size: [80] HP: [1] Geo: [0] [0] [0]\nend\nif <(tile type) = [89]> then\n    Set Type: [goam 0] Costume: [220] Width: [12] Height: [64] Size: [80] HP: [1] Geo: [0] [0] [0]\nend\nif <(tile type) = [90]> then\n    Set Type: [goam 180] Costume: [220] Width: [12] Height: [64] Size: [80] HP: [1] Geo: [0] [0] [0]\nend\nif <(tile type) = [91]> then\n    Set Type: [goam -90] Costume: [220] Width: [12] Height: [64] Size: [80] HP: [1] Geo: [0] [0] [0]\nend\nif <(tile type) = [92]> then\n    Set Type: [object] Costume: [230] Width: [0] Height: [0] Size: [80] HP: [1] Geo: [0] [0] [0]\nend\nif <(tile type) = [93]> then\n    Set Type: [hot spring] Costume: [236] Width: [0] Height: [0] Size: [100] HP: [1] Geo: [0] [0] [0]\nend\nif <(tile type) = [97]> then\n    Set Type: [aspid mother] Costume: [237] Width: [15] Height: [15] Size: [80] HP: [20] Geo: [5] [1] [0]\nend\nif <(tile type) = [98]> then\n    Set Type: [soul totem] Costume: [264] Width: [0] Height: [12] Size: [125] HP: [3] Geo: [0] [0] [0]\nend\nif <(tile type) = [99]> then\n    Set Type: [object] Costume: [267] Width: [0] Height: [12] Size: [80] HP: [0] Geo: [0] [0] [0]\nend\nif <(tile type) = [100]> then\n    Set Type: [husk guard] Costume: [268] Width: [31] Height: [31] Size: [80] HP: [70] Geo: [10] [2] [1]\nend\nif <(tile type) = [110]> then\n    Set Type: [false knight 1] Costume: [343] Width: [45] Height: [42] Size: [120] HP: [65] Geo: [0] [0] [0]\nend\nif <(tile type) = [129]> then\n    Set Type: [lever -90] Costume: [443] Width: [0] Height: [0] Size: [30] HP: [0] Geo: [0] [0] [0]\nend\nif <(tile type) = [130]> then\n    Set Type: [lever] Costume: [443] Width: [0] Height: [0] Size: [30] HP: [0] Geo: [0] [0] [0]\nend\nif <(tile type) = [139]> then\n    Set Type: [acid] Costume: [452] Width: [0] Height: [0] Size: [100] HP: [0] Geo: [0] [0] [0]\nend\nif <(tile type) = [181]> then\n    Set Type: [shade] Costume: [453] Width: [12] Height: [12] Size: [100] HP: [15] Geo: [4] [3] [20]\nend\n\nwhen I receive [level - done loading v]\nbroadcast (ENTITY - Clear v)\nbroadcast (ENTITY - Setup v)\n\nwhen I receive [entity - clear v]\ndelete this clone\n\nwhen I receive [entity - setup v]\nSpawn Loop\n\ndefine Spawn Loop\nset [object item # v] to [1]\nrepeat (length of [object idx v])\n    set [spawn index v] to (item (object item #) of [object idx v])\n    spawn type (item (object item #) of [object type v])\n    hide\n    change [object item # v] by (1)\nend\nset [object item # v] to []\nset [type v] to []\n\ndefine Set Type: (type) Costume: (costume) Width: (width) Height: (height) Size: (size) HP: (health) Geo: (geo1) (geo5) (geo25)\nset [type v] to (type)\nset [costume v] to (costume)\nset [root costume v] to (costume)\nset [width v] to (width)\nset [height v] to (height)\nset [health v] to (health)\nset [geo held \(1\) v] to (geo1)\nset [geo held \(5\) v] to (geo5)\nset [geo held \(25\) v] to (geo25)\nset [x v] to ([floor v] of (((spawn index) - (1)) / (GRID HEIGHT)) )\nset [y v] to (((spawn index) - (1)) mod (GRID HEIGHT))\nset [x v] to (((x) * (32)) + (16))\nset [y v] to (((y) * (32)) + (height))\nset [angered v] to [0]\nset [start y v] to (y)\nset [start x v] to (x)\npoint in direction (90)\nset size to (size) %\npaint sprite\nif <<(EDITOR) > [0]> or <(frame) = []>> then\n    set [visible v] to [1]\nend\ncreate clone of (_myself_ v)\nset [visible v] to []\n\nwhen I receive [position enemy v]\nif <(type) > []> then\n    paint sprite\nend\nif <not <(type) = [corpse]>> then\n    if <(invulnerable) > [0]> then\n        change [invulnerable v] by (-1)\n    end\n    if <<(invulnerable) > [30]> and <(invulnerable) < [75]>> then\n        if <((invulnerable) mod (4)) < [2]> then\n            set [brightness v] effect to (0)\n        else\n            set [brightness v] effect to (30)\n        end\n    else\n        if <((invulnerable) mod (2)) < [1]> then\n            set [brightness v] effect to (0)\n        else\n            set [brightness v] effect to (30)\n        end\n    end\nend\nif <(visible) > [0]> then\n    if << [_object_hot spring_lever_lever -90_] contains (type)?> or < (type) contains [goam]?>> then\n        hide\n    else\n        show\n    end\nelse\n    hide\nend\n\ndefine Move Enemy\nif <(type) = []> then\n    hide\n    stop [this script v]\nend\nif <(type) = [flip]> then\n    change [x v] by (speed x)\n    change [speed y v] by (-1)\n    change [y v] by (speed y)\n    if <(y) < ((CAMERA Y) - (200))> then\n        delete this clone\n    end\n    stop [this script v]\nend\nif <(y) < [-40]> then\n    delete this clone\nend\nif <(type) = [corpse]> then\n    set [invulnerable v] to [0]\n    if <(speed y) > [-16]> then\n        change [speed y v] by (-1)\n    end\n    move sprite y\n    if <(falling) < [1]> then\n        set [speed x v] to [0]\n    end\n    move sprite x\n    change [frame v] by (1)\n    if <(angered) > [0]> then\n        if <((round (frame)) mod (2)) = [0]> then\n            change [angered v] by (-1)\n            change [costume v] by (1)\n        end\n    end\n    if <<(frame) < (width)> or <(frame) < [8]>> then\n        if <not <<(root costume) = [148]> or <(root costume) = [453]>>> then\n            repeat ([ceiling v] of ((((width) + (1)) * ((height) + (5))) / (200)) )\n                add [smoke] to [particles v]\n                add ((x) + (pick random ((0) - (width)) to (width))) to [particles v]\n                add ((y) + (pick random ((0) - (height)) to (height))) to [particles v]\n            end\n        end\n    end\n    paint sprite\n    if <(frame) > [100]> then\n        change [ghost v] effect by (5)\n    end\n    if <(frame) > [120]> then\n        delete this clone\n    end\n    stop [this script v]\nend\nif <(frame) < [0]> then\n    set [frame v] to [0]\n    if < (type) contains [husk]?> then\n        set [frame v] to (pick random (1) to (32))\n    end\nend\nCheck around enemy\nif <(type) = [crawlid]> then\n    Tick Crawlid\n    stop [this script v]\nend\nif <(type) = [vengefly]> then\n    Tick Vengefly\n    stop [this script v]\nend\nif <(type) = [geo]> then\n    Tick Geo Deposit\n    stop [this script v]\nend\nif <(type) = [cocoon]> then\n    Tick Cocoon\n    stop [this script v]\nend\nif <(type) = [lifeseed]> then\n    Tick Lifeseed\n    stop [this script v]\nend\nif <(type) = [object]> then\n    point in direction (90)\n    go to [back v] layer\n    go [forward v] ((LAYERS - BACKGROUND) + <not <(root costume) = [32]>>) layers\n    if <(root costume) = [230]> then\n        change [frame v] by (0.5)\n        set [costume v] to ((root costume) + (([floor v] of (frame) ) mod (6)))\n        paint sprite\n    end\nend\nif <(type) = [bench]> then\n    change [frame v] by (0.5)\n    point in direction (90)\n    go to [back v] layer\n    if <((frame) mod (2)) = [0]> then\n        if <<(distance to [player v]) < [100]> and <not <([player action v] of [player v]) = [sit]>>> then\n            add [dot] to [particles v]\n            add ((x) + (pick random (-20) to (20))) to [particles v]\n            add (y) to [particles v]\n        end\n    end\n    if <([up v] of [controls v]) = [1]> then\n        if <<not <([player action v] of [player v]) = [sit]>> and <touching (player v)?>> then\n            set [spawn x v] to (x)\n            set [spawn y v] to (y)\n            set [spawn level v] to (ROOM)\n            start sound [bench_rest v]\n            start sound [ui_save v]\n            broadcast (Sit on bench v)\n        end\n    end\n    stop [this script v]\nend\nif <(type) = [husk guard]> then\n    Tick Husk Guard\n    stop [this script v]\nend\nif < (type) contains [husk]?> then\n    Tick Husk\n    stop [this script v]\nend\nif <(type) = [tiktik]> then\n    Tick Tiktik\n    stop [this script v]\nend\nif <(type) = [gruzzer]> then\n    Tick Gruzzer\n    stop [this script v]\nend\nif <(type) = [aspid hunter]> then\n    Tick Aspid Hunter\n    stop [this script v]\nend\nif < (type) contains [goam]?> then\n    Tick Goam\n    stop [this script v]\nend\nif <(type) = [hot spring]> then\n    go to [back v] layer\n    go [forward v] (LAYERS - BACKGROUND) layers\n    if <(SOUL) < (MAX SOUL)> then\n        if <touching (player v)?> then\n            change [soul v] by (1)\n        end\n    end\n    stop [this script v]\nend\nif <(type) = [aspid mother]> then\n    Tick Aspid Mother\n    stop [this script v]\nend\nif <(type) = [aspid hatchling]> then\n    Tick Aspid Hatchling\n    stop [this script v]\nend\nif <(type) = [soul totem]> then\n    Tick Soul Totem\n    stop [this script v]\nend\nif < (type) contains [false knight]?> then\n    Tick False Knight\n    stop [this script v]\nend\nif < (type) contains [lever]?> then\n    Tick Lever\n    stop [this script v]\nend\nif <(type) = [acid]> then\n    if <touching (player v)?> then\n        broadcast (player - hurt - spikes v)\n    end\n    stop [this script v]\nend\nif <(type) = [shade]> then\n    Tick Shade\n    stop [this script v]\nend\n\nwhen I receive [move player after enemy v]\nif <<(type) = [flip]> or <(type) = []>> then\n    stop [this script v]\nend\nif <<(EDITOR) < [1]> and <(visible) = [1]>> then\n    show\n    if <(ARENA PROGRESS) = [0]> then\n        if <touching (entity v)?> then\n            if <not << [geo object aspid mother bench lever -90 cocoon] contains (type)?> or < (type) contains [goam]?>>> then\n                set [health v] to [0]\n                Take Damage\n                delete this clone\n            end\n        end\n    end\n    hide\nend\n\ndefine check around enemy at x: (x) y: (y)\nget tile at x: (x) y: (y)\nif <(tile) = [18]> then\n    set [health v] to [1]\n    Take Damage\n    delete this clone\nend\n\ndefine Check Below Feet\nget tile at x: ((x) - (16)) y: ((y) - ((height) + (8)))\nif <(tile shape) = []> then\n    set [speed x v] to [0]\n    turn right (180) degrees\n    set [special action v] to [turn]\n    set [special action timer v] to [1]\n    if <(type) = [lifeseed]> then\n        turn right (180) degrees\n        set [speed x v] to (((direction) / (90)) * (-5))\n    end\n    if <(type) = [tiktik]> then\n        turn left (90) degrees\n        set [speed x v] to [0]\n        set [speed y v] to [0]\n        set [special action v] to [turn left]\n        set [special action timer v] to [0]\n    else\n        change [x v] by ((direction) / (45))\n    end\n    stop [this script v]\nend\nget tile at x: ((x) + (16)) y: ((y) - ((height) + (8)))\nif <(tile shape) = []> then\n    set [speed x v] to [0]\n    turn right (180) degrees\n    if <(type) = [lifeseed]> then\n        turn right (180) degrees\n        set [speed x v] to (((direction) / (90)) * (-5))\n    end\n    if <(type) = [tiktik]> then\n        turn left (90) degrees\n        set [speed x v] to [0]\n        set [speed y v] to [0]\n    else\n        change [x v] by ((direction) / (45))\n    end\n    stop [this script v]\nend\n\nwhen I receive [hide fireballs v]\nif < (type) contains [ball]?> then\n    hide\n    stop [this script v]\nend\nif <(visible) > [0]> then\n    show\nend\n\ndefine Take Damage\nif <<not <(type) = [shade]>> and <<not < (type) contains [false knight]?>> or <(action) = [stagger]>>> then\n    broadcast (attacked enemy v)\nelse\n    broadcast (attacked object v)\nend\nif <not <(type) = [shade]>> then\n    start sound [enemy_damage v]\nend\nif <not <<(type) = [tiktik]> or < (type) contains [false knight]?>>> then\n    if <([player action v] of [player v]) = [look up]> then\n        set [temp v] to (speed y)\n        set [speed y v] to [2]\n        repeat (5)\n            move sprite y\n        end\n        set [speed y v] to (temp)\n    else\n        if <([player action v] of [player v]) = [crouch]> then\n            set [temp v] to (speed y)\n            set [speed y v] to [-2]\n            repeat (5)\n                move sprite y\n            end\n            set [speed y v] to (temp)\n        else\n            set [temp v] to (speed x)\n            if <([direction v] of [player v]) > [0]> then\n                set [speed x v] to [2]\n                if <(type) = [shade]> then\n                    set [speed x v] to [4]\n                end\n            else\n                set [speed x v] to [-2]\n                if <(type) = [shade]> then\n                    set [speed x v] to [-4]\n                end\n            end\n            repeat (5)\n                move sprite x\n            end\n            set [speed x v] to (temp)\n        end\n    end\nend\nchange [health v] by (-5)\nset [invulnerable v] to [10]\nadd [nail impact big] to [particles v]\nadd (x) to [particles v]\nadd (y) to [particles v]\nif <(health) < [1]> then\n    if <(type) = [shade]> then\n        repeat (60)\n            add [radial black puff] to [particles v]\n            add ((x) + (pick random (-10) to (10))) to [particles v]\n            add ((y) + (pick random (-10) to (10))) to [particles v]\n        end\n    else\n        repeat (pick random ([floor v] of (((width) * ((height) + (5))) / (60)) ) to ([floor v] of (((width) * ((height) + (5))) / (40)) ))\n            add [small radial smoke] to [particles v]\n            add (x) to [particles v]\n            add (y) to [particles v]\n        end\n    end\n    repeat (geo held \(1\))\n        add [2] to [geo drops v]\n        add ((x) + (pick random ((0) - (width)) to (width))) to [geo drops v]\n        add (y) to [geo drops v]\n        add [10] to [geo drops v]\n    end\n    repeat (geo held \(5\))\n        add [6] to [geo drops v]\n        add ((x) + (pick random ((0) - (width)) to (width))) to [geo drops v]\n        add (y) to [geo drops v]\n        add [8] to [geo drops v]\n    end\n    repeat (geo held \(25\))\n        add [10] to [geo drops v]\n        add ((x) + (pick random ((0) - (width)) to (width))) to [geo drops v]\n        add (y) to [geo drops v]\n        add [6] to [geo drops v]\n    end\nend\n\ndefine Tick Vengefly\nchange [frame v] by (0.5)\nif <(x) > ([x v] of [player v])> then\n    point in direction (-90)\nelse\n    point in direction (90)\nend\npoint towards (player v)\nif <((frame) mod (16)) = [0]> then\n    start sound [buzzer_fly v]\nend\nswitch costume to (vengefly-fov1 v)\nif <touching (player v)?> then\n    set [angered v] to [1]\nelse\n    switch costume to (vengefly-fov2 v)\n    if <touching (player v)?> then\n        if <(angered) = [0]> then\n            start sound [buzzer_startle_02 v]\n            set [special action v] to [startle]\n            set [special action timer v] to [3]\n        end\n        set [angered v] to [2]\n    end\nend\nif <(angered) > [0]> then\n    Accelerate y [0.1] Max: (angered) Direction: (([y v] of [player v]) - (y))\n    move sprite y\n    Accelerate x [0.1] Max: ((angered) + (1)) Direction: (direction)\n    move sprite x\nend\nif <(special action) = [startle]> then\n    set [costume v] to (((root costume) + (12)) - (special action timer))\n    Decrease Special Action Timer [1]\nelse\n    if <(angered) > [0]> then\n        set [costume v] to (((root costume) + (4)) + ([floor v] of ((frame) mod (5)) ))\n    else\n        set [costume v] to ((root costume) + ([floor v] of ((frame) mod (4)) ))\n    end\nend\npaint sprite\nif <(invulnerable) < [1]> then\n    if <touching (nail v)?> then\n        Take Damage\n        repeat (pick random (3) to (5))\n            add [infection blip] to [particles v]\n            add (x) to [particles v]\n            add (y) to [particles v]\n        end\n        if <(health) < [1]> then\n            Die with corpse: ((root costume) + (13)) frames: [1]\n        end\n    end\nend\nif <touching (player v)?> then\n    if <(direction) > [0]> then\n        set [player knockback v] to [9]\n    else\n        set [player knockback v] to [-9]\n    end\n    broadcast (player - hurt v)\nend\n\ndefine Tick Geo Deposit\nif <[game data v] contains (join (join [gr ] (join (x) [ ])) (join (y) (join [ ] (ROOM))))?> then\n    delete this clone\nend\nchange [frame v] by (1)\nset [speed x v] to [0]\nmove sprite x\nset [speed y v] to [0]\nmove sprite y\npaint sprite\nif <(costume) = [Geo Broken]> then\n    stop [this script v]\nend\nif <(invulnerable) < [1]> then\n    if <touching (nail v)?> then\n        Hit Georock\n        if <(health) < [1]> then\n            start sound [geo_rock_hit_2 v]\n            switch costume to (geo broken v)\n            set [costume v] to [Geo Broken]\n        end\n    end\nend\n\ndefine Hit Georock\nbroadcast (attacked object v)\nstart sound [geo_rock_hit_1 v]\nif <not <([direction v] of [player v]) = (direction)>> then\n    set [speed x v] to [0]\nend\nchange [health v] by (-1)\nset [invulnerable v] to [10]\nrepeat (pick random (1) to (4))\n    change [geo held \(1\) v] by (-1)\n    add [2] to [geo drops v]\n    add ((x) + (pick random ((0) - (width)) to (width))) to [geo drops v]\n    add (y) to [geo drops v]\n    add [16] to [geo drops v]\nend\nif <(health) < [1]> then\n    repeat (geo held \(1\))\n        add [2] to [geo drops v]\n        add ((x) + (pick random ((0) - (width)) to (width))) to [geo drops v]\n        add (y) to [geo drops v]\n        add [16] to [geo drops v]\n    end\n    repeat (geo held \(5\))\n        add [6] to [geo drops v]\n        add ((x) + (pick random ((0) - (width)) to (width))) to [geo drops v]\n        add (y) to [geo drops v]\n        add [13] to [geo drops v]\n    end\n    repeat (geo held \(25\))\n        add [10] to [geo drops v]\n        add ((x) + (pick random ((0) - (width)) to (width))) to [geo drops v]\n        add (y) to [geo drops v]\n        add [10] to [geo drops v]\n    end\n    add (join (join [gr ] (join (x) [ ])) (join (y) (join [ ] (ROOM)))) to [game data v]\nend\n\ndefine Tick Lifeseed\nchange [frame v] by (0.5)\nAccelerate y [0.25] Max: [10] Direction: [-1]\nmove sprite y\nif <(falling) > [1]> then\n    Accelerate x [0.25] Max: [1] Direction: (direction)\nelse\n    Accelerate x [0.5] Max: [6] Direction: (direction)\nend\nmove sprite x\nif <(falling) > [1]> then\n    set [costume v] to (((root costume) + (4)) + (([floor v] of (frame) ) mod (6)))\nelse\n    set [costume v] to ((root costume) + (([floor v] of (frame) ) mod (4)))\nend\npaint sprite\nif <<touching (nail v)?> and <(invulnerable) < [1]>> then\n    broadcast (Lifeblood glow v)\n    change [lifeblood health v] by (1)\n    start sound [splat_01 v]\n    Die with corpse: ((root costume) + (18)) frames: [2]\nend\n\ndefine Tick Husk\nchange [frame v] by (0.5)\nAccelerate y [1] Max: [20] Direction: [-1]\nmove sprite y\nif <((frame) mod (40)) < [20]> then\n    set [action v] to [walk]\n    Accelerate x [0.2] Max: [0.8] Direction: (direction)\n    if <((round (((frame) mod (8)) * (10))) / (10)) = [0.2]> then\n        start sound [zombie_five_footstep v]\n    end\nelse\n    set [action v] to [idle]\n    set [speed x v] to [0]\n    if <<((round (((frame) mod (8)) * (10))) / (10)) = [0.2]> and <(angered) > [0]>> then\n        start sound [zombie_five_footstep v]\n    end\nend\nif <(angered) < [60]> then\n    switch costume to (join (type) [-FOV])\n    if <touching (player v)?> then\n        change [angered v] by (1)\n        if <(angered) < [50]> then\n            if <(type) = [leaping husk]> then\n                set [action v] to [jump]\n            else\n                if <(type) = [husk bully]> then\n                    set [action v] to [charge]\n                else\n                    set [action v] to [run]\n                end\n            end\n            if <(angered) = [0]> then\n                start sound (join [zombie_chase_] (pick random (1) to (2)))\n                if <not <(action) = [jump]>> then\n                    if <(type) = [wandering husk]> then\n                        set [special action v] to [startle]\n                        set [special action timer v] to [5]\n                    end\n                end\n            end\n            if <(angered) = [1]> then\n                if <(x) > ([x v] of [player v])> then\n                    if <(direction) = [90]> then\n                        if <(special action) = []> then\n                            set [special action v] to [turn]\n                            set [special action timer v] to [1]\n                        end\n                    end\n                    point in direction (-90)\n                else\n                    if <(direction) = [-90]> then\n                        if <(special action) = []> then\n                            set [special action v] to [turn]\n                            set [special action timer v] to [1]\n                        end\n                    end\n                    point in direction (90)\n                end\n                if <(type) = [husk hornhead]> then\n                    set [special action v] to [startle]\n                    set [special action timer v] to [2]\n                end\n                if <(type) = [leaping husk]> then\n                    set [special action v] to [startle]\n                    set [special action timer v] to [2]\n                end\n                if <(type) = [husk bully]> then\n                    set [special action v] to [startle]\n                    set [special action timer v] to [5]\n                end\n            end\n            if <(type) = [leaping husk]> then\n                if <<(solid) > [0]> and <(falling) = [0]>> then\n                    set [speed y v] to [11]\n                end\n            else\n                if <(type) = [husk hornhead]> then\n                    set [speed x v] to ((direction) / (30))\n                else\n                    if <(type) = [husk bully]> then\n                        set [speed x v] to ((direction) / (22.5))\n                    else\n                        set [speed x v] to ((direction) / (45))\n                    end\n                end\n            end\n        end\n    else\n        if <(distance to [player v]) < [300]> then\n            if <(angered) > [-1]> then\n                set [angered v] to [51]\n            end\n        else\n            set [angered v] to [-1]\n        end\n    end\nelse\n    set [angered v] to [0]\nend\nif <(special action) = [startle]> then\n    if <not <(type) = [husk hornhead]>> then\n        set [speed x v] to [0]\n    end\n    if <(type) = [leaping husk]> then\n        if <(falling) < [1]> then\n            set [speed y v] to [0]\n        end\n    end\nend\nif <<(type) = [leaping husk]> and <(falling) > [0]>> then\n    set [action v] to [jump]\n    set [speed x v] to ((direction) / (30))\nend\nmove sprite x\nif <(special action) > []> then\n    if <(special action) = [turn]> then\n        if <(type) = [leaping husk]> then\n            set [costume v] to (((root costume) + (26)) - (special action timer))\n        else\n            if <(type) = [husk bully]> then\n                set [costume v] to (((root costume) + (22)) - (special action timer))\n            else\n                set [costume v] to (((root costume) + (18)) - (special action timer))\n            end\n        end\n    end\n    if <(special action) = [startle]> then\n        set [speed x v] to [0]\n        if <(type) = [husk hornhead]> then\n            set [costume v] to (((root costume) + (21)) - (special action timer))\n        else\n            if <(type) = [husk bully]> then\n                set [costume v] to (((root costume) + (20)) - (special action timer))\n                if <(special action timer) < [1]> then\n                    set [angered v] to [42]\n                end\n            else\n                set [costume v] to (((root costume) + (24)) - (special action timer))\n            end\n        end\n    end\n    Decrease Special Action Timer [1.25]\nelse\n    if <(action) = [idle]> then\n        set [costume v] to ((root costume) + ([floor v] of ((frame) mod (6)) ))\n    else\n        if <(action) = [walk]> then\n            set [costume v] to (((root costume) + (6)) + ([floor v] of ((frame) mod (7)) ))\n        else\n            if <(action) = [run]> then\n                set [costume v] to (((root costume) + (13)) + ([floor v] of ((frame) mod (4)) ))\n            else\n                if <(action) = [jump]> then\n                    if <(falling) > [14]> then\n                        set [costume v] to ((root costume) + (19))\n                    else\n                        set [costume v] to (((root costume) + (13)) + ([floor v] of ((falling) / (2)) ))\n                    end\n                else\n                    if <(action) = [charge]> then\n                        set [costume v] to (((root costume) + (13)) + ([floor v] of (((angered) - (45)) / (2)) ))\n                        if <(costume) > ((root costume) + (15))> then\n                            set [costume v] to ((root costume) + (15))\n                        end\n                        if <(costume) < ((root costume) + (13))> then\n                            set [costume v] to ((root costume) + (13))\n                        end\n                    else\n                        set [costume v] to (root costume)\n                    end\n                end\n            end\n        end\n    end\nend\npaint sprite\nif <(invulnerable) < [1]> then\n    if <touching (nail v)?> then\n        Take Damage\n        repeat (pick random (4) to (6))\n            add [infection blip] to [particles v]\n            add (x) to [particles v]\n            add (y) to [particles v]\n        end\n        set [speed x v] to [0]\n        if <(health) < [1]> then\n            start sound [zombie_death v]\n            if <(type) = [leaping husk]> then\n                Die with corpse: ((root costume) + (27)) frames: [3]\n                set [height v] to [4]\n                stop [this script v]\n            else\n                if <(type) = [husk hornhead]> then\n                    Die with corpse: ((root costume) + (22)) frames: [5]\n                    stop [this script v]\n                else\n                    if <(type) = [wandering husk]> then\n                        Die with corpse: ((root costume) + (25)) frames: [5]\n                        stop [this script v]\n                    else\n                        if <(type) = [husk bully]> then\n                            Die with corpse: ((root costume) + (23)) frames: [3]\n                            stop [this script v]\n                        else\n                            Die with corpse: (root costume) frames: [0]\n                        end\n                    end\n                end\n            end\n        end\n        if <<(type) = [husk hornhead]> or <(type) = [husk bully]>> then\n            set [angered v] to [55]\n        else\n            if <(type) = [wandering husk]> then\n                set [angered v] to [50]\n            end\n        end\n    end\nend\nif <touching (player v)?> then\n    if <(direction) > [0]> then\n        set [player knockback v] to [9]\n    else\n        set [player knockback v] to [-9]\n    end\n    broadcast (player - hurt v)\nend\n\ndefine Tick Tiktik\nset rotation style [all around v]\nif <(direction) = [90]> then\n    Accelerate y [1] Max: [20] Direction: [-1]\n    move sprite y\n    Accelerate x [0.1] Max: [1] Direction: [1]\n    move sprite x\n    if <(speed y) < [-3]> then\n        turn right (90) degrees\n        set [speed x v] to [0]\n        set [speed y v] to [0]\n        set [special action v] to [turn right]\n        set [special action timer v] to [0]\n    end\nend\nif <(direction) = [-90]> then\n    Accelerate y [1] Max: [20] Direction: [1]\n    move sprite y\n    Accelerate x [0.1] Max: [1] Direction: [-1]\n    move sprite x\n    if <(speed y) > [3]> then\n        turn right (90) degrees\n        set [speed x v] to [0]\n        set [speed y v] to [0]\n        set [special action v] to [turn right]\n        set [special action timer v] to [0]\n    end\nend\nif <(direction) = [180]> then\n    Accelerate x [1] Max: [20] Direction: [-1]\n    move sprite x\n    Accelerate y [0.1] Max: [1] Direction: [-1]\n    move sprite y\n    if <(speed x) < [-3]> then\n        turn right (90) degrees\n        set [speed x v] to [0]\n        set [speed y v] to [0]\n        set [special action v] to [turn right]\n        set [special action timer v] to [0]\n    end\nend\nif <(direction) = [0]> then\n    Accelerate x [1] Max: [20] Direction: [1]\n    move sprite x\n    Accelerate y [0.1] Max: [1] Direction: [1]\n    move sprite y\n    if <(speed x) > [3]> then\n        turn right (90) degrees\n        set [speed x v] to [0]\n        set [speed y v] to [0]\n        set [special action v] to [turn right]\n        set [special action timer v] to [0]\n    end\nend\nchange [frame v] by (0.25)\nif <(special action) > []> then\n    if <(special action) = [turn right]> then\n        set [costume v] to ((root costume) + (2))\n    else\n        set [costume v] to ((root costume) + (3))\n    end\n    Decrease Special Action Timer [2]\nelse\n    set [costume v] to ((root costume) + ([floor v] of ((frame) mod (2)) ))\nend\npaint sprite\nif <((frame) mod (7)) = [0]> then\n    start sound [climer v]\nend\nif <(invulnerable) < [1]> then\n    if <touching (nail v)?> then\n        Take Damage\n        if <(health) < [1]> then\n            Die with corpse: ((root costume) + (4)) frames: [2]\n        end\n    end\nend\nif <touching (player v)?> then\n    set [player knockback v] to ((direction) / (10))\n    broadcast (player - hurt v)\nend\n\ndefine Tick Gruzzer\nif <(action) = [90]> then\n    set [action v] to [91]\nend\nif <(round ((action) / (90))) = [1]> then\n    point in direction (90)\n    set [speed x v] to [1.5]\nelse\n    point in direction (-90)\n    set [speed x v] to [-1.5]\nend\nmove sprite x\nif <(speed x) = [0]> then\n    set [action v] to ((0) - (action))\nend\nif <([abs v] of ((action) / (90)) ) > [1]> then\n    set [speed y v] to [1.5]\nelse\n    set [speed y v] to [-1.5]\nend\nmove sprite y\nif <(speed y) = [0]> then\n    if <(action) = [-89]> then\n        set [action v] to [-91]\n        stop [this script v]\n    end\n    if <(action) = [-91]> then\n        set [action v] to [-89]\n        stop [this script v]\n    end\n    if <(action) = [89]> then\n        set [action v] to [91]\n        stop [this script v]\n    end\n    if <(action) = [91]> then\n        set [action v] to [89]\n        stop [this script v]\n    end\nend\nchange [frame v] by (0.4)\nset [costume v] to ((root costume) + ([floor v] of ((frame) mod (4)) ))\npaint sprite\nif <(invulnerable) < [1]> then\n    if <touching (nail v)?> then\n        Take Damage\n        if <(health) < [1]> then\n            Die with corpse: ((root costume) + (4)) frames: [5]\n        end\n    end\nend\nif <touching (player v)?> then\n    if <(direction) > [0]> then\n        set [player knockback v] to [9]\n    else\n        set [player knockback v] to [-9]\n    end\n    broadcast (player - hurt v)\nend\n\ndefine Check around enemy\ncheck around enemy at x: (x) y: ((y) - (12))\ncheck around enemy at x: (x) y: (y)\n\ndefine Die with corpse: (corpse costume) frames: (corpse frames)\nstart sound [enemy_death_sword v]\nswitch costume to (corpse costume)\nset [costume v] to (corpse costume)\nset [angered v] to (corpse frames)\nif <([direction v] of [player v]) = [90]> then\n    set [speed x v] to [4]\nelse\n    set [speed x v] to [-4]\nend\nset [speed y v] to [4]\nset [frame v] to [0]\nset [type v] to [corpse]\nif <(ARENA PROGRESS) > [0]> then\n    if <not <(type) = [shade]>> then\n        change [arena progress v] by (-1)\n        if <(ARENA PROGRESS) = [0]> then\n            add (join [are] (ROOM)) to [game data v]\n            start sound [gate_open v]\n            broadcast (Finish Arena v)\n        end\n    end\nend\n\nwhen I start as a clone\nif <(type) = [gruzzer]> then\n    set [action v] to [90]\nend\nif < (type) contains [husk]?> then\n    set [angered v] to [-1]\nend\nif < (type) contains [goam]?> then\n    set rotation style [all around v]\n    if < (type) contains [goam 90]?> then\n        change [x v] by (16)\n        point in direction (90)\n    end\n    if < (type) contains [goam 0]?> then\n        change [y v] by (0)\n        change [x v] by (-16)\n        point in direction (0)\n    end\n    if < (type) contains [goam 180]?> then\n        change [y v] by (0)\n        change [x v] by (16)\n        point in direction (180)\n    end\n    if < (type) contains [goam -90]?> then\n        change [x v] by (16)\n        point in direction (-90)\n    end\n    if < (type) contains [in]?> then\n        set [frame v] to [12]\n    end\nend\nif <(type) = [hot spring]> then\n    change [y v] by (16)\nend\nif < (type) contains [aspid]?> then\n    set [angered v] to []\n    set [visible v] to [1]\n    if <(type) = [aspid hatchling]> then\n        set [health v] to [1]\n        set [geo held \(1\) v] to [0]\n        set [geo held \(5\) v] to [0]\n        set [root costume v] to [253]\n        set [height v] to [2]\n        set [width v] to [2]\n        set size to (80) %\n    end\nend\nif < (type) contains [lever]?> then\n    set [action v] to [unflipped]\n    if <(type) = [lever -90]> then\n        set rotation style [all around v]\n        point in direction (-90)\n        change [x v] by (-16)\n        change [y v] by (-4)\n    else\n        change [y v] by (4)\n    end\nend\nif < (type) contains [false knight]?> then\n    set [text v] to [FALSE KNIGHT]\n    broadcast (New title v)\nend\n\ndefine Accelerate x (acc) Max: (max) Direction: (dir)\nif <(dir) > [0]> then\n    if <(speed x) < (max)> then\n        change [speed x v] by (acc)\n    else\n        change [speed x v] by ((0) - (acc))\n        if <(speed x) < [0]> then\n            set [speed x v] to [0]\n        end\n    end\nelse\n    if <(speed x) > ((0) - (max))> then\n        change [speed x v] by ((0) - (acc))\n    else\n        change [speed x v] by (acc)\n        if <(speed x) > [0]> then\n            set [speed x v] to [0]\n        end\n    end\nend\n\ndefine Accelerate y (acc) Max: (max) Direction: (dir)\nif <(dir) > [0]> then\n    if <(speed y) < (max)> then\n        change [speed y v] by (acc)\n    else\n        change [speed y v] by ((0) - (acc))\n        if <(speed y) < [0]> then\n            set [speed y v] to [0]\n        end\n    end\nelse\n    if <(speed y) > ((0) - (max))> then\n        change [speed y v] by ((0) - (acc))\n    else\n        change [speed y v] by (acc)\n        if <(speed y) > [0]> then\n            set [speed y v] to [0]\n        end\n    end\nend\n\ndefine Tick Aspid Hunter\nchange [frame v] by (0.5)\nif <(x) > ([x v] of [player v])> then\n    point in direction (-90)\nelse\n    point in direction (90)\nend\nif <(distance to [player v]) > [240]> then\n    if <(angered) = []> then\n        set [action v] to [still]\n    end\nelse\n    if <(angered) = []> then\n        set [angered v] to [-1]\n    end\n    switch costume to (aspid hunter-fov-right v)\n    if <touching (player v)?> then\n        set [action v] to [right up]\n    else\n        switch costume to (aspid hunter-fov-left v)\n        if <touching (player v)?> then\n            if <((y) - ([y v] of [player v])) > [80]> then\n                set [action v] to [left down]\n            else\n                set [action v] to [left up]\n            end\n        else\n            if <(distance to [player v]) > [160]> then\n                if <((y) - ([y v] of [player v])) > [160]> then\n                    set [action v] to [down]\n                else\n                    if <((x) - ([x v] of [player v])) > [220]> then\n                        set [action v] to [left]\n                    else\n                        if <(([x v] of [player v]) - (x)) > [220]> then\n                            set [action v] to [right]\n                        else\n                            set [action v] to [in range]\n                            if <(angered) = [-1]> then\n                                set [angered v] to [20]\n                            end\n                            change [angered v] by (1)\n                        end\n                    end\n                end\n            else\n                set [action v] to [in range]\n                if <(angered) = [-1]> then\n                    set [angered v] to [20]\n                end\n                change [angered v] by (1)\n            end\n        end\n    end\nend\nif < (action) contains [right]?> then\n    Accelerate x [0.2] Max: [2] Direction: (direction)\n    move sprite x\nend\nif < (action) contains [left]?> then\n    Accelerate x [0.2] Max: [2] Direction: ((0) - (direction))\n    move sprite x\nend\nif < (action) contains [up]?> then\n    Accelerate y [0.2] Max: [2] Direction: [1]\n    move sprite y\nend\nif < (action) contains [down]?> then\n    Accelerate y [0.2] Max: [2] Direction: [-1]\n    move sprite y\nend\nif <(action) = [in range]> then\n    if <not <([abs v] of (speed x) ) > [0.1]>> then\n        set [speed x v] to [0]\n    else\n        change [speed x v] by (((speed x) / ([abs v] of (speed x) )) * (-0.1))\n    end\n    move sprite x\n    if <not <([abs v] of (speed y) ) > [0.1]>> then\n        set [speed y v] to [0]\n    else\n        change [speed y v] by (((speed y) / ([abs v] of (speed y) )) * (-0.1))\n    end\n    move sprite y\nelse\n    if <(angered) > [37]> then\n        change [angered v] by (1)\n    else\n        set [angered v] to [-1]\n    end\nend\nif <(angered) > [40]> then\n    start sound [spitter_spit v]\n    add [infection shot] to [particles v]\n    add (x) to [particles v]\n    add (y) to [particles v]\n    set [angered v] to [0]\nend\nif <(angered) = [38]> then\n    set [special action v] to [fire]\n    set [special action timer v] to [4]\nend\nif <(action) = [still]> then\n    set [speed x v] to [0]\n    set [speed y v] to [0]\nend\nif <(special action) > []> then\n    set [costume v] to (((root costume) + (8)) - (special action timer))\n    Decrease Special Action Timer [1]\nelse\n    set [costume v] to ((root costume) + (([floor v] of (frame) ) mod (4)))\nend\npaint sprite\nif <((round (frame)) mod (92)) = [0]> then\n    start sound [spitter_fly_loop v]\nend\nif <(invulnerable) < [1]> then\n    if <touching (nail v)?> then\n        Take Damage\n        if <(health) < [1]> then\n            Die with corpse: ((root costume) + (9)) frames: [6]\n        end\n    end\nend\nif <touching (player v)?> then\n    broadcast (player - hurt v)\nend\n\ndefine Decrease Special Action Timer (modifier)\nif <(round (((frame) * (modifier)) mod (1))) = [0]> then\n    change [special action timer v] by (-1)\n    if <(special action timer) < [0]> then\n        set [special action v] to []\n    end\nend\n\ndefine Tick Goam\ngo to [back v] layer\ngo [forward v] (LAYERS - BACKGROUND) layers\nset [visible v] to [2]\nchange [frame v] by (0.25)\nif <<((frame) mod (24)) < [11]> and <((frame) mod (24)) > [1]>> then\n    if <((frame) mod (24)) = [3]> then\n        start sound [worm v]\n    end\n    switch costume to (goam-hitbox1 v)\n    if <touching (player v)?> then\n        broadcast (player - hurt v)\n    end\n    set [costume v] to ((root costume) + (([floor v] of ((frame) * (2)) ) mod (4)))\nelse\n    if <<((frame) mod (24)) > [13]> and <((frame) mod (24)) < [23]>> then\n        if <((frame) mod (24)) = [15]> then\n            start sound [worm v]\n        end\n        set [costume v] to ((root costume) + (8))\n    else\n        if <<((frame) mod (24)) > [6]> and <((frame) mod (24)) < [18]>> then\n            set [costume v] to (((root costume) + (4)) + (([floor v] of ((frame) - (11)) ) mod (24)))\n        else\n            set [costume v] to (((root costume) + (8)) - (([floor v] of ((frame) - (23)) ) mod (24)))\n        end\n    end\nend\npaint sprite\nif <([nail stage v] of [nail v]) = [4]> then\n    if <touching (nail v)?> then\n        start sound [sword_hit_reject v]\n        broadcast (attacked object v)\n    end\nend\n\ndefine Tick Aspid Mother\nchange [frame v] by (0.5)\nset [visible v] to [1]\nif <([x v] of [player v]) < (x)> then\n    point in direction (-90)\nelse\n    point in direction (90)\nend\nif <(distance to [player v]) > [150]> then\n    if <(angered) = []> then\n        set [action v] to [still]\n    else\n        set [action v] to [fly towards]\n    end\nelse\n    if <(angered) = []> then\n        set [angered v] to [-1]\n    end\n    if <(distance to [player v]) < [100]> then\n        set [action v] to [fly away]\n    else\n        set [action v] to [in range]\n    end\nend\nif <(action) = [fly away]> then\n    Accelerate x [0.25] Max: [1] Direction: ((0) - (direction))\n    Accelerate y [0.25] Max: [1] Direction: ((y) - ([y v] of [player v]))\nend\nif <(action) = [fly towards]> then\n    Accelerate x [0.25] Max: [1] Direction: (direction)\n    Accelerate y [0.25] Max: [1] Direction: (([y v] of [player v]) - (y))\nend\nif <(action) = [in range]> then\n    Accelerate x [0.1] Max: [0] Direction: (direction)\n    Accelerate y [0.1] Max: [0] Direction: (([abs v] of (speed y) ) / (speed y))\nend\nmove sprite x\nmove sprite y\nif <(angered) > []> then\n    if <not <(action) = [fly towards]>> then\n        if <(angered) = [-1]> then\n            set [angered v] to [20]\n        else\n            change [angered v] by (1)\n        end\n    else\n        if <(angered) < [34]> then\n            set [angered v] to [-1]\n        end\n    end\nend\nif <(angered) = [34]> then\n    set [special action v] to [hatch]\n    set [special action timer v] to [7]\nend\nif <(angered) = [40]> then\n    set [angered v] to [0]\n    set [type v] to [aspid hatchling]\n    change [y v] by (-12)\n    create clone of (_myself_ v)\n    set [type v] to [aspid mother]\n    change [y v] by (12)\nend\nif <(special action) > []> then\n    set [costume v] to (((root costume) + (11)) - (special action timer))\n    Decrease Special Action Timer [1]\nelse\n    set [costume v] to ((root costume) + (([floor v] of (frame) ) mod (4)))\nend\npaint sprite\nif <touching (player v)?> then\n    broadcast (player - hurt v)\nend\nif <touching (nail v)?> then\n    if <(invulnerable) < [1]> then\n        Take Damage\n        if <(health) < [1]> then\n            set [type v] to [aspid hatchling]\n            change [x v] by (-4)\n            change [y v] by (-4)\n            create clone of (_myself_ v)\n            change [y v] by (-4)\n            change [x v] by (8)\n            create clone of (_myself_ v)\n            change [x v] by (-4)\n            change [y v] by (8)\n            set [type v] to [aspid mother]\n            Die with corpse: ((root costume) + (12)) frames: [3]\n        end\n    end\nend\n\ndefine Tick Aspid Hatchling\nchange [frame v] by (0.5)\nif <(x) > ([x v] of [player v])> then\n    point in direction (-90)\nelse\n    point in direction (90)\nend\nAccelerate y [0.1] Max: [1] Direction: (([y v] of [player v]) - (y))\nmove sprite y\nAccelerate x [0.1] Max: [1] Direction: (direction)\nmove sprite x\nset [costume v] to ((root costume) + ([floor v] of ((frame) mod (4)) ))\npaint sprite\nif <touching (player v)?> then\n    if <(direction) > [0]> then\n        set [player knockback v] to [6]\n    else\n        set [player knockback v] to [-6]\n    end\n    broadcast (player - hurt v)\nend\nif <(invulnerable) < [1]> then\n    if <touching (nail v)?> then\n        Take Damage\n        if <(health) < [1]> then\n            Die with corpse: ((root costume) + (6)) frames: [4]\n        end\n    end\nend\n\ndefine Tick Soul Totem\nchange [frame v] by (1)\nif <(health) < [1]> then\n    set [costume v] to (root costume)\nelse\n    if <(distance to [player v]) < [100]> then\n        if <touching (nail v)?> then\n            if <(costume) < ((root costume) + (2))> then\n                change [soul v] by (12)\n                start sound [soul_totem_slash v]\n                change [health v] by (-1)\n                repeat (10)\n                    add [dot] to [particles v]\n                    add ((x) + (pick random (-10) to (10))) to [particles v]\n                    add ((y) - (pick random (0) to (12))) to [particles v]\n                end\n            end\n            set [costume v] to ((root costume) + (2))\n        else\n            set [costume v] to ((root costume) + (1))\n        end\n        if <((frame) mod (6)) = [0]> then\n            add [dot] to [particles v]\n            add ((x) + (pick random (-10) to (10))) to [particles v]\n            add ((y) - (16)) to [particles v]\n        end\n    else\n        set [costume v] to (root costume)\n    end\nend\n\ndefine Tick Husk Guard\nchange [frame v] by (0.5)\nif <(angered) = [-1]> then\n    switch costume to (huskguard-fov1 v)\n    if <touching (player v)?> then\n        start sound [zombie_guard_awake v]\n        set [special action v] to [startle]\n        set [special action timer v] to [3]\n        set [angered v] to [1]\n        set [action music v] to [1]\n    end\nend\nAccelerate y [1] Max: [16] Direction: [-1]\nmove sprite y\nif <(angered) < [1]> then\n    set [costume v] to ((root costume) + (([floor v] of (frame) ) mod (8)))\n    paint sprite\n    set [action music v] to [0]\n    stop [this script v]\nend\nif <not <<(special action) = [club]> or <<(special action) = [turn]> or <(special action) = [startle]>>>> then\n    if <<<(x) < ([x v] of [player v])> and <not <(action) = [walk]>>> or <<(x) > ([x v] of [player v])> and <(action) = [walk]>>> then\n        if <(direction) < [0]> then\n            point in direction (90)\n            set [special action v] to [turn]\n            set [special action timer v] to [1]\n        end\n    else\n        if <(direction) > [0]> then\n            point in direction (-90)\n            set [special action v] to [turn]\n            set [special action timer v] to [1]\n        end\n    end\nend\nif <(angered) > [0]> then\n    switch costume to (huskguard-fov2 v)\n    if <touching (player v)?> then\n        set [action music v] to [1]\n        set [action v] to [idle]\n        if <(angered) < [100]> then\n            set [angered v] to [100]\n        else\n            change [angered v] by (1)\n        end\n    else\n        switch costume to (huskguard-fov3 v)\n        if <not <touching (player v)?>> then\n            switch costume to (huskguard-fov1 v)\n            if <touching (player v)?> then\n                set [action music v] to [1]\n                if <(special action) = []> then\n                    if <not <(action) = [run]>> then\n                        set [special action v] to [start run]\n                        set [special action timer v] to [1]\n                    end\n                    if <(angered) > [1]> then\n                        change [angered v] by (-1)\n                    end\n                    set [action v] to [run]\n                    if <(angered) > [1]> then\n                        change [angered v] by (-1)\n                    end\n                end\n            else\n                set [action music v] to [0]\n                if <(action) = [run]> then\n                    if <(special action) = []> then\n                        set [special action v] to [end run]\n                        set [special action timer v] to [1]\n                    end\n                end\n                set [action v] to [idle]\n                if <(angered) > [1]> then\n                    change [angered v] by (-1)\n                end\n                if <(x) < ([x v] of [player v])> then\n                    if <(angered) < [50]> then\n                        if <((x) - (start x)) > [20]> then\n                            set [action v] to [walk]\n                        end\n                        if <((x) - (start x)) < [20]> then\n                            set [action v] to [idle]\n                        end\n                    end\n                else\n                    if <(angered) < [50]> then\n                        if <((x) - (start x)) < [20]> then\n                            set [action v] to [walk]\n                        end\n                        if <((x) - (start x)) > [20]> then\n                            set [action v] to [idle]\n                        end\n                    end\n                end\n            end\n        else\n            if <(action) = [run]> then\n                if <(special action) = []> then\n                    set [special action v] to [end run]\n                    set [special action timer v] to [1]\n                end\n            end\n            set [action v] to [idle]\n            if <(angered) > [1]> then\n                change [angered v] by (-1)\n            end\n        end\n    end\nelse\n    if <(action) = [run]> then\n        if <(special action) = []> then\n            set [special action v] to [end run]\n            set [special action timer v] to [1]\n        end\n    end\n    set [action v] to [idle]\n    set [angered v] to [1]\nend\nif <<(action) = [run]> and <(special action) = []>> then\n    Accelerate x [0.5] Max: [5] Direction: (direction)\n    if <(([floor v] of ((frame) * (2)) ) mod (6)) = [0]> then\n        start sound [zombie_guard_footstep v]\n    end\nelse\n    if <(action) = [walk]> then\n        Accelerate x [0.5] Max: [3] Direction: (direction)\n        if <(([floor v] of ((frame) * (2)) ) mod (8)) = [0]> then\n            start sound [zombie_guard_footstep v]\n        end\n    else\n        Accelerate x [0.5] Max: [0] Direction: (direction)\n    end\nend\nmove sprite x\nif <(angered) = [110]> then\n    if <(special action) = []> then\n        start sound (join [zombie_guard_club_prepare_] (pick random (1) to (2)))\n        if <(pick random (1) to (3)) = [1]> then\n            set [special action v] to [jump]\n            set [special action timer v] to [12]\n        else\n            set [special action v] to [club]\n            set [special action timer v] to [14]\n        end\n    end\nend\nif <(special action) > []> then\n    if <(special action) = [startle]> then\n        set [costume v] to (((root costume) + (56)) - (special action timer))\n    end\n    if <(special action) = [turn]> then\n        set [costume v] to (((root costume) + (58)) - (special action timer))\n    end\n    if <(special action) = [start run]> then\n        set [costume v] to (((root costume) + (60)) - (special action timer))\n    end\n    if <(special action) = [end run]> then\n        set [costume v] to (((root costume) + (59)) + (special action timer))\n    end\n    if <(special action) = [club]> then\n        set [costume v] to (((root costume) + (39)) - (special action timer))\n        if <(special action timer) = [4]> then\n            set [speed x v] to ((direction) / (-90))\n            set [screen shake v] to [12]\n            start sound [zombie_guard_club v]\n            add [enemy weapon impact] to [particles v]\n            add ((x) + (direction)) to [particles v]\n            add ((y) - (height)) to [particles v]\n            repeat (10)\n                add [rock] to [particles v]\n                add ((x) + (direction)) to [particles v]\n                add ((y) - (height)) to [particles v]\n            end\n        end\n        if <(special action timer) = [0]> then\n            set [angered v] to [100]\n        end\n    end\n    if <(special action) = [jump]> then\n        set [costume v] to (((root costume) + (52)) - (special action timer))\n        if <(special action timer) = [9]> then\n            set [speed x v] to ((direction) / (-10))\n            set [speed y v] to [5]\n        end\n        if <(special action timer) = [6]> then\n            set [screen shake v] to [10]\n            add [shockwave 90] to [particles v]\n            add (x) to [particles v]\n            add ((y) - ((height) + (4))) to [particles v]\n            add [shockwave -90] to [particles v]\n            add (x) to [particles v]\n            add ((y) - ((height) + (4))) to [particles v]\n            repeat (10)\n                add [rock] to [particles v]\n                add (x) to [particles v]\n                add ((y) - (height)) to [particles v]\n            end\n            start sound [zombie_guard_club v]\n        end\n        if <(special action timer) = [0]> then\n            set [angered v] to [100]\n        end\n    end\n    get tile at x: (x) y: ((y) - ((height) + (1)))\n    if <not <<<(special action) = [jump]> and <(special action timer) = [8]>> and <not <(tile shape) = [#]>>>> then\n        Decrease Special Action Timer [1]\n    end\nelse\n    if <(action) = [idle]> then\n        set [costume v] to ((root costume) + (([floor v] of (frame) ) mod (8)))\n    else\n        if <(action) = [walk]> then\n            set [costume v] to (((root costume) + (8)) + (([floor v] of (frame) ) mod (10)))\n        else\n            set [costume v] to (((root costume) + (18)) + (([floor v] of (frame) ) mod (6)))\n        end\n    end\nend\nif <<(special action) = [club]> and <(special action timer) = [4]>> then\n    switch costume to (huskguard-hitbox2 v)\n    if <touching (player v)?> then\n        broadcast (Player - hurt - double v)\n    end\nelse\n    switch costume to (huskguard-hitbox1 v)\n    if <touching (player v)?> then\n        broadcast (player - hurt v)\n    end\nend\nswitch costume to (huskguard-hitbox1 v)\nif <touching (nail v)?> then\n    if <(invulnerable) < [1]> then\n        Take Damage\n        if <(health) < [1]> then\n            start sound [zombie_guard_death v]\n            set [action music v] to [0]\n            Die with corpse: ((root costume) + (61)) frames: [8]\n            set [height v] to [24]\n        end\n    end\nend\npaint sprite\n\nwhen I receive [begin arena v]\nstart sound [gate_slam v]\nif <(ARENA PROGRESS) < [1]> then\n    set [screen shake v] to [15]\n    if <(ROOM) = [16]> then\n        set [arena progress v] to [2]\n        set [spawn index v] to [397]\n        spawn type [86]\n        set [spawn index v] to [491]\n        spawn type [86]\n    end\n    if <(ROOM) = [27]> then\n        set [arena progress v] to [1]\n        set [spawn index v] to [702]\n        spawn type [110]\n    end\n    set [type v] to []\nend\n\ndefine Tick False Knight\nAccelerate y [0.5] Max: [10] Direction: [-1]\nmove sprite y\nif <<(action) = [fall]> and <(falling) = [0]>> then\n    set [screen shake v] to [10]\n    set [action v] to [stagger]\n    set [special action v] to [stagger]\n    set [special action timer v] to [11]\nend\nif <not <<<(action) = [stagger]> or <<(action) = [death]> or <(action) = [fall]>>> or << (action) contains [rage]?> or <(action) = [dead]>>>> then\n    change [frame v] by (0.5)\n    if <(falling) = [0]> then\n        if <<(special action) = []> and <(action) = [idle]>> then\n            if <(x) > ([x v] of [player v])> then\n                point in direction (-90)\n            else\n                point in direction (90)\n            end\n        end\n        set [speed x v] to [0]\n        change [angered v] by (1)\n        if <(action) = [jump]> then\n            start sound [false_knight_land v]\n            set [special action v] to [land]\n            set [special action timer v] to [4]\n            set [screen shake v] to [10]\n            repeat (10)\n                add [rock] to [particles v]\n                add (x) to [particles v]\n                add ((y) - (height)) to [particles v]\n            end\n        end\n        if <(action) = [jump attack]> then\n            start sound [false_knight_land v]\n            start sound [false_knight_swing v]\n            set [special action v] to [attack]\n            set [special action timer v] to [6]\n            set [screen shake v] to [15]\n            repeat (15)\n                add [rock] to [particles v]\n                add ((x) + ((width) * ((direction) / (45)))) to [particles v]\n                add ((y) - (height)) to [particles v]\n            end\n            if < (type) contains [3]?> then\n                repeat (pick random (2) to (4))\n                    add [falling barrel] to [particles v]\n                    add (pick random (330) to (780)) to [particles v]\n                    add (pick random (700) to (780)) to [particles v]\n                end\n            end\n            if < (type) contains [4]?> then\n                Break FK Floor\n                set [action v] to [fall]\n                set [special action v] to [start fall]\n                set [special action timer v] to [2]\n            end\n        end\n        if <not < (type) contains [4]?>> then\n            set [action v] to [idle]\n        end\n    end\n    if <(angered) = [20]> then\n        if <not < (type) contains [4]?>> then\n            switch costume to (falseknight-fov1 v)\n            if <(pick random (1) to ((2) + <touching (player v)?>)) = [1]> then\n                set [special action v] to [ready attack]\n                set [special action timer v] to [12]\n            end\n        end\n    end\n    if <(angered) = [30]> then\n        if <not <(special action) = [ready attack]>> then\n            set [special action v] to [ready jump]\n            set [special action timer v] to [2]\n        end\n    end\n    if <(angered) = [45]> then\n        if <(special action) = [ready attack]> then\n            start sound [false_knight_swing v]\n            set [special action v] to [attack]\n            set [special action timer v] to [6]\n            set [previous attack v] to [slam]\n            if < (type) contains [2]?> then\n                repeat (pick random (2) to (3))\n                    add [falling barrel] to [particles v]\n                    add (pick random (330) to (780)) to [particles v]\n                    add (pick random (700) to (780)) to [particles v]\n                end\n            end\n            if < (type) contains [3]?> then\n                repeat (pick random (4) to (5))\n                    add [falling barrel] to [particles v]\n                    add (pick random (330) to (780)) to [particles v]\n                    add (pick random (700) to (780)) to [particles v]\n                end\n            end\n        end\n    end\n    if <(angered) = [36]> then\n        if <not <(special action) = [ready attack]>> then\n            if < (type) contains [4]?> then\n                set [speed y v] to [10]\n                set [speed x v] to (((700) - (x)) / (40))\n                set [angered v] to [0]\n                set [action v] to [jump attack]\n            else\n                switch costume to (falseknight-fov1 v)\n                if <touching (player v)?> then\n                    set [temp v] to [1]\n                else\n                    set [temp v] to [2]\n                end\n                if <<(pick random (1) to (2)) = [1]> and <not <(previous attack) = [jump]>>> then\n                    if <(temp) = [1]> then\n                        get tile at x: ((x) - (((width) + (1)) * ((direction) / (90)))) y: ((y) + (64))\n                        if <(tile shape) = [#]> then\n                            set [speed y v] to [10]\n                            set [speed x v] to ((direction) / (15))\n                            set [angered v] to [10]\n                            set [action v] to [jump]\n                        else\n                            set [speed y v] to [10]\n                            set [speed x v] to ((direction) / (-15))\n                            set [angered v] to [10]\n                            set [action v] to [jump]\n                        end\n                    else\n                        set [speed y v] to [10]\n                        set [speed x v] to ((([x v] of [player v]) - (x)) / (40))\n                        set [angered v] to [0]\n                        set [action v] to [jump]\n                    end\n                    set [previous attack v] to [jump]\n                else\n                    set [speed y v] to [10]\n                    set [speed x v] to (((([x v] of [player v]) - (x)) / (40)) - ((direction) / (45)))\n                    set [angered v] to [0]\n                    set [action v] to [jump attack]\n                    set [previous attack v] to [jump attack]\n                end\n            end\n            start sound [false_knight_jump v]\n        end\n    end\n    if <(angered) > [60]> then\n        set [angered v] to [0]\n    end\nelse\n    if <(action) = [stagger]> then\n        change [frame v] by (0.2)\n        set [angered v] to [0]\n        if <(falling) = [0]> then\n            set [speed x v] to [0]\n        end\n    else\n        if < (action) contains [rage]?> then\n            change [frame v] by (0.5)\n            if <(falling) = [0]> then\n                set [speed x v] to [0]\n                change [angered v] by (1)\n                if <(action) = [rage jump]> then\n                    set [special action v] to [land]\n                    set [special action timer v] to [4]\n                    set [action v] to [rage idle]\n                    start sound [false_knight_land v]\n                end\n            end\n            if <(special action) = [recover]> then\n                set [angered v] to [0]\n            end\n            if <(angered) = [14]> then\n                set [special action v] to [ready jump]\n                set [special action timer v] to [2]\n            end\n            if <(angered) = [20]> then\n                set [action v] to [rage jump]\n                set [speed y v] to [10]\n                set [speed x v] to (((560) - (x)) / (40))\n                change [angered v] by (1)\n                start sound [false_knight_jump v]\n            end\n            if <(angered) = [30]> then\n                set [special action v] to [ready attack]\n                set [special action timer v] to [12]\n                set [action v] to [rage]\n                set [frame v] to [2]\n                start sound [FKnight_Rage v]\n            end\n            if <(angered) > [30]> then\n                if <((angered) mod (8)) = [0]> then\n                    add [falling barrel] to [particles v]\n                    add (pick random (330) to (780)) to [particles v]\n                    add [780] to [particles v]\n                end\n            end\n            if <(angered) = [154]> then\n                set [action v] to [idle]\n                set [frame v] to [0]\n            end\n        else\n            if <not <(action) = [fall]>> then\n                change [frame v] by (0.5)\n                if <(action) = [death]> then\n                    set [screen shake v] to [6]\n                    add [radial smoke] to [particles v]\n                    add (x) to [particles v]\n                    add (y) to [particles v]\n                end\n                if <(frame) = [42]> then\n                    set [special action v] to [die]\n                    set [special action timer v] to [5]\n                    start sound [boss_explode v]\n                    set [screen shake v] to [30]\n                end\n            end\n        end\n    end\nend\nmove sprite x\nif <(special action) > []> then\n    if <(special action) = [ready jump]> then\n        set [costume v] to (((root costume) + (13)) - ([ceiling v] of (special action timer) ))\n        change [special action timer v] by (-0.5)\n    end\n    if <(special action) = [land]> then\n        set [costume v] to (((root costume) + (24)) - ([ceiling v] of (special action timer) ))\n        change [special action timer v] by (-0.5)\n    end\n    if <(special action) = [attack]> then\n        set [costume v] to (((root costume) + (37)) - ([ceiling v] of (special action timer) ))\n        if <(special action timer) = [4]> then\n            if <(angered) > [36]> then\n                add (join [shockwave ] (direction)) to [particles v]\n                add ((x) + ((direction) / (1.5))) to [particles v]\n                add ((y) - ((height) + (4))) to [particles v]\n                repeat (15)\n                    add [rock] to [particles v]\n                    add ((x) + ((width) * ((direction) / (45)))) to [particles v]\n                    add ((y) - (height)) to [particles v]\n                end\n            end\n            start sound [false_knight_strike_ground v]\n            set [screen shake v] to [10]\n        end\n        change [special action timer v] by (-0.5)\n    end\n    if <(special action) = [ready attack]> then\n        set [costume v] to (((root costume) + (50)) - ([ceiling v] of (special action timer) ))\n        change [special action timer v] by (-0.5)\n    end\n    if <(special action) = [stagger]> then\n        set [costume v] to (((root costume) + (74)) - ([ceiling v] of (special action timer) ))\n        change [special action timer v] by (-0.5)\n    end\n    if <(special action) = [recover]> then\n        set [costume v] to (((root costume) + (85)) - ([ceiling v] of (special action timer) ))\n        change [special action timer v] by (-0.5)\n    end\n    if <(special action) = [hit]> then\n        set [costume v] to (((root costume) + (80)) - ([ceiling v] of (special action timer) ))\n        change [special action timer v] by (-0.5)\n    end\n    if <(special action) = [start fall]> then\n        set [costume v] to (((root costume) + (88)) - ([ceiling v] of (special action timer) ))\n        change [special action timer v] by (-0.5)\n    end\n    if <(special action) = [die]> then\n        set [costume v] to (((root costume) + (94)) - ([ceiling v] of (special action timer) ))\n        change [special action timer v] by (-0.5)\n    end\n    if <(special action timer) < [-0.9]> then\n        if <(special action) = [die]> then\n            set [action v] to [dead]\n            if <(ARENA PROGRESS) > [0]> then\n                change [arena progress v] by (-1)\n                if <(ARENA PROGRESS) = [0]> then\n                    add (join [are] (ROOM)) to [game data v]\n                    start sound [gate_open v]\n                    broadcast (Finish Arena v)\n                end\n            end\n        end\n        set [special action v] to []\n    end\nelse\n    if <<(action) = [jump]> or <(action) = [rage jump]>> then\n        if <(falling) > [10]> then\n            set [costume v] to ((root costume) + (19))\n        else\n            set [costume v] to (((root costume) + (13)) + (([floor v] of (falling) ) / (2)))\n        end\n    else\n        if <(action) = [jump attack]> then\n            if <(falling) > [10]> then\n                set [costume v] to ((root costume) + (30))\n            else\n                set [costume v] to (((root costume) + (25)) + (([floor v] of (falling) ) / (2)))\n            end\n        else\n            if <(action) = [stagger]> then\n                set [costume v] to (((root costume) + (75)) + (([floor v] of (frame) ) mod (4)))\n            else\n                if <(action) = [rage]> then\n                    set [costume v] to (((root costume) + (51)) + (([floor v] of (frame) ) mod (10)))\n                else\n                    if <(action) = [fall]> then\n                        set [costume v] to ((root costume) + (88))\n                    else\n                        if <(action) = [death]> then\n                            set [costume v] to (((root costume) + (78)) + (([floor v] of (frame) ) mod (3)))\n                        else\n                            if <(action) = [dead]> then\n                                set [costume v] to ((root costume) + (94))\n                            else\n                                set [costume v] to ((root costume) + (([floor v] of (frame) ) mod (5)))\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nif <not <<(action) = [stagger]> or <<(action) = [death]> or <(action) = [dead]>>>> then\n    switch costume to (falseknight-hitbox1 v)\n    if <touching (player v)?> then\n        broadcast (player - hurt v)\n    else\n        if <<(special action) = [attack]> and <(special action timer) = [4]>> then\n            switch costume to (falseknight-hitbox2 v)\n            if <touching (player v)?> then\n                broadcast (player - hurt v)\n            end\n        else\n            if <<(action) = [rage]> and <(special action) = []>> then\n                switch costume to (falseknight-hitbox4 v)\n                if <touching (player v)?> then\n                    broadcast (player - hurt v)\n                end\n            end\n        end\n    end\n    switch costume to (falseknight-hitbox1 v)\nelse\n    switch costume to (falseknight-hitbox3 v)\nend\nif <not <<(action) = [death]> or <(action) = [dead]>>> then\n    if <(invulnerable) = [0]> then\n        if <touching (nail v)?> then\n            Take Damage\n            if <(action) = [stagger]> then\n                set [special action v] to [hit]\n                set [special action timer v] to [1]\n                start sound (join [Fknight_hit_0] (pick random (1) to (2)))\n                repeat (6)\n                    add [infection blip] to [particles v]\n                    add ((x) + ((direction) / (1.5))) to [particles v]\n                    add (y) to [particles v]\n                end\n                if <(health) = [0]> then\n                    if <(y) < [500]> then\n                        set [frame v] to [0]\n                        set [action v] to [death]\n                        set [speed x v] to [0]\n                        start sound [boss_gushing v]\n                        start sound [FKnight_death v]\n                        add [ach_falsehood] to [inventory v]\n                    else\n                        set [action v] to [rage idle]\n                        set [special action v] to [recover]\n                        set [special action timer v] to [4]\n                        set [health v] to [65]\n                        if <not <(letter (14) of (type)) = [4]>> then\n                            set [type v] to (join [false knight ] ((letter (14) of (type)) + (1)))\n                        end\n                    end\n                end\n            else\n                start sound [false_knight_damage_armour v]\n                if <(health) = [0]> then\n                    set [screen shake v] to [10]\n                    set [action v] to [stagger]\n                    set [special action v] to [stagger]\n                    set [special action timer v] to [14]\n                    set [speed x v] to ((direction) / (-22.5))\n                    set [speed y v] to [4]\n                    set [health v] to [40]\n                    start sound [boss_stun v]\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [change menu v]\nset volume to ((SOUND VOLUME) * (10)) %\n\nwhen I start as a clone\nset volume to ((SOUND VOLUME) * (10)) %\n\ndefine Tick Lever\ngo to [back v] layer\ngo [forward v] (LAYERS - BACKGROUND) layers\nif <(action) = [unflipped]> then\n    if <[game data v] contains (join [lvr] (ROOM))?> then\n        set [action v] to [flipped]\n        broadcast (lever flipped v)\n    end\n    if <touching (nail v)?> then\n        start sound [switch_gate_switch v]\n        start sound [switch_gate_gate v]\n        set [action v] to [flipped]\n        set [special action v] to [flip]\n        set [special action timer v] to [9]\n    end\nend\nif <(special action) > []> then\n    change [special action timer v] by (-1)\n    set [costume v] to (((root costume) + (8)) - (special action timer))\n    if <(special action timer) < [1]> then\n        set [special action v] to []\n        add (join [lvr] (ROOM)) to [game data v]\n        broadcast (lever flipped v)\n    end\nelse\n    if <(action) = [flipped]> then\n        set [costume v] to ((root costume) + (8))\n    else\n        set [costume v] to (root costume)\n    end\nend\n\nwhen I receive [move player after enemy v]\nif << [_object_hot spring_lever_lever -90_] contains (join [_] (join (type) [_]))?> or < (type) contains [goam]?>> then\n    paint sprite\n    if <(visible) > [0]> then\n        stamp\n    end\nend\n\nwhen I receive [check controls v]\nif <(type) > []> then\n    show\nend\n\ndefine Tick Cocoon\nif <[game data v] contains (join (join [lb ] (join (x) [ ])) (join (y) (join [ ] (ROOM))))?> then\n    delete this clone\nend\nchange [frame v] by (0.5)\nset [costume v] to ((root costume) + (1))\npaint sprite\npoint in direction (90)\nif <touching (nail v)?> then\n    broadcast (Lifeblood glow v)\n    repeat (10)\n        add [lifeblood glob] to [particles v]\n        add (x) to [particles v]\n        add ((y) - (pick random (10) to (40))) to [particles v]\n    end\n    start sound [enemy_damage v]\n    set [root costume v] to [148]\n    set [costume v] to [148]\n    set [width v] to [1]\n    set [height v] to [1]\n    switch costume to (lifeseed-walk1 v)\n    set [invulnerable v] to [10]\n    set [speed y v] to [0]\n    set [speed x v] to [0]\n    change [y v] by (-32)\n    set [type v] to [lifeseed]\n    set [frame v] to [0]\n    point towards (player v)\n    point in direction (((direction) / ([abs v] of (direction) )) * (-90))\n    create clone of (_myself_ v)\n    turn right (180) degrees\n    create clone of (_myself_ v)\n    add (join (join [lb ] (join (x) [ ])) (join (y) (join [ ] (ROOM)))) to [game data v]\n    delete this clone\nend\n\ndefine Break FK Floor\nreplace item (776) of [tile grid v] with [2]\nreplace item (816) of [tile grid v] with [2]\nreplace item (856) of [tile grid v] with [2]\nreplace item (896) of [tile grid v] with [2]\nreplace item (936) of [tile grid v] with [2]\nreplace item (775) of [tile grid v] with [2]\nreplace item (815) of [tile grid v] with [2]\nreplace item (855) of [tile grid v] with [2]\nreplace item (895) of [tile grid v] with [2]\nreplace item (935) of [tile grid v] with [2]\nreplace item (774) of [tile grid v] with [2]\nreplace item (814) of [tile grid v] with [2]\nreplace item (854) of [tile grid v] with [2]\nreplace item (894) of [tile grid v] with [2]\nreplace item (934) of [tile grid v] with [2]\nreplace item (736) of [tile grid v] with [50]\nreplace item (735) of [tile grid v] with [9]\nreplace item (734) of [tile grid v] with [20]\nreplace item (694) of [tile grid v] with [72]\nreplace item (976) of [tile grid v] with [51]\nreplace item (975) of [tile grid v] with [19]\nreplace item (974) of [tile grid v] with [2]\nreplace item (1015) of [tile grid v] with [71]\nreplace item (1014) of [tile grid v] with [54]\n\nwhen I receive [level - done loading v]\nif <<(ROOM) = [27]> and <[game data v] contains [are27]?>> then\n    Break FK Floor\nend\n\ndefine Tick Shade\ngo to [back v] layer\ngo [forward v] (LAYERS - BACKGROUND) layers\nchange [frame v] by (0.5)\nif <(x) > ([x v] of [player v])> then\n    point in direction (-90)\nelse\n    point in direction (90)\nend\npoint towards (player v)\nswitch costume to (vengefly-fov1 v)\nif <touching (player v)?> then\n    change [angered v] by (1)\nelse\n    switch costume to (shade-fov2 v)\n    if <touching (player v)?> then\n        if <(angered) = [0]> then\n            start sound [hollow_shade_startle v]\n            set [special action v] to [startle]\n            set [special action timer v] to [7]\n        end\n        set [angered v] to [1]\n    end\nend\nif <(angered) > [0]> then\n    Accelerate y [0.1] Max: [2] Direction: (([y v] of [player v]) - (y))\n    move sprite y\n    Accelerate x [0.1] Max: [3] Direction: (direction)\n    move sprite x\n    if <(angered) = [40]> then\n        start sound [hollow_shade_sword v]\n        set [special action v] to [attack]\n        set [special action timer v] to [7]\n        set [angered v] to [1]\n    end\nend\nif <(special action) > []> then\n    if <(special action) = [startle]> then\n        set [costume v] to (((root costume) + (13)) - ([ceiling v] of (special action timer) ))\n        change [special action timer v] by (-0.5)\n    end\n    if <(special action) = [attack]> then\n        set [costume v] to (((root costume) + (28)) - ([ceiling v] of (special action timer) ))\n        change [special action timer v] by (-0.5)\n    end\n    if <(special action timer) < [-0.9]> then\n        set [special action v] to []\n    end\nelse\n    if <(angered) > [0]> then\n        set [costume v] to (((root costume) + (14)) + ([floor v] of ((frame) mod (7)) ))\n    else\n        set [costume v] to ((root costume) + ([floor v] of ((frame) mod (6)) ))\n    end\nend\npaint sprite\nif <(invulnerable) < [1]> then\n    if <touching (nail v)?> then\n        Take Damage\n        start sound [hollow_shade_sword2 v]\n        repeat (pick random (3) to (5))\n            add [low health puff] to [particles v]\n            add ((x) + (pick random (-10) to (10))) to [particles v]\n            add ((y) + (pick random (-10) to (10))) to [particles v]\n        end\n        if <(health) < [1]> then\n            Die with corpse: ((root costume) + (29)) frames: [3]\n        end\n    end\nend\nif <touching (player v)?> then\n    if <(direction) > [0]> then\n        set [player knockback v] to [9]\n    else\n        set [player knockback v] to [-9]\n    end\n    broadcast (player - hurt v)\nend\n\nwhen I receive [entity - setup v]\nif <[game data v] contains [shade]?> then\n    wait (0.1) seconds\n    if <(ROOM) = (item ((item # of [shade] in [game data v]) + (2)) of [game data v])> then\n        set [spawn index v] to (item ((item # of [shade] in [game data v]) + (1)) of [game data v])\n        if <(item (item (spawn index) of [tile grid v]) of [tile shape v]) = [#]> then\n            set [spawn index v] to ((spawn index) - (GRID HEIGHT))\n        end\n        set [temp v] to (item ((item # of [shade] in [game data v]) + (3)) of [game data v])\n        set [geo held \(25\) v] to ([floor v] of ((temp) / (25)) )\n        set [geo held \(5\) v] to ([floor v] of (((temp) mod (25)) / (5)) )\n        set [geo held \(1\) v] to ((temp) mod (5))\n        Set Type: [shade] Costume: [453] Width: [12] Height: [12] Size: [100] HP: [15] Geo: (geo held \(1\)) (geo held \(5\)) (geo held \(25\))\n        set [type v] to []\n        set [temp v] to (item # of [shade] in [game data v])\n        delete (temp) of [game data v]\n        delete (temp) of [game data v]\n        delete (temp) of [game data v]\n        delete (temp) of [game data v]\n    end\nend\n\n@NPC\n\ndefine paint sprite\nswitch costume to (big v)\ngo to x: ((x) - (CAMERA X)) y: ((y) - (CAMERA Y))\nswitch costume to (costume)\nshow\n\nwhen flag clicked\nset size to (100) %\nhide\nset [type v] to []\nset [speed x v] to [0]\nset [speed y v] to [0]\n\ndefine Set Type: (type) Costume: (costume) Height: (height) size: (size)\nset [type v] to (type)\nset [costume v] to (costume)\nset [root costume v] to (costume)\nset [height v] to (height)\nset [x v] to ([floor v] of (((spawn index) - (1)) / (GRID HEIGHT)) )\nset [y v] to (((spawn index) - (1)) mod (GRID HEIGHT))\nset [x v] to (((x) * (32)) + (16))\nset [y v] to (((y) * (32)) + (height))\nset [frame v] to [0]\nif <[game data v] contains (type)?> then\n    set [times spoken v] to ((item (item # of (type) in [game data v]) of [game data v]) + (1))\nelse\n    set [times spoken v] to [0]\nend\nset size to (size) %\npoint in direction (90)\npaint sprite\ncreate clone of (_myself_ v)\n\ndefine spawn type (tile type)\nset [frame v] to []\nif <(tile type) = [40]> then\n    Set Type: [Elderbug] Costume: [2] Height: [18] size: [75]\nend\nif <(tile type) = [58]> then\n    Set Type: [Tut Lore Tablet] Costume: [TutorialTablet] Height: [1] size: [100]\nend\nif <(tile type) = [85]> then\n    Set Type: [Cornifer] Costume: [16] Height: [16] size: [30]\nend\nif <(tile type) = [101]> then\n    Set Type: [Grub] Costume: [25] Height: [3] size: [70]\nend\nif <(tile type) = [140]> then\n    if <<(temp) < (GRUBS)> or <(EDITOR) > [0]>> then\n        change [temp v] by (1)\n        Set Type: [Freed Grub] Costume: [48] Height: [0] size: [80]\n    end\nend\nif <(tile type) = [147]> then\n    Set Type: [Grubfather] Costume: [57] Height: [0] size: [80]\nend\nif <(tile type) = [157]> then\n    Set Type: [Quirrel Black Egg] Costume: [81] Height: [20] size: [100]\nend\n\ndefine Spawn Loop\nset [temp v] to [0]\nset [object item # v] to [1]\nrepeat (length of [npc index v])\n    set [spawn index v] to (item (object item #) of [npc index v])\n    spawn type (item (object item #) of [npc type v])\n    hide\n    change [object item # v] by (1)\nend\nset [object item # v] to []\nset [type v] to []\n\nwhen I receive [entity - clear v]\ndelete this clone\n\nwhen I receive [entity - setup v]\nSpawn Loop\n\nwhen I receive [level - done loading v]\nbroadcast (ENTITY - Clear v)\nbroadcast (ENTITY - Setup v)\n\nwhen I receive [animate npcs v]\nif <<(type) = []> or <(EDITOR) = [1]>> then\n    stop [this script v]\nend\nAnimate NPCs\nCheck talk\n\ndefine Tick Elderbug\nchange [frame v] by (0.4)\nif <<([x v] of [player v]) < (x)> and <(distance to [player v]) < [150]>> then\n    set [costume v] to (((root costume) + (6)) + (([floor v] of (frame) ) mod (6)))\nelse\n    set [costume v] to ((root costume) + (([floor v] of (frame) ) mod (6)))\nend\n\ndefine Animate NPCs\nif <(type) = [Elderbug]> then\n    Tick Elderbug\n    stop [this script v]\nend\nif <(type) = [Cornifer]> then\n    change [frame v] by (0.25)\n    set [costume v] to ((root costume) + (([floor v] of (frame) ) mod (9)))\n    stop [this script v]\nend\nif <(type) = [Grub]> then\n    Tick Grub\n    stop [this script v]\nend\nif <(type) = [Freed Grub]> then\n    change [frame v] by (0.4)\n    set [costume v] to ((root costume) + (([floor v] of (frame) ) mod (4)))\n    if <((([floor v] of ((frame) * (2.5)) ) / (2.5)) mod (10)) = [0]> then\n        if <(pick random (1) to (5)) = [1]> then\n            start sound (join [Grub_wave_0] (pick random (1) to (4)))\n        end\n    end\n    stop [this script v]\nend\nif <(type) = [Grubfather]> then\n    Tick Grubfather\n    stop [this script v]\nend\nif <(type) = [Quirrel Black Egg]> then\n    change [frame v] by (0.3)\n    set [costume v] to ((root costume) + (([floor v] of (frame) ) mod (12)))\n    stop [this script v]\nend\n\nwhen I receive [position tiles v]\nif <(type) > []> then\n    paint sprite\nend\n\ndefine Check talk\nif <(distance to [player v]) < [50]> then\n    if <([up v] of [controls v]) > [0]> then\n        if <([falling v] of [player v]) < [1]> then\n            if <(type) = [Elderbug]> then\n                Dialogue Elderbug\n                if <[game data v] contains (type)?> then\n                    replace item ((item # of (type) in [game data v]) + (1)) of [game data v] with (times spoken)\n                else\n                    add (type) to [game data v]\n                    add (times spoken) to [game data v]\n                end\n                stop [this script v]\n            end\n            if <(type) = [Tut Lore Tablet]> then\n                Tutorial Lore\n                stop [this script v]\n            end\n            if <(type) = [Cornifer]> then\n                Dialogue Cornifer\n                if <[game data v] contains (type)?> then\n                    replace item ((item # of (type) in [game data v]) + (1)) of [game data v] with (times spoken)\n                else\n                    add (type) to [game data v]\n                    add (times spoken) to [game data v]\n                end\n                stop [this script v]\n            end\n            if <(type) = [Quirrel Black Egg]> then\n                Dialogue Quirrel Black Egg\n                set [costume v] to ((root costume) + (16))\n                repeat (4)\n                    paint sprite\n                    wait (0.05) seconds\n                    change [costume v] by (-1)\n                end\n                broadcast (LEVEL - Continue Game Loop v)\n                if <[game data v] contains (type)?> then\n                    replace item ((item # of (type) in [game data v]) + (1)) of [game data v] with (times spoken)\n                else\n                    add (type) to [game data v]\n                    add (times spoken) to [game data v]\n                end\n                stop [this script v]\n            end\n        end\n    end\nend\n\ndefine Dialogue Elderbug\nbroadcast (LEVEL - STOP v) and wait\nwait (0) seconds\nstart sound (join [Elderbug_] (pick random (2) to (4)))\nbroadcast (prepare diolouge v) and wait\nset [text v] to [ELDERBUG]\nbroadcast (New title v) and wait\nif <(times spoken) = [0]> then\n    set [text v] to [Ho there, traveller. I'm afraid there's only me left to offer welcome. Our town's fallen quiet you see.]\n    broadcast (new diolouge v) and wait\n    set [text v] to [The other residents, they've all disappeared. Headed down that well, one by one, into the caverns below.]\n    broadcast (new diolouge v) and wait\n    set [text v] to [Used to be there was a great kingdom beneath our town. It's long fell to ruin, yet it still draws folks into its depths.]\n    broadcast (new diolouge v) and wait\n    set [text v] to [Wealth, glory, enlightenment, that darkness seems to promise all things. I'm sure you too seek your dreams down there.]\n    broadcast (new diolouge v) and wait\n    set [text v] to [Well watch out. It's a sickly air that fills the place. Creatures turn mad and travellers are robbed of their memories.]\n    broadcast (new diolouge v) and wait\n    set [text v] to [Perhaps dreams aren't such great things after all... ]\n    broadcast (new diolouge v) and wait\n    change [times spoken v] by (1)\n    broadcast (finish diolouge v) and wait\n    broadcast (LEVEL - Continue Game Loop v)\n    stop [this script v]\nend\nif <(times spoken) = [1]> then\n    set [text v] to [Many used to come, hoping the kingdom would fulfill their desires.]\n    broadcast (new diolouge v) and wait\n    set [text v] to [Hallownest, it was once called. Supposedly the greatest kingdom there ever was, full of treasures and secrets.]\n    broadcast (new diolouge v) and wait\n    set [text v] to [Hm. Now it's nothing more than a poisonous tomb full of monsters and madness.]\n    broadcast (new diolouge v) and wait\n    set [text v] to [Everything fades eventually, I suppose. ]\n    broadcast (new diolouge v) and wait\n    change [times spoken v] by (1)\n    broadcast (finish diolouge v) and wait\n    broadcast (LEVEL - Continue Game Loop v)\n    stop [this script v]\nend\nset [text v] to [Feeling tired? That bench may be iron, but I assure you it's quite comfortable. There's no better place to collect your thoughts before heading below.]\nbroadcast (new diolouge v) and wait\nset [text v] to [Plus I enjoy the company. Not that you seem the talkative sort. ]\nbroadcast (new diolouge v) and wait\nbroadcast (finish diolouge v) and wait\nbroadcast (LEVEL - Continue Game Loop v)\n\ndefine Tutorial Lore\nbroadcast (LEVEL - STOP v) and wait\nwait (0) seconds\nstart sound [Lore_Tablet_activate_temp v]\nbroadcast (prepare diolouge v) and wait\nif <(y) > [560]> then\n    set [text v] to [Higher beings, these words are for you alone.]\n    broadcast (new diolouge v) and wait\n    set [text v] to [Beyond this point you enter the land of King and Creator.]\n    broadcast (new diolouge v) and wait\n    set [text v] to [Step across this threshold and obey our laws.]\n    broadcast (new diolouge v) and wait\n    set [text v] to [Bear witness to the last and only civilization, the eternal Kingdom.]\n    broadcast (new diolouge v) and wait\n    set [text v] to [Hallownest ]\n    broadcast (new diolouge v) and wait\n    broadcast (finish diolouge v) and wait\n    broadcast (LEVEL - Continue Game Loop v)\n    stop [this script v]\nend\nif <(y) > [460]> then\n    set [text v] to [Higher beings, these words are for you alone.]\n    broadcast (new diolouge v) and wait\n    set [text v] to [Your great strength marks you amongst us. Focus your soul and you shall achieve feats of which others can only dream. ]\n    broadcast (new diolouge v) and wait\n    broadcast (finish diolouge v) and wait\n    broadcast (LEVEL - Continue Game Loop v)\n    stop [this script v]\nend\nset [text v] to [Higher beings, these words are for you alone.]\nbroadcast (new diolouge v) and wait\nset [text v] to [Within our lands do not hide your true form. Let all bask in your majesty, for only this kingdom could produce ones such as you. ]\nbroadcast (new diolouge v) and wait\nbroadcast (finish diolouge v) and wait\nbroadcast (LEVEL - Continue Game Loop v)\nstop [this script v]\n\ndefine Dialogue Cornifer\nbroadcast (LEVEL - STOP v) and wait\nwait (0) seconds\nstop all sounds\nstart sound (join [Cornifer_] (pick random (1) to (3)))\nbroadcast (prepare diolouge v) and wait\nset [frame v] to [0]\nif <(times spoken) = [0]> then\n    set [text v] to [Hmm? Ah, hello there. Come down to explore these beautiful old ruins? Don't mind me. ]\n    broadcast (new diolouge v) and wait\n    set [text v] to [I've a fondness for exploring myself. Getting lost and finding your way again is a pleasure like no other. We're exquisitely lucky, you and I. ]\n    broadcast (new diolouge v) and wait\n    set [text v] to [I'm a cartographer by trade, and I'm working on mapping this area right now. Would you like to purchase a copy of my work so far?]\n    broadcast (new diolouge v) and wait\n    set [text v] to []\n    broadcast (Yes/No Question v)\n    repeat until <(TEXT) > []>\n        broadcast (tick menu v)\n    end\n    if <(GEO) > [29]> then\n        if <(TEXT) = [Yes]> then\n            start sound [geo_deplete_count_down v]\n            change [geo v] by (-30)\n            broadcast (tick menu v)\n            broadcast (position tiles v)\n            broadcast (Aquire Item v) and wait\n            if <not <[inventory v] contains [map]?>> then\n                add [map] to [inventory v]\n                add [ach_cartographer] to [inventory v]\n            end\n            set [text v] to [Perhaps we'll meet again on our travels.]\n            broadcast (new diolouge v) and wait\n        else\n            set [text v] to [Not interested, then? Yes, quite understandable. Exploring without a map, finding your own way through unknown caverns... All very nourishing for the soul.]\n            broadcast (new diolouge v) and wait\n            set [text v] to [Perhaps we'll meet again on our travels.]\n            broadcast (new diolouge v) and wait\n        end\n    else\n        set [text v] to [You don't have enough Geo? Ah, I understand. I'd give you the map as a gift, but I don't think my wife would be very happy if I did. "All our food is made of Geo", as they say. ]\n        broadcast (new diolouge v) and wait\n    end\n    change [times spoken v] by (1)\n    broadcast (finish diolouge v) and wait\n    broadcast (LEVEL - Continue Game Loop v)\n    stop [this script v]\nend\nif <(times spoken) = [1]> then\n    if <[inventory v] contains [map]?> then\n        set [text v] to [Oh, by the way, I haven't introduced myself have I? Yes, I should apologise for that. When you spend a lot of time by yourself, with just your own thoughts, you forget the niceties of conversation.]\n        broadcast (new diolouge v) and wait\n        set [text v] to [CORNIFER]\n        broadcast (New title v) and wait\n        set [text v] to [My name is Cornifer, and I've always loved exploring the world. Why, when I was first hatched I wandered off immediately, leaving my brothers and sisters and poor mother behind!]\n        broadcast (new diolouge v) and wait\n        set [text v] to [That's why as soon as I could I moved to Dirtmouth with my wife. A huge, unending Kingdom to explore right on our doorstep. Who could resist?]\n        broadcast (new diolouge v) and wait\n        set [text v] to [Anyway, I'll let you return to your travels. With a little luck, we'll meet again. Be safe and farewell!]\n        broadcast (new diolouge v) and wait\n        change [times spoken v] by (1)\n    else\n        set [text v] to [Hmm? Have you changed your mind about buying a map? ]\n        broadcast (new diolouge v) and wait\n        set [text v] to []\n        broadcast (Yes/No Question v)\n        repeat until <(TEXT) > []>\n            broadcast (tick menu v)\n        end\n        if <(GEO) > [29]> then\n            if <(TEXT) = [Yes]> then\n                start sound [geo_deplete_count_down v]\n                change [geo v] by (-30)\n                broadcast (tick menu v)\n                broadcast (position tiles v)\n                broadcast (Aquire Item v) and wait\n                if <not <[inventory v] contains [map]?>> then\n                    add [map] to [inventory v]\n                end\n                set [text v] to [Perhaps we'll meet again on our travels.]\n                broadcast (new diolouge v) and wait\n            else\n                set [text v] to [Not interested, then? Yes, quite understandable. Exploring without a map, finding your own way through unknown caverns... All very nourishing for the soul.]\n                broadcast (new diolouge v) and wait\n                set [text v] to [Perhaps we'll meet again on our travels.]\n                broadcast (new diolouge v) and wait\n            end\n        else\n            set [text v] to [You don't have enough Geo? Ah, I understand. I'd give you the map as a gift, but I don't think my wife would be very happy if I did. "All our food is made of Geo", as they say. ]\n            broadcast (new diolouge v) and wait\n        end\n    end\n    broadcast (finish diolouge v) and wait\n    broadcast (LEVEL - Continue Game Loop v)\n    stop [this script v]\nend\nset [text v] to [CORNIFER]\nbroadcast (New title v) and wait\nset [text v] to [Hello again! Still winding your way through these beautiful highways? Just imagine how they must have looked during the kingdom's height, thick with traffic and bustling with life! I wish I could have seen it.]\nbroadcast (new diolouge v) and wait\nbroadcast (finish diolouge v) and wait\nbroadcast (LEVEL - Continue Game Loop v)\nstop [this script v]\n\ndefine Tick Grub\nif <[game data v] contains (join (join (type) [ ]) (join (spawn index) (join [ ] (ROOM))))?> then\n    delete this clone\nend\ngo to [back v] layer\ngo [forward v] (LAYERS - BACKGROUND) layers\nif <(item (spawn index) of [tile grid v]) = [2]> then\n    change [frame v] by (1)\n    if <(frame) > [54]> then\n        start sound [grub_free_1 v]\n        set [frame v] to [0]\n    end\n    if <(frame) < [38]> then\n        set [costume v] to (((root costume) + (9)) + (([floor v] of ((frame) / (2)) ) mod (6)))\n    else\n        if <(frame) = [38]> then\n            start sound [grub_burrow v]\n        end\n        set [costume v] to (((root costume) + (15)) + ([floor v] of (((frame) - (38)) / (2)) ))\n    end\n    if <([floor v] of (frame) ) = [54]> then\n        add (join (join (type) [ ]) (join (spawn index) (join [ ] (ROOM)))) to [game data v]\n        change [grubs v] by (1)\n        delete this clone\n    end\n    stop [this script v]\nend\npoint towards (player v)\nchange [frame v] by (0.4)\nif <(distance to [player v]) < [100]> then\n    if <(costume) < ((root costume) + (6))> then\n        start sound [grub_alert v]\n    end\n    set [costume v] to (((root costume) + (6)) + (([floor v] of (frame) ) mod (3)))\nelse\n    if <(costume) > ((root costume) + (5))> then\n        start sound (join [grub_sad_] (pick random (1) to (2)))\n    end\n    set [costume v] to ((root costume) + (([floor v] of (frame) ) mod (6)))\n    if <((round ((frame) * (2))) mod (80)) = [0]> then\n        start sound (join [Grub_sad_idle_0] (pick random (1) to (4)))\n    end\nend\n\nwhen I receive [change menu v]\nset volume to ((SOUND VOLUME) * (10)) %\n\nwhen I start as a clone\nif <(type) = [Freed Grub]> then\n    set [frame v] to ((pick random (0) to (40)) / (10))\nend\nif <(type) = [Grubfather]> then\n    change [y v] by (-6)\nend\n\nrepeat (2)\n    switch costume to (grubfather-idle1 v)\n    repeat (4)\n        wait (0.05) seconds\n        next costume\n    end\n    wait (0.05) seconds\nend\nswitch costume to (grubfather-gift1 v)\nrepeat (11)\n    wait (0.05) seconds\n    next costume\nend\nwait (0.05) seconds\nrepeat (2)\n    switch costume to (grubfather-idle1 v)\n    repeat (4)\n        wait (0.05) seconds\n        next costume\n    end\n    wait (0.05) seconds\nend\n\ndefine Tick Grubfather\nif <<(GRUBS) > (GRUB REWARDS)> and <(distance to [player v]) < [200]>> then\n    if <not <(frame) < [0]>> then\n        set [frame v] to [-1]\n    else\n        if <(frame) < [-11.5]> then\n            change [grub rewards v] by (1)\n            set [frame v] to [0]\n            if <(GRUB REWARDS) = [4]> then\n                add [ach_grubfriend] to [inventory v]\n            end\n        else\n            change [frame v] by (-0.4)\n            if <(round ((frame) * (100))) = [-300]> then\n                start sound (join [Grub_king_cheer_0] (pick random (1) to (3)))\n                repeat (((GRUB REWARDS) + (1)) * (5))\n                    add [2] to [geo drops v]\n                    add (x) to [geo drops v]\n                    add (y) to [geo drops v]\n                    add (((GRUB REWARDS) + (1)) * (4)) to [geo drops v]\n                end\n                repeat ((GRUB REWARDS) + (1))\n                    add [6] to [geo drops v]\n                    add (x) to [geo drops v]\n                    add (y) to [geo drops v]\n                    add (((GRUB REWARDS) + (1)) * (4)) to [geo drops v]\n                end\n            end\n        end\n    end\n    set [costume v] to (((root costume) + (11)) + (([floor v] of ((0) - (frame)) ) mod (12)))\nelse\n    change [frame v] by (0.35)\n    if <(GRUBS) = [0]> then\n        set [costume v] to ((root costume) + (([floor v] of (frame) ) mod (7)))\n    else\n        set [costume v] to (((root costume) + (7)) + (([floor v] of (frame) ) mod (5)))\n    end\nend\n\nset [geo v] to [100]\n\ndefine Dialogue Quirrel Black Egg\nbroadcast (LEVEL - STOP v) and wait\nbroadcast (move player after enemy v) and wait\nset [costume v] to ((root costume) + (12))\nrepeat (4)\n    paint sprite\n    wait (0.05) seconds\n    change [costume v] by (1)\nend\nif <(times spoken) < [4]> then\n    start sound (join [Quirrel_0] (pick random (1) to (4)))\nend\nbroadcast (prepare diolouge v) and wait\nif <(times spoken) = [0]> then\n    set [text v] to [Hello there! How delightful to meet another traveller on these forgotten roads.]\n    broadcast (new diolouge v) and wait\n    set [text v] to [You're a short one, but you've a strong look about you.]\n    broadcast (new diolouge v) and wait\n    start sound (join [Quirrel_0] (pick random (1) to (4)))\n    set [text v] to [QUIRREL]\n    broadcast (New title v) and wait\n    set [text v] to [I'm Quirrel. I have something of an obsession with uncharted places.]\n    broadcast (new diolouge v) and wait\n    set [text v] to [This ancient kingdom holds many fascinating mysteries, and one of the most intriguing of them is standing right before us.]\n    broadcast (new diolouge v) and wait\n    start sound [Quirrel_05_hmmm v]\n    set [text v] to [A great stone egg, lying in the corpse of an ancient kingdom. And this egg...Is it warm? It certainly gives off a unique air.]\n    broadcast (new diolouge v) and wait\n    set [text v] to [Can it be opened? There are strange marks all over it...]\n    broadcast (new diolouge v) and wait\n    start sound (join [Quirrel_0] (pick random (1) to (4)))\n    set [text v] to [I do so love a mystery...And who knows what other marvels lie even deeper below us... ]\n    broadcast (new diolouge v) and wait\n    change [times spoken v] by (1)\n    broadcast (finish diolouge v) and wait\n    stop [this script v]\nend\nif <(times spoken) = [1]> then\n    set [text v] to [QUIRREL]\n    broadcast (New title v) and wait\n    set [text v] to [For so long I've felt drawn here. So many tales full of wonders and horrors. No longer could I resist. I just had to see it for myself.]\n    broadcast (new diolouge v) and wait\n    set [text v] to [And what a time I chose to arrive! This dead world has sprung to life.]\n    broadcast (new diolouge v) and wait\n    start sound (join [Quirrel_0] (pick random (1) to (4)))\n    set [text v] to [The creatures are riled up and the earth rumbles. The air is thick. I wonder what could have brought it all about? ]\n    broadcast (new diolouge v) and wait\n    change [times spoken v] by (1)\n    broadcast (finish diolouge v) and wait\n    broadcast (LEVEL - Continue Game Loop v)\n    stop [this script v]\nend\nif <(times spoken) = [2]> then\n    set [text v] to [QUIRREL]\n    broadcast (New title v) and wait\n    set [text v] to [To persevere in this ruin, that old nail alone just won't be enough. Though that's no problem! One only has to look around.]\n    broadcast (new diolouge v) and wait\n    set [text v] to [Plenty have come before us and most have met their grisly end, many more equipped than you and I.]\n    broadcast (new diolouge v) and wait\n    start sound (join [Quirrel_0] (pick random (1) to (4)))\n    set [text v] to [I'm sure they wouldn't mind were a fellow explorer to relieve them of their tools. It's a kindness really. The dead shouldn't be burdened with such things. ]\n    broadcast (new diolouge v) and wait\n    change [times spoken v] by (1)\n    broadcast (finish diolouge v) and wait\n    stop [this script v]\nend\nif <(times spoken) = [3]> then\n    set [text v] to [QUIRREL]\n    broadcast (New title v) and wait\n    set [text v] to [Did you pass that town above? What a gloomy little place. And such majesty hidden right beneath!]\n    broadcast (new diolouge v) and wait\n    set [text v] to [I suppose that's why they've all headed down here. Who could resist such possibilities? ]\n    broadcast (new diolouge v) and wait\n    change [times spoken v] by (1)\n    broadcast (finish diolouge v) and wait\n    stop [this script v]\nend\nset [text v] to [QUIRREL]\nbroadcast (New title v) and wait\nstart sound [Quirrel_05_hmmm v]\nset [text v] to [Truly a marvel...]\nbroadcast (new diolouge v) and wait\nbroadcast (finish diolouge v) and wait\n\nset [geo v] to [600]\n\n@Nail\n\nwhen I receive [swing nail v]\nif <(EDITOR) > [0]> then\n    stop [this script v]\nend\nUpdate Nail\nif <(nail stage) > [1]> then\n    if <(nail stage) < [5]> then\n        get tile at x: (x) y: (y)\n        Check Hit <[0] = [1]>\n        if <([player action v] of [player v]) = [look up]> then\n            get tile at x: (x) y: ((y) + (20))\n        else\n            if <([player action v] of [player v]) = [crouch]> then\n                get tile at x: ((x) - (20)) y: (y)\n            else\n                get tile at x: ((x) + ((direction) / (3))) y: (y)\n            end\n        end\n        Check Hit <[1] = [1]>\n    end\nend\nDisplay Hitbox\n\ndefine Update Nail\npoint in direction (direction)\nif <(nail stage) < [1]> then\n    set [created impact? v] to [0]\n    if <([player action v] of [player v]) = [sit]> then\n        stop [this script v]\n    end\n    set [direction v] to ([direction v] of [player v])\n    if <([player action v] of [player v]) = [look up]> then\n        set [costume v] to [31]\n    else\n        if <([player action v] of [player v]) = [crouch]> then\n            if <([solid v] of [player v]) = []> then\n                set [costume v] to [34]\n            else\n                stop [this script v]\n            end\n        else\n            set [costume v] to [28]\n        end\n    end\n    if <([sword v] of [controls v]) = [1]> then\n        change [nail stage v] by (1)\n        start sound (pick random (1) to (3))\n    end\n    stop [this script v]\nend\nif <(nail stage) < [10]> then\n    change [nail stage v] by (1)\n    stop [this script v]\nend\nset [nail stage v] to [0]\n\ndefine Display Nail\npoint in direction (direction)\nset [x v] to ([x v] of [player v])\nset [y v] to ([y v] of [player v])\nif <(costume) = [31]> then\n    change [y v] by (20)\nelse\n    if <(costume) = [34]> then\n        change [y v] by (-15)\n    else\n        change [x v] by ((direction) / (6))\n    end\nend\ngo to x: ((x) - (CAMERA X)) y: ((y) - (CAMERA Y))\nif <(nail stage) > [0]> then\n    if <(nail stage) < [7]> then\n        show\n        switch costume to ((costume) + ([ceiling v] of ((nail stage) / (2)) ))\n    else\n        hide\n    end\nelse\n    hide\nend\n\nwhen I receive [position tiles v]\nif <([player action v] of [player v]) = [lose life]> then\n    hide\nelse\n    Display Nail\nend\n\ndefine get tile at x: (x) y: (y)\nset [tile grid x v] to ([floor v] of ((x) / (32)) )\nset [tile grid y v] to ([floor v] of ((y) / (32)) )\nset [tile index v] to (((1) + (tile grid y)) + ((tile grid x) * (GRID HEIGHT)))\nset [tile v] to (item (tile index) of [tile grid v])\nset [tile shape v] to (item (tile) of [tile shape v])\n\ndefine Check Hit <at distance?>\nif <<(tile) = [18]> or <(tile) = [155]>> then\n    start sound [sword_hit_reject v]\n    if <not <at distance?>> then\n        Add particles [nail impact big] [1] <at distance?>\n    end\n    set [nail stage v] to [7]\n    broadcast (attacked object v)\n    stop [this script v]\nend\nif <(item ((tile index) - (1)) of [tile grid v]) = [155]> then\n    start sound [sword_hit_reject v]\n    if <not <at distance?>> then\n        Add particles [nail impact big] [1] <at distance?>\n    end\n    set [nail stage v] to [7]\n    broadcast (attacked object v)\n    stop [this script v]\nend\nif <(tile) = [36]> then\n    replace item (tile index) of [tile grid v] with [37]\n    start sound [breakable_wall_hit_1 v]\n    Add particles [door] [4] <at distance?>\n    stop [this script v]\nend\nif <<(tile) > [26]> and <(tile) < [30]>> then\n    replace item (tile index) of [tile grid v] with [33]\n    start sound [grass_cut_1 v]\n    Add particles [grass] [7] <at distance?>\n    stop [this script v]\nend\nif <<(tile) > [29]> and <(tile) < [33]>> then\n    replace item (tile index) of [tile grid v] with [34]\n    start sound [grass_cut_5 v]\n    Add particles [grass] [4] <at distance?>\n    stop [this script v]\nend\nif <<(tile) = [78]> or <(tile) = [79]>> then\n    replace item (tile index) of [tile grid v] with [2]\n    start sound (join [barrel_death_] (pick random (1) to (2)))\n    Add particles [shell] [4] <at distance?>\n    broadcast (attacked object v)\n    stop [this script v]\nend\nif <(tile) = [80]> then\n    replace item (tile index) of [tile grid v] with [2]\n    start sound (join [barrel_death_] (pick random (1) to (2)))\n    Add particles [shell] [6] <at distance?>\n    broadcast (attacked object v)\n    stop [this script v]\nend\nif <<(tile) = [81]> or <(tile) = [82]>> then\n    replace item (tile index) of [tile grid v] with [2]\n    start sound [wagon_death v]\n    Add particles [shell] [8] <at distance?>\n    broadcast (attacked object v)\n    stop [this script v]\nend\nif <(tile) = [102]> then\n    replace item (tile index) of [tile grid v] with [2]\n    start sound [globe_break v]\n    Add particles [glass] [12] <at distance?>\n    stop [this script v]\nend\nif <(nail stage) = [2]> then\n    if <<(tile) = [152]> or <(tile) = [153]>> then\n        replace item (tile index) of [tile grid v] with ((tile) + (1))\n        Add particles [rock] [6] <at distance?>\n        start sound [breakable_wall_hit_1 v]\n        stop [this script v]\n    end\n    if <(tile) = [154]> then\n        replace item (tile index) of [tile grid v] with [2]\n        Add particles [rock] [15] <at distance?>\n        start sound [breakable_wall_death v]\n        stop [this script v]\n    end\nend\nif <(tile) = [158]> then\n    replace item (tile index) of [tile grid v] with [159]\n    add (join [che] (ROOM)) to [game data v]\n    start sound [chest_open v]\n    stop [this script v]\nend\nif <<(tile) > [93]> and <(tile) < [97]>> then\n    replace item (tile index) of [tile grid v] with [33]\n    start sound [grass_cut_5 v]\n    Add particles [grass] [5] <at distance?>\n    stop [this script v]\nend\nif <(tile) = [111]> then\n    replace item (tile index) of [tile grid v] with [2]\n    start sound [grass_cut_5 v]\n    Add particles [black grass] [3] <at distance?>\n    stop [this script v]\nend\nif <(tile) = [120]> then\n    replace item (tile index) of [tile grid v] with [2]\n    start sound [grass_cut_5 v]\n    Add particles [black grass] [5] <at distance?>\n    stop [this script v]\nend\nif <(tile) = [168]> then\n    replace item (tile index) of [tile grid v] with [179]\n    start sound [orange_shot_impact v]\n    Add particles [lifeplant] [7] <at distance?>\n    stop [this script v]\nend\nif <(tile) = [174]> then\n    replace item (tile index) of [tile grid v] with [180]\n    start sound [orange_shot_impact v]\n    Add particles [lifeplant] [3] <at distance?>\n    stop [this script v]\nend\nif <(tile shape) = [#]> then\n    if <(nail stage) > [0]> then\n        if <(created impact?) = [0]> then\n            if <(tile) = [108]> then\n                start sound [sword_terrain_temp v]\n            else\n                start sound [spikes_arm_1 v]\n            end\n            Add particles [nail impact] [1] <at distance?>\n            set [created impact? v] to [1]\n        end\n        if <not <at distance?>> then\n            set [nail stage v] to [7]\n        end\n        stop [this script v]\n    end\nend\n\ndefine Add particles (type) (amount) <at distance?>\nrepeat (amount)\n    add (type) to [particles v]\n    if <at distance?> then\n        add ((x) + ((direction) / (3))) to [particles v]\n    else\n        add (x) to [particles v]\n    end\n    add (y) to [particles v]\nend\n\ndefine Display Hitbox\nset [x v] to ([x v] of [player v])\nset [y v] to ([y v] of [player v])\ngo to [front v] layer\ngo [backward v] ((LAYERS - UI) + (5)) layers\nif <(costume) = [31]> then\n    change [y v] by (20)\n    switch costume to (nail hitbox up v)\nelse\n    if <(costume) = [34]> then\n        change [y v] by (-15)\n        switch costume to (nail hitbox down v)\n    else\n        switch costume to (nail hitbox right v)\n    end\nend\ngo to x: ((x) - (CAMERA X)) y: ((y) - (CAMERA Y))\n\nwhen I receive [main menu v]\nset [nail stage v] to [0]\nhide\n\nwhen I receive [player - exit room v]\nset [nail stage v] to [0]\nhide\n\nwhen I receive [player - exit room - up v]\nset [nail stage v] to [0]\nhide\n\nwhen I receive [change menu v]\nset volume to ((SOUND VOLUME) * (10)) %\n\nwhen I receive [player - die v]\nhide\n\n@Geo\n\ndefine fix collision at point x: (x) y: (y) part: (part)\nget tile at x: (x) y: (y)\nif <(tile shape) = []> then\n    stop [this script v]\nend\nset [mod x v] to ((x) mod (32))\nset [mod y v] to ((y) mod (32))\nset [temp v] to (letter (1) of (tile shape))\nif <<(temp) = [/]> or <(temp) = [\]>> then\n    set [m v] to ((1) / (letter (2) of (tile shape)))\n    set [c v] to ((letter (3) of (tile shape)) * ((32) * (m)))\n    if <(temp) = [\]> then\n        set [m v] to ((0) - (m))\n        set [c v] to ((32) - (c))\n    end\n    set [offset y v] to ((mod y) - (((mod x) * (m)) + (c)))\n    if <not <(offset y) < [0]>> then\n        stop [this script v]\n    end\n    if <(fix dy) < [0]> then\n        change [y v] by ((0) - (offset y))\n        set [solid v] to [10]\n        stop [this script v]\n    end\n    if <<(fix dy) = [0]> and <<(fix dx) > [0]> = <(m) > [0]>>> then\n        change [x v] by ((offset y) / (m))\n        set [solid v] to [10]\n        stop [this script v]\n    end\nend\nif <(tile shape) = [=]> then\n    if <<not <(part) = [feet]>> or <((mod y) - (fix dy)) < [32]>> then\n        stop [this script v]\n    end\nend\nset [solid v] to [10]\nif <(fix dy) < [0]> then\n    change [y v] by ((32) - (mod y))\nend\nif <(fix dx) < [0]> then\n    change [x v] by ((32) - (mod x))\nend\nif <(fix dy) > [0]> then\n    change [y v] by ((TINY -) - (mod y))\nend\nif <(fix dx) > [0]> then\n    change [x v] by ((TINY -) - (mod x))\nend\n\ndefine fix collision in direction dx: (dx) dy: (dy)\nset [fix dx v] to (dx)\nset [fix dy v] to (dy)\nset [solid v] to []\nrepeat (2)\n    fix collision at point x: ((x) - (width)) y: ((y) - (height)) part: [feet]\n    fix collision at point x: ((x) - (width)) y: (y) part: []\n    fix collision at point x: ((x) - (width)) y: ((y) + (height)) part: []\n    fix collision at point x: ((x) + ((width) + (TINY -))) y: ((y) - (height)) part: [feet]\n    fix collision at point x: ((x) + ((width) + (TINY -))) y: (y) part: []\n    fix collision at point x: ((x) + ((width) + (TINY -))) y: ((y) + (height)) part: []\n    if <(solid) < [1]> then\n        stop [this script v]\n    end\nend\n\ndefine move sprite y\nchange [y v] by (speed y)\nchange [falling v] by (1)\nfix collision in direction dx: [0] dy: (speed y)\nif <(solid) > [0]> then\n    if <(speed y) < [0]> then\n        set [falling v] to [0]\n        set [speed y v] to (round ((speed y) * (-0.5)))\n    else\n        set [jumping v] to [99]\n        set [speed y v] to (round ((speed y) / (-2)))\n    end\nend\n\ndefine move sprite x\nset [orig y v] to (y)\nchange [x v] by (speed x)\nfix collision in direction dx: [0] dy: [-1]\nif <(y) > ((orig y) + (([abs v] of (speed x) ) + (4)))> then\n    set [y v] to (orig y)\n    fix collision in direction dx: (speed x) dy: [0]\n    if <(solid) > [0]> then\n        set [speed x v] to [0]\n    end\nelse\n    if <(y) > (orig y)> then\n        set [speed x v] to ((speed x) * (0.9))\n    end\nend\n\ndefine get tile at x: (x) y: (y)\nset [tile grid x v] to ([floor v] of ((x) / (32)) )\nset [tile grid y v] to ([floor v] of ((y) / (32)) )\nset [tile index v] to (((1) + (tile grid y)) + ((tile grid x) * (GRID HEIGHT)))\nif <(tile grid y) < [0]> then\n    set [tile v] to []\nelse\n    set [tile v] to (item (tile index) of [tile grid v])\nend\nset [tile shape v] to (item (tile) of [tile shape v])\n\ndefine paint sprite\nswitch costume to (big v)\ngo to x: ((x) - (CAMERA X)) y: ((y) - (CAMERA Y))\nswitch costume to (costume)\nshow\n\ndefine Spawn - Geo\nrepeat until <(length of [geo drops v]) = [0]>\n    set [root costume v] to (item (1) of [geo drops v])\n    set [x v] to (item (2) of [geo drops v])\n    set [y v] to (item (3) of [geo drops v])\n    set [speed x v] to (pick random ((0) - (item (4) of [geo drops v])) to (item (4) of [geo drops v]))\n    set [speed y v] to (pick random (0) to (round ((item (4) of [geo drops v]) / (1.5))))\n    create clone of (_myself_ v)\n    repeat (4)\n        delete (1) of [geo drops v]\n    end\nend\n\nwhen flag clicked\ndelete all of [geo drops v]\nset [frame v] to []\nset size to (80) %\nhide\n\nwhen I receive [position tiles v]\nif <(frame) = []> then\n    Spawn - Geo\n    stop [this script v]\nend\nTick - Geo\n\ndefine Tick - Geo\nif <not <(speed x) = [0]>> then\n    set [speed x v] to ((speed x) * (0.8))\nend\nmove sprite x\nif <(speed y) > [-12]> then\n    change [speed y v] by (-1)\nend\nif <touching (nail v)?> then\n    set [speed y v] to [4]\nend\nmove sprite y\nif <(falling) = [0]> then\n    change [frame v] by (0.25)\nend\nset [costume v] to ((root costume) + (([floor v] of (frame) ) mod (4)))\npaint sprite\nchange [frame v] by (0.25)\nif <(frame) > [1]> then\n    Check Picked Up\nend\n\nwhen I start as a clone\nset [frame v] to [0]\nset [height v] to [1]\nset [width v] to [1]\n\ndefine Check Picked Up\nif <touching (player v)?> then\n    start sound (pick random (1) to (2))\n    if <(root costume) > [9]> then\n        change [geo v] by (25)\n    else\n        change [geo v] by ((root costume) - (1))\n    end\n    if <(GEO) > [699]> then\n        if <not <[inventory v] contains [ach_wealth]?>> then\n            add [ach_wealth] to [inventory v]\n        end\n    end\n    delete this clone\nend\n\nwhen I receive [level - start game loop v]\ndelete this clone\n\nwhen I receive [level - start game loop - respawn v]\ndelete this clone\n\nwhen I receive [level - start game loop - new level v]\ndelete this clone\n\nwhen I receive [change menu v]\nset volume to ((SOUND VOLUME) * (10)) %\n\nwhen I start as a clone\nset volume to ((SOUND VOLUME) * (10)) %\n\n@Particles\n\nwhen flag clicked\ndelete all of [particles v]\nset [frame v] to []\nset size to (200) %\nhide\n\nwhen I start as a clone\nswitch costume to (big v)\nset [frame v] to [1]\nif <(type) = [smoke]> then\n    set [speed y v] to [2]\n    set size to (pick random (25) to (50)) %\n    set [brightness v] effect to (pick random (0) to (-30))\n    set [ghost v] effect to (pick random (20) to (60))\nend\nif < (type) contains [radial smoke]?> then\n    set [costume v] to [42]\n    set [dir v] to (pick random (-180) to (180))\n    set [brightness v] effect to (pick random (15) to (-15))\n    set [ghost v] effect to (pick random (20) to (40))\n    if < (type) contains [small]?> then\n        set size to (pick random (25) to (50)) %\n        set [speed x v] to (pick random (3) to (5))\n    else\n        set size to (pick random (50) to (75)) %\n        set [speed x v] to (pick random (6) to (10))\n    end\nend\nif <(type) = [radial black puff]> then\n    set [costume v] to [33]\n    set [dir v] to (pick random (-180) to (180))\n    set [speed x v] to (pick random (3) to (5))\n    set size to (pick random (30) to (60)) %\n    set [brightness v] effect to (pick random (-50) to (-70))\n    set [ghost v] effect to (pick random (20) to (50))\n    go to [back v] layer\n    go [forward v] ((LAYERS - BACKGROUND) + (1)) layers\nend\nif < (type) contains [grass]?> then\n    set [speed y v] to (pick random (1.6) to (2.4))\n    set [speed x v] to (pick random (-2) to (2))\n    if <(speed x) > [0]> then\n        set [dir v] to [1]\n    else\n        set [dir v] to [-1]\n    end\n    if <(type) = [black grass]> then\n        set [costume v] to (pick random (62) to (64))\n    else\n        set [costume v] to (pick random (7) to (9))\n    end\nend\nif <(type) = [dot]> then\n    set [speed x v] to (pick random (-1.5) to (1.5))\n    set size to (pick random (100) to (200)) %\n    set [ghost v] effect to (pick random (0) to (50))\nend\nif <(type) = [shell]> then\n    set [speed y v] to (pick random (4) to (6.5))\n    set [speed x v] to (pick random (-3) to (3))\n    if <(speed x) > [0]> then\n        set [dir v] to [1]\n    else\n        set [dir v] to [-1]\n    end\n    set [costume v] to (pick random (13) to (18))\n    set size to (100) %\nend\nif <(type) = [rock]> then\n    set [speed y v] to (pick random (6) to (12))\n    set [speed x v] to (pick random (-4) to (4))\n    if <(speed x) > [0]> then\n        set [dir v] to [1]\n    else\n        set [dir v] to [-1]\n    end\n    set [costume v] to (pick random (72) to (75))\n    set size to (30) %\nend\nif <(type) = [glass]> then\n    set [speed y v] to (pick random (4) to (6.5))\n    set [speed x v] to (pick random (-3) to (3))\n    if <(speed x) > [0]> then\n        set [dir v] to [1]\n    else\n        set [dir v] to [-1]\n    end\n    set [costume v] to (pick random (51) to (54))\n    set size to (100) %\nend\nif <(type) = [door]> then\n    set [speed y v] to (pick random (2) to (4))\n    set [speed x v] to (pick random (-3) to (3))\n    if <(speed x) > [0]> then\n        set [dir v] to [1]\n    else\n        set [dir v] to [-1]\n    end\n    set [costume v] to (pick random (19) to (20))\n    set size to (100) %\nend\nif <(type) = [lifeplant]> then\n    set [speed y v] to (pick random (4) to (6))\n    set [speed x v] to (pick random (-3) to (3))\n    if <(speed x) > [0]> then\n        set [dir v] to [1]\n    else\n        set [dir v] to [-1]\n    end\n    set [costume v] to (pick random (83) to (86))\n    set size to (25) %\nend\nif <(type) = [lifeblood glob]> then\n    set [speed y v] to [0]\n    set [speed x v] to ((pick random (-20) to (20)) / (5))\n    if <(speed x) > [0]> then\n        set [dir v] to [1]\n    else\n        set [dir v] to [-1]\n    end\n    set size to (50) %\nend\nif <(type) = [infection shot]> then\n    if <(([x v] of [player v]) - (x)) > [0]> then\n        set [dir v] to [1]\n    else\n        set [dir v] to [-1]\n    end\n    set [speed x v] to (((([x v] of [player v]) - (x)) / (18)) - (round ((([y v] of [player v]) - (y)) / (160))))\n    set size to (70) %\nend\nif <(type) = [infection blip]> then\n    set [speed y v] to (pick random (2) to (5))\n    set [speed x v] to (pick random (-3.9) to (3.9))\n    if <(speed x) > [0]> then\n        set [dir v] to [1]\n    else\n        set [dir v] to [-1]\n    end\n    set size to (20) %\nend\nif <(type) = [shockwave -90]> then\n    set size to (70) %\n    set [dir v] to [-1]\n    set [speed x v] to [-2]\n    set rotation style [left-right v]\nend\nif <(type) = [shockwave 90]> then\n    set size to (70) %\n    set [dir v] to [1]\n    set [speed x v] to [2]\n    set rotation style [left-right v]\nend\nif < (type) contains [low health puff]?> then\n    set size to (pick random (30) to (60)) %\n    set [brightness v] effect to (pick random (-50) to (-70))\n    set [ghost v] effect to (pick random (20) to (50))\n    go to [back v] layer\n    go [forward v] ((LAYERS - BACKGROUND) + (1)) layers\nend\nif < (type) contains [splat]?> then\n    set size to (15) %\nend\n\nwhen I receive [position tiles v]\nif <(frame) = []> then\n    Spawn - Particles\n    stop [this script v]\nend\nif <(type) = [smoke]> then\n    Tick - Smoke\n    stop [this script v]\nend\nif < (type) contains [radial]?> then\n    Tick - Radial Smoke\n    stop [this script v]\nend\nif <(type) = [focus]> then\n    Tick - Focus\n    stop [this script v]\nend\nif < (type) contains [grass]?> then\n    Tick - Grass\n    stop [this script v]\nend\nif <(type) = [dot]> then\n    Tick - Dot\n    stop [this script v]\nend\nif <(type) = [shell]> then\n    Tick - Bit\n    stop [this script v]\nend\nif <(type) = [door]> then\n    Tick - Bit\n    stop [this script v]\nend\nif <(type) = [glass]> then\n    Tick - Bit\n    stop [this script v]\nend\nif <(type) = [rock]> then\n    Tick - Bit\n    stop [this script v]\nend\nif <(type) = [lifeplant]> then\n    Tick - Bit\n    stop [this script v]\nend\nif <(type) = [nail impact]> then\n    change [frame v] by (1)\n    Position with Costume ((22) + <(frame) > [2]>)\n    set size to (200) %\n    if <(frame) > [4]> then\n        delete this clone\n    end\n    stop [this script v]\nend\nif <(type) = [nail impact big]> then\n    change [frame v] by (1)\n    Position with Costume ((21) + (<(frame) > [2]> + <(frame) > [4]>))\n    set size to (200) %\n    if <(frame) > [6]> then\n        delete this clone\n    end\n    stop [this script v]\nend\nif <(type) = [enemy weapon impact]> then\n    change [frame v] by (1)\n    Position with Costume ((21) + (<(frame) > [2]> + <(frame) > [4]>))\n    set size to (300) %\n    if <(frame) > [6]> then\n        delete this clone\n    end\n    stop [this script v]\nend\nif <(type) = [infection shot]> then\n    Tick Projectile\n    stop [this script v]\nend\nif <(type) = [infection blip]> then\n    Tick Projectile\n    stop [this script v]\nend\nif < (type) contains [shockwave]?> then\n    Tick Shockwave\n    stop [this script v]\nend\nif < (type) contains [low health puff]?> then\n    change [frame v] by (0.5)\n    Position with Costume ((33) + ([floor v] of (frame) ))\n    if <(frame) > [8.5]> then\n        delete this clone\n    end\n    stop [this script v]\nend\nif <(type) = [orange splat]> then\n    set size to (15) %\n    change [frame v] by (1)\n    Position with Costume ((55) + ([floor v] of (frame) ))\n    if <(frame) > [5]> then\n        delete this clone\n    end\n    stop [this script v]\nend\nif <(type) = [falling barrel]> then\n    Tick Barrel\n    stop [this script v]\nend\nif < (type) contains [glob]?> then\n    Tick Glob\n    stop [this script v]\nend\n\ndefine Tick - Smoke\nif <(frame) > [8.5]> then\n    delete this clone\nend\nPosition with Costume ((42) + (([floor v] of (frame) ) mod (9)))\nchange [y v] by (speed y)\nchange [frame v] by (0.5)\n\nset [ghost v] effect to ((frame) * (20))\n\nchange [x v] by (speed x)\n\ndefine Spawn - Particles\nrepeat until <(length of [particles v]) = [0]>\n    set [type v] to (item (1) of [particles v])\n    set [x v] to (item (2) of [particles v])\n    set [y v] to (item (3) of [particles v])\n    if <(PARTICLE INTENSITY) = [Full]> then\n        set [temp v] to [1]\n    end\n    if <(PARTICLE INTENSITY) = [Less]> then\n        if << [_infection shot_orange splat_falling barrel_focus_] contains (join [_] (join (type) [_]))?> or << (type) contains [impact]?> or < (type) contains [shockwave]?>>> then\n            set [temp v] to [1]\n        else\n            set [temp v] to [2]\n        end\n    end\n    if <(PARTICLE INTENSITY) = [Low]> then\n        if << [_infection shot_orange splat_falling barrel_focus_] contains (join [_] (join (type) [_]))?> or << (type) contains [impact]?> or < (type) contains [shockwave]?>>> then\n            set [temp v] to [1]\n        else\n            set [temp v] to [4]\n        end\n    end\n    if <<(pick random (1) to (temp)) = [1]> and <(temp) > [0]>> then\n        create clone of (_myself_ v)\n    end\n    repeat (3)\n        delete (1) of [particles v]\n    end\nend\n\ndefine Position with Costume (costume)\nswitch costume to (big v)\ngo to x: ((x) - (CAMERA X)) y: ((y) - (CAMERA Y))\nswitch costume to (costume)\nshow\n\ndefine Tick - Focus\nchange [frame v] by (0.5)\nset [x v] to ([x v] of [player v])\nset [y v] to ([y v] of [player v])\nset size to (175) %\nPosition with Costume ((2) + (([floor v] of (frame) ) mod (3)))\nif <<([focus v] of [controls v]) = [0]> or <([focus v] of [controls v]) = [-1]>> then\n    delete this clone\nend\nif <([focus v] of [controls v]) < [1]> then\n    Position with Costume ((70) + ([floor v] of (([focus v] of [controls v]) / (2)) ))\nend\n\ndefine Tick - Grass\ngo to [front v] layer\ngo [backward v] ((LAYERS - UI) + (3)) layers\nset [speed x v] to ((speed x) * (0.9))\nif <(speed y) > [-1]> then\n    change [speed y v] by (-0.1)\nend\nif <(frame) > [50]> then\n    delete this clone\nend\nturn right ((dir) * (5)) degrees\nchange [y v] by (speed y)\nchange [x v] by (speed x)\nPosition with Costume (costume)\nchange [frame v] by (1)\nchange [ghost v] effect by (2)\n\ndefine Tick - Dot\ngo to [front v] layer\ngo [backward v] ((LAYERS - UI) + (3)) layers\nset [speed x v] to ((speed x) * (0.9))\nset [speed y v] to [0.5]\nif <(frame) > [25]> then\n    delete this clone\nend\nchange [y v] by (speed y)\nchange [x v] by (speed x)\nset [costume v] to [12]\nPosition with Costume (costume)\nchange [frame v] by (0.5)\nchange [ghost v] effect by (2)\n\ndefine Tick - Bit\ngo to [front v] layer\ngo [backward v] ((LAYERS - UI) + (3)) layers\nset [speed x v] to ((speed x) * (0.9))\nif <(type) = [rock]> then\n    if <(speed y) > [-5]> then\n        change [speed y v] by (-1)\n    end\nelse\n    if <(speed y) > [-3]> then\n        change [speed y v] by (-0.5)\n    end\nend\nif <(frame) > [50]> then\n    delete this clone\nend\nturn right ((dir) * (5)) degrees\nchange [y v] by (speed y)\nchange [x v] by (speed x)\nPosition with Costume (costume)\nchange [frame v] by (1)\nchange [ghost v] effect by (2)\n\ndefine Tick Projectile\nchange [x v] by (speed x)\nchange [y v] by (speed y)\nchange [speed y v] by (-0.5)\nchange [frame v] by (1)\nPosition with Costume [24]\nif <(type) = [infection shot]> then\n    if <touching (player v)?> then\n        broadcast (player - hurt v)\n    end\nend\nget tile at x: (x) y: (y)\nif <(tile shape) = [#]> then\n    start sound [orange_shot_impact v]\n    add [orange splat] to [particles v]\n    add (x) to [particles v]\n    add (y) to [particles v]\n    delete this clone\nend\n\ndefine get tile at x: (x) y: (y)\nset [tile grid x v] to ([floor v] of ((x) / (32)) )\nset [tile grid y v] to ([floor v] of ((y) / (32)) )\nset [tile index v] to (((1) + (tile grid y)) + ((tile grid x) * (GRID HEIGHT)))\nif <(tile grid y) < [0]> then\n    set [tile v] to []\nelse\n    set [tile v] to (item (tile index) of [tile grid v])\nend\nset [tile shape v] to (item (tile) of [tile shape v])\n\ndefine Tick Shockwave\nchange [frame v] by (0.5)\npoint in direction ((dir) * (90))\nif <([abs v] of (speed x) ) < [6]> then\n    set [speed x v] to ((speed x) * (1.2))\nend\nchange [x v] by (speed x)\nif <(frame) > [7]> then\n    Position with Costume [32]\nelse\n    Position with Costume ((25) + ([floor v] of (frame) ))\nend\nget tile at x: ((x) + ((70) * (dir))) y: ((y) + (16))\nif <<<(frame) > [20]> or <(tile shape) = [#]>> and <(frame) < [100]>> then\n    set [frame v] to [100]\nend\nif <(tile shape) = [#]> then\n    change [x v] by (((0) - (speed x)) * (0.2))\nend\nget tile at x: ((x) + ((70) * (dir))) y: ((y) - (16))\nif <<<(frame) > [20]> or <(tile shape) = []>> and <(frame) < [100]>> then\n    set [frame v] to [100]\nend\nif <(tile shape) = []> then\n    change [x v] by (((0) - (speed x)) * (0.2))\nend\nif <(frame) > [99.5]> then\n    Position with Costume ((32) + (((100) - ([floor v] of (frame) )) * (2)))\nend\nif <(frame) > [101.5]> then\n    delete this clone\nend\nif <touching (player v)?> then\n    broadcast (player - hurt v)\nend\n\nPosition with Costume ((2) + (([floor v] of ((frame) / (2)) ) mod (3)))\n\ndefine Tick - Radial Smoke\nif <(frame) > [8.5]> then\n    delete this clone\nend\nchange [x v] by ((speed x) * ([sin v] of (dir) ))\nchange [y v] by ((speed x) * ([cos v] of (dir) ))\nchange [frame v] by ((4) / (speed x))\nPosition with Costume ((costume) + (([floor v] of (frame) ) mod (9)))\n\nwhen I receive [change menu v]\nset volume to ((SOUND VOLUME) * (10)) %\n\nwhen I start as a clone\nset volume to ((SOUND VOLUME) * (10)) %\n\ndefine Tick Barrel\nset rotation style [all around v]\nchange [frame v] by (1)\nchange [y v] by (-5)\nif <((frame) mod (4)) = [0]> then\n    turn right (45) degrees\nend\nPosition with Costume [61]\nget tile at x: (x) y: (y)\nif <touching (player v)?> then\n    broadcast (player - hurt v)\nend\nif <<<(tile shape) = [#]> or <touching (player v)?>> or <<touching (entity v)?> or <touching (nail v)?>>> then\n    start sound (join [barrel_death_] (pick random (1) to (2)))\n    repeat (3)\n        add [shell] to [particles v]\n        add (x) to [particles v]\n        add (y) to [particles v]\n    end\n    repeat (3)\n        add [infection blip] to [particles v]\n        add (x) to [particles v]\n        add (y) to [particles v]\n    end\n    delete this clone\nend\n\ndefine Tick Glob\nif <(frame) = [1]> then\n    change [x v] by (speed x)\n    change [speed y v] by (-0.5)\n    change [y v] by (speed y)\n    Position with Costume [76]\n    get tile at x: (x) y: (y)\n    if <(tile shape) = [#]> then\n        start sound [orange_shot_impact v]\n        change [frame v] by (1)\n    end\nelse\n    if <(frame) < [11]> then\n        Position with Costume ((76) + ([floor v] of ((frame) / (2)) ))\n        change [frame v] by (1)\n    else\n        Position with Costume [82]\n        if <touching (nail v)?> then\n            start sound [splat_01 v]\n            delete this clone\n        end\n    end\nend\n\nwhen I receive [entity - clear v]\ndelete this clone\n\n@Editor\n\ndefine Generate Level\ndelete all of [tile grid v]\ndelete all of [object idx v]\ndelete all of [object type v]\nadd wall column [3] [3] [3] [3]\nadd wall column [9] [11] [3] [3]\nrepeat ((GRID WIDTH) - (4))\n    add boxed column [5] [15] [2] [3]\nend\nadd wall column [10] [12] [3] [3]\nadd wall column [3] [3] [3] [3]\n\ndefine add wall column (wall) (bottom) (top) (bottom2)\nset [brush v] to [16]\nrepeat (3)\n    add (bottom2) to [tile grid v]\nend\nadd (bottom) to [tile grid v]\nrepeat ((GRID HEIGHT) - (5))\n    add (wall) to [tile grid v]\nend\nadd (top) to [tile grid v]\n\ndefine add boxed column (floor) (ceiling) (air) (floor2)\nrepeat (3)\n    add (floor2) to [tile grid v]\nend\nadd (floor) to [tile grid v]\nrepeat ((GRID HEIGHT) - (5))\n    add (air) to [tile grid v]\nend\nadd (ceiling) to [tile grid v]\n\nwhen I receive [generate level v]\nset [editor v] to [0]\nset [room v] to [1]\ndelete all of [tile grid v]\nbroadcast (LEVEL - Load v) and wait\nif <(length of [tile grid v]) = [0]> then\n    set [grid width v] to [150]\n    set [grid height v] to [40]\n    Generate Level\nend\n\nwhen I receive [move player v]\nif <(EDITOR) < [1]> then\n    stop [this script v]\nend\nget tile at x: ((mouse x) + (CAMERA X)) y: ((mouse y) + (CAMERA Y))\nif <not <mouse down?>> then\n    set [brush v] to [0]\n    stop [this script v]\nend\nif <<(item (chosen brush) of [tile keymap v]) = [2]> or <(item (chosen brush) of [tile keymap v]) = [8]>> then\n    Paint Entity\n    stop [this script v]\nend\nif <(item (chosen brush) of [tile keymap v]) = [5]> then\n    Paint NPC\n    stop [this script v]\nend\nif <(brush) = [0]> then\n    if <(tile) = (chosen brush)> then\n        set [brush v] to [2]\n    else\n        set [brush v] to (chosen brush)\n    end\nend\nif <(brush) = [23]> then\n    set [found index v] to (item # of (brush) in [tile grid v])\n    replace item (found index) of [tile grid v] with [2]\nend\nreplace item (tile index) of [tile grid v] with (brush)\n\ndefine get tile at x: (x) y: (y)\nset [tile grid x v] to ([floor v] of ((x) / (32)) )\nset [tile grid y v] to ([floor v] of ((y) / (32)) )\nset [tile index v] to (((1) + (tile grid y)) + ((tile grid x) * (GRID HEIGHT)))\nset [tile v] to (item (tile index) of [tile grid v])\n\nwhen [1 v] key pressed\nnext brush [1]\n\nwhen [9 v] key pressed\nnext brush [9]\n\nwhen [0 v] key pressed\nif <not <(username) = [FindingPepper3]>> then\n    stop [this script v]\nend\ndelete all of [game data v]\nif <(EDITOR) > [0]> then\n    broadcast (LEVEL - STOP v) and wait\n    broadcast (LEVEL - Save v) and wait\n    set [editor v] to [0]\n    broadcast (LEVEL - Done Loading v) and wait\n    broadcast (LEVEL - Start Game Loop v)\nelse\n    broadcast (LEVEL - STOP v) and wait\n    set [editor v] to [1]\n    set [health v] to (MAX HEALTH)\n    set [soul v] to [0]\n    set [geo v] to [0]\n    set [lifeblood health v] to [0]\n    broadcast (LEVEL - Load v) and wait\n    broadcast (LEVEL - Start Game Loop v)\nend\n\ndefine next brush (key)\nrepeat (length of [tile keymap v])\n    if <(chosen brush) < (length of [tile keymap v])> then\n        change [chosen brush v] by (1)\n    else\n        set [chosen brush v] to [1]\n    end\n    if <(item (chosen brush) of [tile keymap v]) = (key)> then\n        stop [this script v]\n    end\nend\n\nwhen [i v] key pressed\nset [obj # v] to (item # of (tile index) in [object idx v])\nif <(obj #) > [0]> then\n    set [chosen brush v] to (item (obj #) of [object type v])\nelse\n    set [chosen brush v] to (tile)\nend\n\nwhen [l v] key pressed\nif <(EDITOR) < [1]> then\n    stop [this script v]\nend\nask (join [Enter Level Number \(Current ] (join (ROOM) [\)])) and wait\nif <(round (answer)) < [1]> then\n    stop [this script v]\nend\nbroadcast (LEVEL - STOP v) and wait\nbroadcast (LEVEL - Save v) and wait\nset [room v] to (round (answer))\nbroadcast (LEVEL - Load v) and wait\nbroadcast (LEVEL - Start Game Loop - New Level v)\n\nwhen [r v] key pressed\nif <(EDITOR) < [1]> then\n    stop [this script v]\nend\nask [Are you sure you want to reset your level? \[Y/N\]] and wait\nif <not <(answer) = [Y]>> then\n    stop [this script v]\nend\nbroadcast (LEVEL - STOP v) and wait\nask (join [Enter Level Width \(Current: ] (join (GRID WIDTH) [\)])) and wait\nif <not <(answer) = []>> then\n    set [grid width v] to (answer)\nend\nask (join [Enter Level Height \(Current: ] (join (GRID HEIGHT) [\)])) and wait\nif <not <(answer) = []>> then\n    set [grid height v] to (answer)\nend\nGenerate Level\nbroadcast (LEVEL - Done Loading v) and wait\nbroadcast (LEVEL - Start Game Loop - New Level v)\n\ndefine Paint Entity\nif <(brush) > [0]> then\n    stop [this script v]\nend\nset [brush v] to (chosen brush)\nset [found index v] to (item # of (tile index) in [object idx v])\nif <(found index) > [0]> then\n    delete (found index) of [object idx v]\n    delete (found index) of [object type v]\nelse\n    add (tile index) to [object idx v]\n    add (brush) to [object type v]\nend\nbroadcast (ENTITY - Clear v)\nbroadcast (ENTITY - Setup v)\n\nwhen [b v] key pressed\nif <(EDITOR) < [1]> then\n    stop [this script v]\nend\nchange [background v] by (1)\nif <(BACKGROUND) > [3]> then\n    set [background v] to [1]\nend\n\nwhen [2 v] key pressed\nnext brush [2]\n\nwhen [3 v] key pressed\nnext brush [3]\n\nwhen [4 v] key pressed\nnext brush [4]\n\ndefine Paint NPC\nif <(brush) > [0]> then\n    stop [this script v]\nend\nset [brush v] to (chosen brush)\nset [found index v] to (item # of (tile index) in [npc index v])\nif <(found index) > [0]> then\n    delete (found index) of [npc index v]\n    delete (found index) of [npc type v]\nelse\n    add (tile index) to [npc index v]\n    add (brush) to [npc type v]\nend\nbroadcast (ENTITY - Clear v)\nbroadcast (ENTITY - Setup v)\n\nwhen [5 v] key pressed\nnext brush [5]\n\nwhen [8 v] key pressed\nnext brush [8]\n\nwhen [6 v] key pressed\nnext brush [6]\n\n@Menu/UI\n\nwhen I receive [level - start game loop v]\nhide\ndelete this clone\n\nwhen I receive [level - start game loop - new level v]\nhide\ndelete this clone\n\nwhen I receive [level - start game loop - respawn v]\ngo to [back v] layer\nset [ghost v] effect to (0)\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\ndelete this clone\n\nwhen I receive [level - continue game loop v]\nset [ghost v] effect to (0)\nrepeat (10)\n    change [ghost v] effect by (20)\nend\nhide\ndelete this clone\n\nwhen I receive [game - pause v]\nwait (0.1) seconds\nset [menu screen v] to [pause]\nset [ghost v] effect to (100)\nshow\nClone at [0] [40] Costume [Continue] []\nClone at [0] [15] Costume [Options] []\nClone at [0] [-10] Costume [Achievements] []\nClone at [0] [-35] Costume [Quit] []\nset [costume v] to []\ngo to x: (0) y: (0)\nswitch costume to (pause fleurs v)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\nwhen I receive [tick menu v]\nchange [ghost v] effect by (-10)\nif <(costume) = []> then\n    if < (MENU SCREEN) contains [pause]?> then\n        go to [front v] layer\n        go [backward v] (1) layers\n    end\n    if <([pause v] of [controls v]) = [2]> then\n        set [menu screen v] to []\n    end\n    stop [this script v]\nend\ngo to [front v] layer\ngo [backward v] (1) layers\nif <(costume) < [0]> then\n    Special Buttons\n    stop [this script v]\nend\nif << (costume [name v]) contains [No]?> or < (costume [name v]) contains [Yes]?>> then\n    if <(TEXT) > []> then\n        delete this clone\n    end\nend\nif <<([abs v] of ((x position) - (mouse x)) ) < [60]> and <([abs v] of ((y position) - (mouse y)) ) < [10]>> then\n    if <(costume [number v]) = (costume)> then\n        start sound [ui_change_selection v]\n    end\n    switch costume to ((costume) + (1))\n    if <mouse down?> then\n        Click\n    end\nelse\n    switch costume to (costume)\n    if < (costume [name v]) contains [ Particle]?> then\n        if < (costume [name v]) contains (PARTICLE INTENSITY)?> then\n            switch costume to ((costume) + (1))\n        end\n    end\nend\n\nwhen I receive [game - stop v]\nset [ghost v] effect to (0)\nrepeat (10)\n    change [ghost v] effect by (20)\nend\nhide\ndelete this clone\n\nwhen I receive [main menu v]\nwait (0.1) seconds\nset [menu screen v] to [main]\nset [ghost v] effect to (0)\nshow\ngo to x: (0) y: (0)\nswitch costume to (new game v)\nset [costume v] to (costume [number v])\ncreate clone of (_myself_ v)\ngo to x: (0) y: (-25)\nswitch costume to (load v)\nset [costume v] to (costume [number v])\ncreate clone of (_myself_ v)\ngo to x: (0) y: (-50)\nswitch costume to (options v)\nset [costume v] to (costume [number v])\ncreate clone of (_myself_ v)\ngo to x: (0) y: (-75)\nswitch costume to (stop v)\nset [costume v] to (costume [number v])\ncreate clone of (_myself_ v)\nset [costume v] to []\ngo to x: (0) y: (0)\nswitch costume to (menubackground v)\n\nwhen I receive [main menu v]\ndelete this clone\n\nwhen I receive [aquire item v]\nif <(costume) = []> then\n    go to [front v] layer\n    start sound [spell_information_screen v]\n    set [ghost v] effect to (100)\n    switch costume to (map_prompt v)\n    show\n    repeat (10)\n        change [ghost v] effect by (-10)\n    end\n    wait until <not <key (space v) pressed?>>\n    wait until <key (space v) pressed?>\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    set [ghost v] effect to (100)\n    hide\n    go [backward v] (LAYERS - UI) layers\nend\n\nwhen I receive [change menu v]\ndelete this clone\n\nwhen I receive [game - pause v]\ndelete this clone\n\nwhen I receive [change menu v]\nwait (0.1) seconds\nif < (MENU SCREEN) contains [options]?> then\n    set [ghost v] effect to (100)\n    show\n    Clone at [0] [20] Costume [Particles] []\n    Clone at [0] [-5] Costume [Audio] []\n    Clone at [0] [-30] Costume [Controls] []\n    Clone at [0] [-55] Costume [Back] []\nend\nif < (MENU SCREEN) contains [particles]?> then\n    set [ghost v] effect to (100)\n    show\n    Clone at [0] [25] Costume [Full Particle] []\n    Clone at [0] [5] Costume [Less Particle] []\n    Clone at [0] [-15] Costume [Low Particle] []\n    Clone at [0] [-35] Costume [Back] []\nend\nif < (MENU SCREEN) contains [audio]?> then\n    set [ghost v] effect to (100)\n    show\n    Clone at [0] [5] Costume [number1] [-1]\n    Clone at [-20] [5] Costume [Sound Audio Down] [-3]\n    Clone at [20] [5] Costume [Sound Audio Up] [-4]\n    Clone at [0] [-30] Costume [number1] [-2]\n    Clone at [-20] [-30] Costume [Sound Audio Down] [-5]\n    Clone at [20] [-30] Costume [Sound Audio Up] [-6]\n    Clone at [0] [-50] Costume [Back] []\n    if < (MENU SCREEN) contains [pause]?> then\n        set [costume v] to []\n        go to x: (0) y: (0)\n        switch costume to (options fleurs2 v)\n        repeat (10)\n            change [ghost v] effect by (-10)\n        end\n        stop [this script v]\n    end\n    if < (MENU SCREEN) contains [main]?> then\n        set [costume v] to []\n        go to x: (0) y: (0)\n        switch costume to (menubackground3 v)\n        repeat (10)\n            change [ghost v] effect by (-10)\n        end\n        stop [this script v]\n    end\nend\nif < (MENU SCREEN) contains [controls]?> then\n    set [ghost v] effect to (100)\n    show\n    Clone at [-73] [11] Costume [d] [-8]\n    Clone at [-73] [-23] Costume [a] [-7]\n    Clone at [-73] [-58] Costume [w] [-9]\n    Clone at [23] [11] Costume [s] [-10]\n    Clone at [23] [-23] Costume [space] [-11]\n    Clone at [23] [-58] Costume [j] [-12]\n    Clone at [118] [11] Costume [k] [-13]\n    Clone at [118] [-23] Costume [m] [-15]\n    Clone at [118] [-58] Costume [p] [-14]\n    Clone at [0] [-90] Costume [Back] []\n    if < (MENU SCREEN) contains [pause]?> then\n        set [costume v] to []\n        go to x: (0) y: (0)\n        switch costume to (controls menu v)\n        repeat (10)\n            change [ghost v] effect by (-10)\n        end\n        stop [this script v]\n    end\n    if < (MENU SCREEN) contains [main]?> then\n        set [costume v] to []\n        go to x: (0) y: (0)\n        switch costume to (menubackground4 v)\n        repeat (10)\n            change [ghost v] effect by (-10)\n        end\n        stop [this script v]\n    end\nend\nif < (MENU SCREEN) contains [achievements]?> then\n    set [ghost v] effect to (100)\n    show\n    Clone at [40] [40] Costume [ach_falsehood] [-20]\n    Clone at [40] [5] Costume [ach_grubfriend] [-21]\n    Clone at [40] [-30] Costume [ach_cartographer] [-22]\n    Clone at [40] [-65] Costume [ach_wealth] [-23]\n    Clone at [0] [-90] Costume [Back] []\n    set [costume v] to []\n    go to x: (0) y: (0)\n    switch costume to (achievements menu v)\n    repeat (10)\n        change [ghost v] effect by (-10)\n    end\n    stop [this script v]\nend\nif < (MENU SCREEN) contains [main]?> then\n    set [costume v] to []\n    go to x: (0) y: (0)\n    switch costume to (menubackground2 v)\n    set [ghost v] effect to (0)\n    stop [this script v]\nend\nif < (MENU SCREEN) contains [pause]?> then\n    set [costume v] to []\n    go to x: (0) y: (0)\n    switch costume to (options fleurs v)\n    repeat (10)\n        change [ghost v] effect by (-10)\n    end\n    stop [this script v]\nend\n\nwhen I start as a clone\nset volume to ((SOUND VOLUME) * (10)) %\n\nwhen I receive [yes/no question v]\nif <(costume) = []> then\n    show\n    go to x: (-75) y: (40)\n    switch costume to (yes v)\n    set [costume v] to (costume [number v])\n    create clone of (_myself_ v)\n    go to x: (75) y: (40)\n    switch costume to (no v)\n    set [costume v] to (costume [number v])\n    create clone of (_myself_ v)\n    hide\n    go to x: (0) y: (0)\n    set [costume v] to []\nend\n\nwhen I receive [tick menu v]\nset volume to ((SOUND VOLUME) * (10)) %\n\nwhen I receive [new diolouge v]\nrepeat (10)\n    change [ghost v] effect by (20)\nend\nhide\ndelete this clone\n\ndefine Clone at (x) (y) Costume (costume) (type)\ngo to x: (x) y: (y)\nswitch costume to (costume)\nif <(type) = []> then\n    set [costume v] to (costume [number v])\nelse\n    set [costume v] to (type)\nend\ncreate clone of (_myself_ v)\n\ndefine Special Buttons\nif <(costume) = [-1]> then\n    switch costume to (join [number] (SOUND VOLUME))\nend\nif <(costume) = [-2]> then\n    switch costume to (join [number] (MUSIC VOLUME))\nend\nif <<(costume) < [-6]> and <(costume) > [-20]>> then\n    if <(round (item ((0) - ((costume) + (6))) of [controls v])) = (item ((0) - ((costume) + (6))) of [controls v])> then\n        switch costume to (join [number] (item ((0) - ((costume) + (6))) of [controls v]))\n    else\n        switch costume to (item ((0) - ((costume) + (6))) of [controls v])\n    end\nend\nif <(costume) < [-19]> then\n    if <[inventory v] contains (costume [name v])?> then\n        set [brightness v] effect to (0)\n    else\n        set [brightness v] effect to (-60)\n    end\nend\nif <(click cooldown) > [0]> then\n    change [click cooldown v] by (-1)\n    stop [this script v]\nend\nif <(click cooldown) < [-1]> then\n    change [click cooldown v] by (1)\n    stop [this script v]\nend\nif <<([abs v] of ((x position) - (mouse x)) ) < [30]> and <([abs v] of ((y position) - (mouse y)) ) < [10]>> then\n    if <mouse down?> then\n        if <(costume) > [-7]> then\n            set [click cooldown v] to [5]\n        else\n            set [click cooldown v] to [-5]\n            start sound [ui_button_confirm v]\n        end\n        if <(costume) = [-3]> then\n            change [sound volume v] by (-1)\n        end\n        if <(costume) = [-4]> then\n            change [sound volume v] by (1)\n        end\n        if <(costume) = [-5]> then\n            change [music volume v] by (-1)\n        end\n        if <(costume) = [-6]> then\n            change [music volume v] by (1)\n        end\n        if <(MUSIC VOLUME) > [9]> then\n            set [music volume v] to [9]\n        end\n        if <(SOUND VOLUME) > [9]> then\n            set [sound volume v] to [9]\n        end\n        if <(MUSIC VOLUME) < [0]> then\n            set [music volume v] to [0]\n        end\n        if <(SOUND VOLUME) < [0]> then\n            set [sound volume v] to [0]\n        end\n    end\nend\nif <(costume) < [-6]> then\n    if <(click cooldown) = [-1]> then\n        if <mouse down?> then\n            set [click cooldown v] to [0]\n            start sound [ui_change_selection v]\n        else\n            Check Keys\n            if <(pressed key) > []> then\n                set [click cooldown v] to [0]\n                replace item ((0) - ((costume) + (6))) of [controls v] with (pressed key)\n            end\n        end\n    end\nend\n\ndefine Check Keys\nset [pressed key v] to [1]\nrepeat (length of [keys v])\n    if <key ((item (pressed key) of [keys v]) v) pressed?> then\n        set [pressed key v] to (item (pressed key) of [keys v])\n        stop [this script v]\n    end\n    change [pressed key v] by (1)\nend\nset [pressed key v] to []\n\nCheck Keys\n\nwhen I receive [level - stop v]\nhide\n\ndefine Click\nstart sound [ui_button_confirm v]\nif < (costume [name v]) contains [Continue]?> then\n    set [menu screen v] to []\nend\nif < (costume [name v]) contains [Load]?> then\n    broadcast (Game - load v) and wait\n    set [menu screen v] to []\nend\nif < (costume [name v]) contains [Options]?> then\n    if <(MENU SCREEN) = [main]> then\n        set [menu screen v] to [options main]\n    else\n        set [menu screen v] to [options pause]\n    end\n    broadcast (change menu v) and wait\nend\nif < (costume [name v]) contains [Save]?> then\n    broadcast (Game - Save v) and wait\nend\nif < (costume [name v]) contains [Quit]?> then\n    broadcast (Game - Save to menu v) and wait\nend\nif < (costume [name v]) contains [Particles]?> then\n    if < (MENU SCREEN) contains [main]?> then\n        set [menu screen v] to [particles main]\n    else\n        set [menu screen v] to [particles pause]\n    end\n    broadcast (change menu v) and wait\nend\nif < (costume [name v]) contains [Audio]?> then\n    if < (MENU SCREEN) contains [main]?> then\n        set [menu screen v] to [audio main]\n    else\n        set [menu screen v] to [audio pause]\n    end\n    broadcast (change menu v) and wait\nend\nif < (costume [name v]) contains [Controls]?> then\n    if < (MENU SCREEN) contains [main]?> then\n        set [menu screen v] to [controls main]\n    else\n        set [menu screen v] to [controls pause]\n    end\n    broadcast (change menu v) and wait\nend\nif < (costume [name v]) contains [Achievements]?> then\n    set [menu screen v] to [achievements pause]\n    broadcast (change menu v) and wait\nend\nif < (costume [name v]) contains [Full Particle]?> then\n    set [particle intensity v] to [Full]\n    stop [this script v]\nend\nif < (costume [name v]) contains [Less Particle]?> then\n    set [particle intensity v] to [Less]\n    stop [this script v]\nend\nif < (costume [name v]) contains [Low Particle]?> then\n    set [particle intensity v] to [Low]\n    stop [this script v]\nend\nif < (costume [name v]) contains [Back]?> then\n    if <(MENU SCREEN) = [options main]> then\n        broadcast (Main Menu v) and wait\n        stop [this script v]\n    end\n    if <(MENU SCREEN) = [options pause]> then\n        broadcast (game - pause v) and wait\n        stop [this script v]\n    end\n    if <(MENU SCREEN) = [achievements pause]> then\n        broadcast (game - pause v) and wait\n        stop [this script v]\n    end\n    if < (MENU SCREEN) contains [main]?> then\n        set [menu screen v] to [options main]\n        broadcast (change menu v) and wait\n        stop [this script v]\n    end\n    if < (MENU SCREEN) contains [pause]?> then\n        set [menu screen v] to [options pause]\n        broadcast (change menu v) and wait\n        stop [this script v]\n    end\nend\nif < (costume [name v]) contains [Stop]?> then\n    broadcast (LEVEL - STOP v) and wait\n    wait (0.5) seconds\n    stop [all v]\nend\nif < (costume [name v]) contains [New Game]?> then\n    set [menu screen v] to []\n    broadcast (Game - New Game v)\nend\nif < (costume [name v]) contains [Yes]?> then\n    set [text v] to [Yes]\nend\nif < (costume [name v]) contains [No]?> then\n    set [text v] to [No]\nend\n\nwhen flag clicked\n\n@Diolouge\n\nwhen I receive [new diolouge v]\nif <(is clone?) = [true]> then\n    stop [this script v]\nend\nbroadcast (position tiles v)\nwait until <not <key (space v) pressed?>>\nwait (0) seconds\ngo to [front v] layer\nhide\nset [brightness v] effect to (0)\nif <(ROOM) = [1]> then\n    switch costume to (tut lore backboard v)\n    set size to (100) %\n    go to x: (0) y: (0)\n    set [ghost v] effect to (50)\n    show\n    create clone of (_myself_ v)\n    set size to (80) %\n    set [ghost v] effect to (0)\n    set [brightness v] effect to (50)\nelse\n    switch costume to (text backboard v)\n    set size to (100) %\n    set [ghost v] effect to (50)\n    go to x: (0) y: (80)\n    show\n    create clone of (_myself_ v)\n    set [ghost v] effect to (0)\n    set size to (50) %\nend\nwait until <not <key (space v) pressed?>>\nDialouge\nwait (0.1) seconds\nhide\nwait until <key (space v) pressed?>\n\nwhen flag clicked\nhide\nswitch costume to (m v)\nset size to (50) %\nset [is clone? v] to [false]\n\nwhen I receive [level - continue game loop v]\ndelete this clone\n\nwhen I receive [level - start game loop v]\ndelete this clone\n\nwhen I receive [level - start game loop - respawn v]\ndelete this clone\n\nwhen I receive [new diolouge v]\nif <(size) < [160]> then\n    if <(is clone?) = [true]> then\n        change [layers - ui v] by (-1)\n        delete this clone\n    end\nend\n\nwhen I receive [finish diolouge v]\nif <(is clone?) = [true]> then\n    change [layers - ui v] by (-1)\n    delete this clone\nend\n\ndefine Quick Dialouge\nshow\nrepeat ((length of (TEXT)) - ((letter num) - (1)))\n    set [letter v] to (letter (letter num) of (TEXT))\n    switch costume to (letter)\n    create clone of (_myself_ v)\n    change x by (round ((size) / (12.5)))\n    change [letter num v] by (1)\n    if <<(x position) > [100]> and <(letter) = [ ]>> then\n        set x to (-120)\n        change y by (-10)\n    end\nend\nhide\n\ndefine Dialouge\ngo to x: (-120) y: (85)\nset [letter num v] to [1]\nrepeat until <(letter num) > (length of (TEXT))>\n    Write Letters [2]\n    if <key (space v) pressed?> then\n        Quick Dialouge\n        wait (0.2) seconds\n        stop [this script v]\n    end\nend\n\nset [letter v] to (letter (letter num) of (TEXT))\nswitch costume to (letter)\nshow\ncreate clone of (_myself_ v)\nhide\nchange x by (round ((size) / (12.5)))\nchange [letter num v] by (1)\nif <<(x position) > [100]> and <(letter) = [ ]>> then\n    set x to (-120)\n    change y by (-10)\nend\n\nwhen I receive [new title v]\nif <(is clone?) = [true]> then\n    stop [this script v]\nend\nwait until <not <key (space v) pressed?>>\ngo to [front v] layer\nshow\nset [brightness v] effect to (0)\nset [ghost v] effect to (100)\nset size to (160) %\nTitle\nhide\n\ndefine Title\ngo to x: (-185) y: (-125)\nset [letter num v] to [1]\nrepeat (length of (TEXT))\n    set [letter v] to (letter (letter num) of (TEXT))\n    switch costume to (letter)\n    create clone of (_myself_ v)\n    change x by (18)\n    change [letter num v] by (1)\nend\n\nwhen I start as a clone\nset [is clone? v] to [true]\nif <not < (costume [name v]) contains [backboard]?>> then\n    repeat (10)\n        change [ghost v] effect by (-10)\n    end\nend\n\nwhen I receive [aquire item v]\nif <(is clone?) = [true]> then\n    change [layers - ui v] by (-1)\n    delete this clone\nend\n\nwhen I receive [change menu v]\nset volume to ((SOUND VOLUME) * (10)) %\n\nwhen I receive [yes/no question v]\nif <(costume [name v]) = [text backboard]> then\n    switch costume to (text backboard large v)\nend\n\nwhen I start as a clone\nif <(size) = [160]> then\n    set [temp v] to (ROOM)\n    wait (3) seconds\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    if <(ROOM) = (temp)> then\n        change [layers - ui v] by (-1)\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nchange [layers - ui v] by (1)\n\ndefine Write Letters (amount)\nshow\nrepeat (amount)\n    set [letter v] to (letter (letter num) of (TEXT))\n    switch costume to (letter)\n    create clone of (_myself_ v)\n    change x by (round ((size) / (12.5)))\n    change [letter num v] by (1)\n    if <(letter num) > (length of (TEXT))> then\n        hide\n        stop [this script v]\n    end\n    if <<(x position) > [100]> and <(letter) = [ ]>> then\n        set x to (-120)\n        change y by (-10)\n    end\nend\nhide\n\n@Background\n\nwhen flag clicked\nset [layers - background v] to [0]\nhide\ngo to [back v] layer\nswitch costume to (size 100% v)\nset size to (200) %\nswitch costume to (dirtmouthbackground2 v)\nset [x v] to [450]\n\nwhen I receive [move enemy v]\nPosition Background\nstamp\n\nwhen I receive [tick menu v]\nif < (MENU SCREEN) contains [main]?> then\n    hide\nend\n\ndefine Position Background\nif <(ROOM) = [48]> then\n    set [screen x v] to ((x) - (CAMERA X))\n    set y to ((480) - (CAMERA Y))\nelse\n    set [screen x v] to ((x) - ((CAMERA X) / (1.5)))\n    set y to (((300) - ((CAMERA Y) / (2))) + (32))\nend\nset x to (screen x)\nswitch costume to (size 100% v)\nset size to (200) %\nif <(ROOM) = [1]> then\n    switch costume to (knigspassbackground2 v)\n    stop [this script v]\nend\nif <(ROOM) = [2]> then\n    switch costume to (dirtmouthbackground2 v)\n    stop [this script v]\nend\nif <(ROOM) = [3]> then\n    switch costume to (wellroombackground3 v)\n    stop [this script v]\nend\nif <<(ROOM) = [4]> or <(ROOM) = [24]>> then\n    if <(ROOM) = [24]> then\n        change x by (-50)\n    end\n    switch costume to (crossroadstallbackground v)\n    stop [this script v]\nend\nif <<<(ROOM) = [6]> or <(ROOM) = [7]>> or <<(ROOM) = [33]> or <(ROOM) = [35]>>> then\n    switch costume to (northcrossroadsbackground v)\n    stop [this script v]\nend\nif <(ROOM) = [8]> then\n    switch costume to (crossroadsbackgroundbridge v)\n    stop [this script v]\nend\nif <(ROOM) = [15]> then\n    switch costume to (crossroadsliftbottombackground2 v)\n    stop [this script v]\nend\nif <(ROOM) = [16]> then\n    switch costume to (crossroadsl16background v)\n    stop [this script v]\nend\nif <(ROOM) = [17]> then\n    switch costume to (hotspringbackground1 v)\n    switch costume to ((costume [number v]) + ([floor v] of (((timer) * (15)) mod (3)) ))\n    stop [this script v]\nend\nif <(ROOM) = [22]> then\n    switch costume to (goamroombackground v)\n    stop [this script v]\nend\nif <(ROOM) = [27]> then\n    switch costume to (fkroombackgroundv2 v)\n    stop [this script v]\nend\nif <(ROOM) = [28]> then\n    switch costume to (shammanoutsidev2 v)\n    stop [this script v]\nend\nif <(ROOM) = [34]> then\n    switch costume to (rightcrossroadstallbackground v)\n    stop [this script v]\nend\nif <(ROOM) = [48]> then\n    switch costume to (blackeggtemple v)\n    stop [this script v]\nend\nswitch costume to (crossroadsmidbackground v)\nif <(ROOM) = [18]> then\n    change y by (125)\nend\n\nwhen I receive [move player v]\nerase all\n\n@HUD\n\nwhen I receive [entity - clear v]\ndelete this clone\n\ndefine Setup\nswitch costume to (soul backboard v)\nset size to (65) %\nset [clone id v] to [1]\ngo to x: (-150) y: (128)\nrepeat ((MAX HEALTH) + (2))\n    create clone of (_myself_ v)\n    change [clone id v] by (1)\n    change x by (18)\nend\ngo to x: (-180) y: (120)\nset size to (80) %\ncreate clone of (_myself_ v)\nchange [clone id v] by (1)\ncreate clone of (_myself_ v)\nchange [clone id v] by (1)\ngo to x: (-150) y: (105)\ncreate clone of (_myself_ v)\nchange [clone id v] by (1)\nrepeat (5)\n    change x by (7)\n    create clone of (_myself_ v)\n    change [clone id v] by (1)\nend\nset [layers - ui v] to (clone id)\nchange [layers - ui v] by (1)\nset [clone id v] to [-1]\nhide\n\nwhen I receive [position tiles v]\nDisplay\n\ndefine Display\nif <(clone id) < [0]> then\n    hide\n    stop [this script v]\nend\nif <not <(ROOM) = (NEW LEVEL)>> then\n    stop [this script v]\nelse\n    show\nend\ngo to [front v] layer\ngo [backward v] (1) layers\nif <not <(clone id) > (MAX HEALTH)>> then\n    if <(HEALTH) < (clone id)> then\n        switch costume to (maskbackboard v)\n    else\n        switch costume to (mask v)\n    end\n    stop [this script v]\nend\nif <(clone id) < ((MAX HEALTH) + (3))> then\n    switch costume to (lifeblood mask v)\n    show\n    if <(LIFEBLOOD HEALTH) < ((clone id) - (MAX HEALTH))> then\n        hide\n    end\n    stop [this script v]\nend\nif <(clone id) = ((MAX HEALTH) + (3))> then\n    switch costume to (soul backboard v)\n    stop [this script v]\nend\nif <(clone id) = ((MAX HEALTH) + (4))> then\n    go to [front v] layer\n    if <(SOUL) > [99]> then\n        switch costume to (soul99 v)\n    else\n        switch costume to (soul0 v)\n        switch costume to ((costume [number v]) + ([floor v] of ((SOUL) / (4.95)) ))\n    end\n    if <(SOUL) > [32]> then\n        set [brightness v] effect to (0)\n    else\n        set [brightness v] effect to (-40)\n    end\n    stop [this script v]\nend\nif <(clone id) = ((MAX HEALTH) + (5))> then\n    if <(GEO) > [0]> then\n        switch costume to (geo v)\n    else\n        switch costume to (n v)\n    end\n    stop [this script v]\nend\nif <(clone id) > ((MAX HEALTH) + (5))> then\n    if <(GEO) > [0]> then\n        switch costume to (join [N] (letter ((clone id) - ((MAX HEALTH) + (6))) of (GEO)))\n    else\n        switch costume to (n v)\n    end\n    stop [this script v]\nend\n\nif <not <([focus v] of [controls v]) > [0]>> then\n    if <not <<(costume [name v]) = [soul0]> or <(costume [name v]) = [soul99]>>> then\n        switch costume to ((costume [number v]) + (round ([sin v] of ((timer) * (500)) )))\n    end\nend\n\nwhen I receive [entity - setup v]\nSetup\n\nshow\n\n@Loading Zone\n\nwhen I receive [move player after enemy v]\nif <(MENU SCREEN) > []> then\n    hide\n    stop [this script v]\nend\nif <(ROOM) = (level)> then\n    stamp\n    show\nelse\n    hide\nend\ngo to x: ((x) - (CAMERA X)) y: ((y) - (CAMERA Y))\ngo to [back v] layer\ngo [forward v] ((LAYERS - BACKGROUND) + (1)) layers\nif <(EDITOR) > [0]> then\n    set [ghost v] effect to (40)\nelse\n    set [ghost v] effect to (0)\n    if <<touching (player v)?> and <([abs v] of ((x) - ([x v] of [player v])) ) < [60]>> then\n        if <<not < (costume [name v]) contains [in]?>> or <<([up v] of [controls v]) = [1]> and <([falling v] of [player v]) = [0]>>> then\n            hide\n            broadcast (LEVEL - STOP v) and wait\n            set [new level v] to (new level)\n            set [hazard respawn x v] to (new x)\n            set [hazard respawn y v] to (new y)\n            wait (0) seconds\n            if < (costume [name v]) contains [in]?> then\n                broadcast (player - exit room - in v) and wait\n            else\n                if < (costume [name v]) contains [up]?> then\n                    broadcast (player - exit room - up v) and wait\n                else\n                    broadcast (player - exit room v) and wait\n                end\n            end\n        end\n    end\nend\nhide\n\ndefine Clone at: (x) (y) (level) new pos: (new x) (new y) (new level) costume: (costume)\nif <(ROOM) = (level)> then\n    set [x v] to (x)\n    set [y v] to (y)\n    set [level v] to (level)\n    set [new x v] to (new x)\n    set [new y v] to (new y)\n    set [new level v] to (new level)\n    switch costume to (costume)\n    create clone of (_myself_ v)\nend\n\ndefine Clone Loading Zones\nClone at: [2830] [975] [1] new pos: [80] [650] [2] costume: [right]\nClone at: [50] [700] [2] new pos: [2800] [940] [1] costume: [left]\nClone at: [3700] [32] [2] new pos: [800] [360] [3] costume: [down]\nClone at: [800] [450] [3] new pos: [3640] [133] [2] costume: [up]\nClone at: [30] [280] [3] new pos: [890] [1200] [4] costume: [left]\nClone at: [920] [1220] [4] new pos: [80] [270] [3] costume: [right]\nClone at: [40] [1220] [4] new pos: [900] [140] [5] costume: [left]\nClone at: [912] [160] [5] new pos: [80] [1200] [4] costume: [right]\nClone at: [912] [647] [4] new pos: [80] [200] [8] costume: [right]\nClone at: [45] [216] [8] new pos: [880] [625] [4] costume: [left]\nClone at: [1400] [220] [8] new pos: [80] [136] [9] costume: [right]\nClone at: [40] [160] [9] new pos: [1350] [200] [8] costume: [left]\nClone at: [1550] [170] [9] new pos: [80] [265] [10] costume: [right]\nClone at: [50] [300] [10] new pos: [1500] [135] [9] costume: [left]\nClone at: [1560] [340] [3] new pos: [80] [140] [6] costume: [right]\nClone at: [45] [160] [6] new pos: [1530] [300] [3] costume: [left]\nClone at: [1230] [160] [6] new pos: [80] [140] [7] costume: [right]\nClone at: [45] [160] [7] new pos: [1200] [140] [6] costume: [left]\nClone at: [1024] [40] [7] new pos: [100] [650] [38] costume: [down]\nClone at: [100] [740] [38] new pos: [1080] [150] [7] costume: [up]\nClone at: [1375] [320] [10] new pos: [100] [200] [38] costume: [right]\nClone at: [70] [225] [38] new pos: [1360] [300] [10] costume: [left]\nClone at: [480] [32] [4] new pos: [375] [645] [15] costume: [down]\nClone at: [384] [770] [15] new pos: [560] [101] [4] costume: [up]\nClone at: [750] [192] [15] new pos: [80] [395] [16] costume: [right]\nClone at: [60] [416] [16] new pos: [740] [165] [15] costume: [left]\nClone at: [64] [192] [15] new pos: [1210] [197] [19] costume: [left]\nClone at: [1234] [216] [19] new pos: [80] [165] [15] costume: [right]\nClone at: [920] [384] [16] new pos: [80] [165] [17] costume: [right]\nClone at: [64] [192] [17] new pos: [890] [357] [16] costume: [left]\nClone at: [894] [224] [16] new pos: [80] [261] [21] costume: [right]\nClone at: [48] [310] [21] new pos: [875] [197] [16] costume: [left]\nClone at: [64] [160] [16] new pos: [730] [709] [18] costume: [left]\nClone at: [750] [736] [18] new pos: [80] [133] [16] costume: [right]\nClone at: [1220] [290] [21] new pos: [80] [160] [22] costume: [right]\nClone at: [64] [160] [22] new pos: [1200] [261] [21] costume: [left]\nClone at: [1984] [224] [22] new pos: [80] [549] [23] costume: [right]\nClone at: [64] [576] [23] new pos: [1950] [197] [22] costume: [left]\nClone at: [352] [800] [23] new pos: [288] [165] [24] costume: [up]\nClone at: [352] [64] [24] new pos: [352] [680] [23] costume: [down]\nClone at: [64] [288] [24] new pos: [700] [133] [25] costume: [left]\nClone at: [736] [180] [25] new pos: [80] [261] [24] costume: [right]\nClone at: [64] [674] [24] new pos: [1680] [293] [26] costume: [left]\nClone at: [1700] [320] [26] new pos: [100] [645] [24] costume: [right]\nClone at: [1024] [64] [10] new pos: [324] [1220] [24] costume: [down]\nClone at: [320] [1370] [24] new pos: [1090] [165] [10] costume: [up]\nClone at: [736] [640] [38] new pos: [80] [133] [39] costume: [right]\nClone at: [0] [160] [39] new pos: [720] [613] [38] costume: [left]\nClone at: [64] [192] [26] new pos: [1250] [133] [27] costume: [left]\nClone at: [1280] [160] [27] new pos: [80] [165] [26] costume: [right]\nClone at: [64] [160] [27] new pos: [960] [133] [28] costume: [left]\nClone at: [992] [160] [28] new pos: [80] [133] [27] costume: [right]\nClone at: [32] [160] [28] new pos: [750] [517] [15] costume: [left]\nClone at: [800] [544] [15] new pos: [120] [133] [28] costume: [right]\nClone at: [32] [288] [19] new pos: [1200] [325] [20] costume: [left]\nClone at: [1248] [352] [20] new pos: [80] [261] [19] costume: [right]\nClone at: [600] [700] [24] new pos: [80] [133] [36] costume: [right]\nClone at: [32] [160] [36] new pos: [575] [677] [24] costume: [left]\nClone at: [860] [200] [23] new pos: [80] [133] [33] costume: [right]\nClone at: [32] [160] [33] new pos: [830] [165] [23] costume: [left]\nClone at: [900] [440] [33] new pos: [200] [133] [34] costume: [up]\nClone at: [256] [32] [34] new pos: [900] [330] [33] costume: [down]\nClone at: [32] [1050] [34] new pos: [1050] [133] [36] costume: [left]\nClone at: [1080] [160] [36] new pos: [80] [1029] [34] costume: [right]\nClone at: [32] [710] [34] new pos: [890] [133] [35] costume: [left]\nClone at: [930] [150] [35] new pos: [80] [677] [34] costume: [right]\nClone at: [625] [133] [6] new pos: [70] [133] [48] costume: [in]\nClone at: [48] [175] [48] new pos: [625] [133] [6] costume: [left]\n\nwhen I receive [entity - clear v]\nhide\ndelete this clone\n\nwhen I receive [entity - setup v]\nhide\nswitch costume to (size 100% v)\nset size to (200) %\nClone Loading Zones\nswitch costume to (costume1 v)\nset [level v] to []\n\nwhen I receive [level - start game loop - respawn v]\nset [new level v] to (ROOM)\n\nwhen I receive [level - start game loop v]\nset [new level v] to (ROOM)\n\n@Mask\n\nwhen I receive [position tiles v]\nif <(ROOM) = (level)> then\n    show\nelse\n    hide\nend\ngo to x: ((x) - (CAMERA X)) y: ((y) - (CAMERA Y))\ngo to [front v] layer\ngo [backward v] ((LAYERS - UI) + (4)) layers\nif <(MENU SCREEN) > []> then\n    stop [this script v]\nend\nif <(EDITOR) > [0]> then\n    set [ghost v] to [80]\n    set [brightness v] effect to (50)\n    set [color v] effect to (50)\nelse\n    set [brightness v] effect to (0)\n    set [color v] effect to (0)\n    if <touching (player v)?> then\n        if <(discovered) = [0]> then\n            set [discovered v] to [1]\n            start sound [secret_discovered_temp v]\n            if <not <[game data v] contains (join (join (join [mk ] (x)) (join [ ] (y))) (join [ ] (ROOM)))?>> then\n                add (join (join (join [mk ] (x)) (join [ ] (y))) (join [ ] (ROOM))) to [game data v]\n            end\n        end\n        if <(ghost) < [100]> then\n            change [ghost v] by (10)\n        else\n            set [ghost v] to [100]\n        end\n    else\n        if <<(ghost) < [100]> and <(ghost) > [0]>> then\n            change [ghost v] by (10)\n        end\n    end\nend\nset [ghost v] effect to (ghost)\n\ndefine Clone at: (x) (y) (level)\nif <(level) = (ROOM)> then\n    set [x v] to (x)\n    set [y v] to (y)\n    set [level v] to (level)\n    if <[game data v] contains (join (join (join [mk] (x)) (join [ ] (y))) (join [ ] (level)))?> then\n        set [discovered v] to [1]\n    else\n        set [discovered v] to [0]\n    end\n    create clone of (_myself_ v)\nend\nnext costume\n\ndefine Clone Masks\nClone at: [880] [590] [1]\nClone at: [1890] [720] [1]\nClone at: [150] [380] [1]\nClone at: [2500] [470] [1]\nClone at: [700] [180] [3]\nClone at: [620] [560] [16]\nClone at: [300] [200] [21]\nClone at: [230] [800] [24]\n\nwhen I receive [entity - setup v]\nhide\nset [ghost v] to [0]\nset [discovered v] to [0]\nswitch costume to (size 100% v)\nset size to (200) %\nswitch costume to (costume1 v)\nClone Masks\nset [level v] to []\n\nwhen I receive [entity - clear v]\ndelete this clone\n\nwhen I receive [tick menu v]\nif <(MENU SCREEN) > []> then\n    hide\n    stop [this script v]\nend\n\nwhen I receive [change menu v]\nset volume to ((SOUND VOLUME) * (10)) %\n\nwhen I start as a clone\nset volume to ((SOUND VOLUME) * (10)) %\n\n@Hazard Respawn Checkpoint\n\nwhen I receive [position tiles v]\nif <(MENU SCREEN) > []> then\n    hide\n    stop [this script v]\nend\nif <(ROOM) = (level)> then\n    show\nelse\n    hide\nend\ngo to x: ((x) - (CAMERA X)) y: ((y) - (CAMERA Y))\ngo to [front v] layer\ngo [backward v] ((LAYERS - UI) + (2)) layers\nif <(EDITOR) > [0]> then\n    set [ghost v] effect to (80)\nelse\n    set [ghost v] effect to (100)\n    if <(NEW LEVEL) = (ROOM)> then\n        if <touching (player v)?> then\n            if <not <<(HAZARD RESPAWN X) = (x)> and <(HAZARD RESPAWN Y) = (y)>>> then\n                set [hazard respawn x v] to (x)\n                set [hazard respawn y v] to (y)\n            end\n        end\n    end\nend\n\ndefine Clone at: (x) (y) (level)\nif <(ROOM) = (level)> then\n    set [x v] to (x)\n    set [y v] to (y)\n    set [level v] to (level)\n    create clone of (_myself_ v)\nend\nnext costume\n\ndefine Clone Checkpoints\nClone at: [530] [260] [1]\nClone at: [1370] [485] [1]\nClone at: [1780] [680] [1]\nClone at: [2250] [590] [1]\nClone at: [2230] [745] [1]\nClone at: [440] [260] [10]\nClone at: [750] [260] [10]\nClone at: [375] [425] [15]\nClone at: [200] [165] [15]\nClone at: [620] [165] [15]\nClone at: [580] [165] [19]\nClone at: [128] [261] [19]\nClone at: [180] [229] [20]\nClone at: [675] [133] [20]\nClone at: [460] [165] [21]\nClone at: [990] [197] [21]\nClone at: [163] [930] [34]\n\nwhen I receive [entity - setup v]\nhide\nswitch costume to (size 100% v)\nset size to (200) %\nswitch costume to (costume1 v)\nClone Checkpoints\nset [level v] to []\n\nwhen I receive [entity - clear v]\ndelete this clone\n\n@Map\n\nadd [] to [map x v]\nadd [] to [map y v]\nnext costume\n\ndefine Clone Maps\nset [is clone? v] to [1]\nset [i v] to [1]\nset [pin v] to []\nswitch costume to (room 1 v)\nshow\nrepeat (39)\n    if <[levels updated v] contains (i)?> then\n        go to x: ((item (i) of [map x v]) + (16)) y: ((item (i) of [map y v]) - (40))\n        create clone of (_myself_ v)\n    end\n    change [i v] by (1)\n    next costume\nend\nset [pin v] to [knight]\nset [is clone? v] to [0]\nhide\n\nwhen I receive [position tiles v]\nset [ghost v] effect to (30)\nif <not <[inventory v] contains [map]?>> then\n    hide\n    stop [this script v]\nend\ngo to [front v] layer\ngo [backward v] ((LAYERS - UI) + (1)) layers\nif <([map v] of [controls v]) = []> then\n    set [map v] to [0]\n    if <(pin) > []> then\n        hide\n    end\n    delete this clone\nelse\n    if <(pin) > []> then\n        set size to (20) %\n    else\n        set size to (100) %\n    end\n    if <(pin) = [knight]> then\n        show\n        switch costume to (knightpin v)\n        go to [front v] layer\n        go [backward v] (1) layers\n        go to x: (((item (ROOM) of [map x v]) + (16)) + ((round ([x v] of [player v])) / (32))) y: (((item (ROOM) of [map y v]) - (40)) + ((round ([y v] of [player v])) / (32)))\n    end\nend\n\nwhen flag clicked\nhide\ndelete all of [rooms visited v]\nadd [1] to [rooms visited v]\ndelete all of [levels updated v]\n\nwhen I receive [level - start game loop - new level v]\nhide\nif <not <[rooms visited v] contains (ROOM)?>> then\n    add (ROOM) to [rooms visited v]\nend\n\nerase all\nset [i v] to [1]\nswitch costume to (room 1 v)\nshow\nrepeat (39)\n    go to x: (item (i) of [map x v]) y: (item (i) of [map y v])\n    stamp\n    change [i v] by (1)\n    next costume\nend\nset [is clone? v] to [0]\nhide\n\nwhen I receive [move player v]\nif <([map v] of [controls v]) = [1]> then\n    if <(MAP) < [1]> then\n        if <(is clone?) < [1]> then\n            if <[inventory v] contains [map]?> then\n                set [map v] to [1]\n                Clone Maps\n            end\n        end\n    end\nend\n\nadd (costume [name v]) to [pin type v]\nadd (x position) to [pin x v]\nadd (y position) to [pin y v]\nstamp\n\nwhen I receive [sit on bench v]\nif <<(pin) = []> or <(pin) = [knight]>> then\n    Update Map\n    if <[inventory v] contains [map]?> then\n        show\n        go to [front v] layer\n        set size to (100) %\n        repeat (2)\n            switch costume to (costume3 v)\n            wait (0.02) seconds\n            show\n            repeat (10)\n                go to [front v] layer\n                show\n                next costume\n                wait (0.02) seconds\n                show\n            end\n        end\n        hide\n        set [pin v] to [knight]\n    end\nend\n\ndefine Update Map\ngo to x: (150) y: (-105)\nset [i v] to [1]\nrepeat (length of [rooms visited v])\n    if <not <[levels updated v] contains (item (i) of [rooms visited v])?>> then\n        start sound [ui_map_update v]\n        add (item (i) of [rooms visited v]) to [levels updated v]\n        set [pin v] to []\n    end\n    change [i v] by (1)\nend\n\nwhen I receive [aquire item v]\nUpdate Map\n\nwhen I receive [change menu v]\nset volume to ((SOUND VOLUME) * (10)) %\n\nadd (x position) to [map x v]\nadd (y position) to [map y v]\nstamp\nnext costume\n\nwhen I receive [level - start game loop - respawn v]\nhide\n\nreplace item (costume [number v]) of [map x v] with (x position)\nreplace item (costume [number v]) of [map y v] with (y position)\nstamp\nnext costume\n\n@Save\n\ndefine write value (value) delimiter (letter)\nset [encoded v] to (join (encoded) (join (value) (letter)))\n\ndefine save level (level #)\nset [encoded v] to []\nwrite value [1] delimiter [_]\nSave - Tile Grid\nSave - Objects\nSave - NPCs\nrepeat ((level #) - (length of [level store v]))\n    add [] to [level store v]\nend\nreplace item (level #) of [level store v] with (encoded)\n\ndefine load level (level #)\nset [encoded v] to (item (level #) of [level store v])\nset [read index v] to [1]\nread value\nif <not <(value) = [1]>> then\n    stop [this script v]\nend\nLoad - Tile Grid\nLoad - Objects\nLoad - NPCs\n\ndefine read letter\nset [letter v] to (letter (read index) of (encoded))\nchange [read index v] by (1)\n\ndefine read value\nset [value v] to []\nread letter\nrepeat until <<(letter) > [9]> or <(letter) = []>>\n    set [value v] to (join (value) (letter))\n    read letter\nend\n\nwhen I receive [level - save v]\nsave level (ROOM)\n\nwhen I receive [level - load v]\nload level (ROOM)\nbroadcast (LEVEL - Done Loading v) and wait\n\ndefine Save - Tile Grid\nwrite value (GRID WIDTH) delimiter [_]\nwrite value (GRID HEIGHT) delimiter [_]\nwrite value (BACKGROUND) delimiter [_]\nset [tile index v] to [1]\nset [tile v] to (item (tile index) of [tile grid v])\nset [length v] to [0]\nrepeat (GRID HEIGHT)\n    repeat (GRID WIDTH)\n        if <<(length) < [26]> and <(tile) = (item (tile index) of [tile grid v])>> then\n            change [length v] by (1)\n        else\n            if <(tile) = [2]> then\n                set [tile v] to []\n            end\n            write value (tile) delimiter (item (length) of [a to z v])\n            set [tile v] to (item (tile index) of [tile grid v])\n            set [length v] to [1]\n        end\n        change [tile index v] by (GRID HEIGHT)\n    end\n    change [tile index v] by ((1) - ((GRID WIDTH) * (GRID HEIGHT)))\nend\nwrite value (tile) delimiter (item (length) of [a to z v])\n\ndefine Load - Tile Grid\ndelete all of [tile grid v]\nread value\nset [grid width v] to (value)\nread value\nset [grid height v] to (value)\nread value\nset [background v] to (value)\nrepeat ((GRID WIDTH) * (GRID HEIGHT))\n    add [] to [tile grid v]\nend\nset [tile index v] to [1]\nrepeat until <(read index) > (length of (encoded))>\n    read value\n    if <(value) = []> then\n        set [value v] to [2]\n    end\n    repeat (item # of (letter) in [a to z v])\n        replace item (tile index) of [tile grid v] with (value)\n        change [tile index v] by (GRID HEIGHT)\n        if <(tile index) > ((GRID WIDTH) * (GRID HEIGHT))> then\n            change [tile index v] by ((1) - ((GRID WIDTH) * (GRID HEIGHT)))\n            if <(tile index) > (GRID HEIGHT)> then\n                stop [this script v]\n            end\n        end\n    end\nend\n\ndefine Save - Objects\nset [row v] to [1]\nwrite value (length of [object idx v]) delimiter [_]\nrepeat (length of [object idx v])\n    write value (item (row) of [object idx v]) delimiter [_]\n    write value (item (row) of [object type v]) delimiter [_]\n    change [row v] by (1)\nend\n\ndefine Load - Objects\ndelete all of [object idx v]\ndelete all of [object type v]\nread value\nrepeat (value)\n    read value\n    add (value) to [object idx v]\n    read value\n    add (value) to [object type v]\nend\n\ndefine Save - NPCs\nset [row v] to [1]\nwrite value (length of [npc index v]) delimiter [_]\nrepeat (length of [npc index v])\n    write value (item (row) of [npc index v]) delimiter [_]\n    write value (item (row) of [npc type v]) delimiter [_]\n    change [row v] by (1)\nend\n\ndefine Load - NPCs\ndelete all of [npc index v]\ndelete all of [npc type v]\nread value\nrepeat (value)\n    read value\n    add (value) to [npc index v]\n    read value\n    add (value) to [npc type v]\nend\n\ndefine Save game\nset [encoded v] to []\nwrite value (SPAWN X) delimiter [\]\nwrite value (SPAWN Y) delimiter [\]\nwrite value (SPAWN LEVEL) delimiter [_]\nwrite value (GEO) delimiter [_]\nwrite value (MAX HEALTH) delimiter [\]\nwrite value (MAX SOUL) delimiter [_]\nset [i v] to [1]\nrepeat (length of [inventory v])\n    if <(i) = (length of [inventory v])> then\n        write value (item (i) of [inventory v]) delimiter [;]\n    else\n        write value (item (i) of [inventory v]) delimiter [\]\n    end\n    change [i v] by (1)\nend\nif <(length of [inventory v]) = [0]> then\n    write value [] delimiter [;]\nend\nset [i v] to [1]\nrepeat (length of [rooms visited v])\n    if <(i) = (length of [rooms visited v])> then\n        write value (item (i) of [rooms visited v]) delimiter [;]\n    else\n        write value (item (i) of [rooms visited v]) delimiter [\]\n    end\n    change [i v] by (1)\nend\nif <(length of [rooms visited v]) = [0]> then\n    write value [] delimiter [;]\nend\nset [i v] to [1]\nrepeat (length of [game data v])\n    if <(i) = (length of [game data v])> then\n        write value (item (i) of [game data v]) delimiter [;]\n    else\n        write value (item (i) of [game data v]) delimiter [\]\n    end\n    change [i v] by (1)\nend\nif <(length of [game data v]) = [0]> then\n    write value [] delimiter [;]\nend\ndelete all of [current game v]\nadd (encoded) to [current game v]\nadd [Triple-click on the code above and press ctrl + c to copy it.] to [current game v]\nadd [Make sure to paste it somewhere \(ctrl + v\) and keep track of it!] to [current game v]\nadd [press PAUSE to continue \(You may have to click off of the list first\)] to [current game v]\n\ndefine Load game\nset [fail v] to []\nset [read index v] to [1]\nrepeat (2)\n    read value\n    if <not <(round (value)) = (value)>> then\n        set [fail v] to [That save code is invalid! \[Error Code: 11\] Please notify FindingPepper if this was a mistake.]\n        stop [this script v]\n    end\n    if <not <(letter) = [\]>> then\n        set [fail v] to [That save code is invalid! \[Error Code: 10\] Please notify FindingPepper if this was a mistake.]\n        stop [this script v]\n    end\nend\nread value\nif <(item (value) of [level store v]) = []> then\n    set [fail v] to [That save code is invalid! \[Error Code: 21\] Please notify FindingPepper if this was a mistake.]\n    stop [this script v]\nend\nif <not <(letter) = [_]>> then\n    set [fail v] to [That save code is invalid! \[Error Code: 20\] Please notify FindingPepper if this was a mistake.]\n    stop [this script v]\nend\nread value\nif <(value) < [0]> then\n    set [fail v] to [That save code is invalid! \[Error Code: 31\] Please notify FindingPepper if this was a mistake.]\n    stop [this script v]\nend\nif <not <(round (value)) = (value)>> then\n    set [fail v] to [That save code is invalid! \[Error Code: 32\] Please notify FindingPepper if this was a mistake.]\n    stop [this script v]\nend\nif <not <(letter) = [_]>> then\n    set [fail v] to [That save code is invalid! \[Error Code: 30\] Please notify FindingPepper if this was a mistake.]\n    stop [this script v]\nend\nread value\nif <(value) < [1]> then\n    set [fail v] to [That save code is invalid! \[Error Code: 41\] Please notify FindingPepper if this was a mistake.]\n    stop [this script v]\nend\nif <(value) > [10]> then\n    set [fail v] to [That save code is invalid! \[Error Code: 42\] Please notify FindingPepper if this was a mistake.]\n    stop [this script v]\nend\nif <not <(letter) = [\]>> then\n    set [fail v] to [That save code is invalid! \[Error Code: 40\] Please notify FindingPepper if this was a mistake.]\n    stop [this script v]\nend\nread value\nif <not <(value) = [99]>> then\n    set [fail v] to [That save code is invalid! \[Error Code: 51\] Please notify FindingPepper if this was a mistake.]\n    stop [this script v]\nend\nif <not <(letter) = [_]>> then\n    set [fail v] to [That save code is invalid! \[Error Code: 50\] Please notify FindingPepper if this was a mistake.]\n    stop [this script v]\nend\nset [read index v] to [1]\nread value\nset [spawn x v] to (value)\nread value\nset [spawn y v] to (value)\nread value\nset [spawn level v] to (value)\nread value\nset [geo v] to (value)\nread value\nset [max health v] to (value)\nread value\nset [max soul v] to (value)\ndelete all of [game data v]\ndelete all of [inventory v]\ndelete all of [rooms visited v]\nread item\nrepeat until <(letter) = [;]>\n    add (item) to [inventory v]\n    read item\nend\nif <(item) > []> then\n    add (item) to [inventory v]\nend\nread item\nrepeat until <(letter) = [;]>\n    add (item) to [rooms visited v]\n    read item\nend\nif <(item) > []> then\n    add (item) to [rooms visited v]\nend\nread item\nrepeat until <(letter) = [;]>\n    add (item) to [game data v]\n    read item\nend\nif <(item) > []> then\n    add (item) to [game data v]\nend\n\nwhen I receive [game - save v]\nwait (0.5) seconds\nSave game\nhide list [current game v]\nwait until <key ((item (8) of [controls v]) v) pressed?>\nshow list [current game v]\n\nwhen I receive [game - load v]\nwait (0.5) seconds\nask [Paste your save code below \(ctrl + v\)] and wait\nset [encoded v] to (answer)\nLoad game\nif <(fail) > []> then\n    if <(value) > []> then\n        ask (join (fail) [ \(press enter to continue\)]) and wait\n    end\n    if <(MENU SCREEN) > []> then\n        broadcast (Main Menu v)\n    else\n        broadcast (LEVEL - Continue Game Loop v)\n    end\nelse\n    set [menu screen v] to []\n    broadcast (LEVEL - Start Game Loop - Respawn v)\nend\n\nwhen flag clicked\nshow list [current game v]\n\nwhen I receive [game - save to menu v]\nwait (0.5) seconds\nSave game\nset [menu screen v] to [main]\nhide list [current game v]\nwait until <key ((item (8) of [controls v]) v) pressed?>\nshow list [current game v]\nbroadcast (Main Menu v)\n\ndefine read item\nset [item v] to []\nread value\nrepeat until <<(letter) = [\]> or <<(letter) = [;]> or <(letter) = []>>>\n    set [item v] to (join (item) (join (value) (letter)))\n    read value\nend\nset [item v] to (join (item) (value))\n\n@Music\n\nwhen I receive [level - start game loop v]\nset [action music v] to [0]\nStart Music\n\nwhen I receive [level - start game loop - respawn v]\nset [action music v] to [0]\nStart Music\n\ndefine Ambience\nset [tempa v] to (item (ROOM) of [tracks ambience levels v])\nforever\n    if <(EDITOR) < [1]> then\n        if < (tempa) contains [N]?> then\n            if <(ROOM) = [5]> then\n                if <(GRUBS) = [0]> then\n                    play sound (tempa) until done\n                else\n                    play sound [A2-1 v] until done\n                    play sound [A2-2 v] until done\n                end\n            else\n                play sound (tempa) until done\n            end\n        else\n            play sound (join (join [A] (tempa)) [-1]) until done\n            play sound (join (join [A] (tempa)) [-2]) until done\n        end\n    end\nend\n\ndefine Music - Main\nset [tempm v] to (item (ROOM) of [tracks main levels v])\nforever\n    if <(EDITOR) < [1]> then\n        if < (MENU SCREEN) contains [main]?> then\n            play sound [Title1 v] until done\n            play sound [Title2 v] until done\n        else\n            play sound (join (join [M] (tempm)) [-1]) until done\n            play sound (join (join [M] (tempm)) [-2]) until done\n            play sound (join (join [M] (tempm)) [-3]) until done\n        end\n    end\nend\n\nif <(ROOM) = [2]> then\n    play sound [M1-1 v] until done\n    play sound [M1-2 v] until done\nend\nif <<(ROOM) > [2]> and <(ROOM) < [42]>> then\n    if <<(ROOM) = [17]> or <(ROOM) = [25]>> then\n        play sound [M3-1 v] until done\n        play sound [M3-2 v] until done\n    else\n        if <(ROOM) = [5]> then\n            if <(GRUBS) = [0]> then\n                play sound [N2 v] until done\n            end\n        else\n            if <not <<<(ROOM) = [7]> or <(ROOM) = [28]>> or <<<(ROOM) = [38]> or <(ROOM) = [25]>> or <<(ROOM) = [6]> or <(ROOM) = [27]>>>>> then\n                play sound [M2-1 v] until done\n                play sound [M2-2 v] until done\n                play sound [M2-3 v] until done\n            end\n        end\n    end\nend\n\nwhen I receive [level - start game loop - new level v]\nif <<not <(item (ROOM) of [tracks main levels v]) = (current main)>> or <not <(item (ROOM) of [tracks ambience levels v]) = (current ambience)>>> then\n    Start Music\nend\n\ndefine Music - Bass\nset [tempb v] to [0]\nforever\n    if <(EDITOR) < [1]> then\n        play sound (join (join [B] (tempb)) [-1]) until done\n        play sound (join (join [B] (tempb)) [-2]) until done\n        play sound (join (join [B] (tempb)) [-3]) until done\n    end\nend\n\nif <<(ROOM) > [2]> and <(ROOM) < [42]>> then\n    if <not <<<(ROOM) = [5]> or <(ROOM) = [25]>> or <<(ROOM) = [17]> or <<(ROOM) = [27]> or <(ROOM) = [28]>>>>> then\nend\n\nwhen I receive [main menu v]\nwait (0.1) seconds\nset volume to ((MUSIC VOLUME) * (10)) %\nbroadcast (Start Music - Main v)\n\nwhen I start as a clone\nMusic - Action - Toggle\n\ndefine Music - Action\nforever\n    if <(EDITOR) < [1]> then\n        if <(ROOM) = [27]> then\n            if <(ARENA PROGRESS) > [0]> then\n                play sound [E1-1 v] until done\n                play sound [E1-2 v] until done\n                play sound [E1-3 v] until done\n            end\n        else\n            play sound [C2-1 v] until done\n            play sound [C2-2 v] until done\n            play sound [C2-3 v] until done\n        end\n    end\nend\n\ndefine Music - Action - Toggle\nforever\n    if <<(ARENA PROGRESS) > [0]> or <(ACTION MUSIC) > [0]>> then\n        set volume to ((MUSIC VOLUME) * (10)) %\n    else\n        set volume to (0) %\n    end\nend\n\nwhen I start as a clone\nMusic - Action\n\nwhen I receive [main menu v]\ndelete this clone\n\nwhen I receive [level - start game loop - new level v]\nset [action music v] to [0]\nif <not <(item (ROOM) of [tracks main levels v]) = (current main)>> then\n    delete this clone\nend\n\nwhen I receive [level - start game loop - respawn v]\ndelete this clone\n\nwhen I receive [level - start game loop v]\ndelete this clone\n\nwhen I receive [change menu v]\nset volume to ((MUSIC VOLUME) * (10)) %\n\nif <(ROOM) < [3]> then\n    play sound [A1-1 v] until done\nend\nif <<(ROOM) > [2]> and <(ROOM) < [42]>> then\n    if <(ROOM) = [17]> then\n        play sound [A3-1 v] until done\n    else\n        if <(ROOM) = [15]> then\n            play sound [N1 v] until done\n        else\n            play sound [A2-1 v] until done\n            play sound [A2-2 v] until done\n        end\n    end\nend\n\nwhen I receive [start music - ambience v]\nif <(clone) = [0]> then\n    Ambience\nend\n\nwhen I receive [start music - main v]\nif <(clone) = [0]> then\n    Music - Main\nend\n\nwhen I receive [start music - bass v]\nif <(clone) = [0]> then\n    Music - Bass\nend\n\nwhen I receive [start music - action v]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nset [clone v] to [1]\n\nwhen flag clicked\nset [clone v] to [0]\nset [current main v] to [-]\n\ndefine Start Music\nif <(clone) = [0]> then\n    stop [other scripts in sprite v]\n    wait (0.01) seconds\n    set volume to ((MUSIC VOLUME) * (10)) %\n    broadcast (Start Music - Ambience v)\n    broadcast (Start Music - Main v)\n    broadcast (Start Music - Bass v)\n    wait (0) seconds\n    broadcast (Start Music - Action v)\n    set [current main v] to (item (ROOM) of [tracks main levels v])\n    set [current ambience v] to (item (ROOM) of [tracks ambience levels v])\nelse\n    delete this clone\nend\n\nplay sound [N2 v] until done\n\nplay sound [C2-1 v] until done\n\nset volume to ((MUSIC VOLUME) * (10)) %\n\n@Controls\n\nwhen I receive [check controls v]\nif < (MENU SCREEN) contains [main]?> then\n    stop [this script v]\nend\nif <(focus) < [0]> then\n    change [focus v] by (1)\nend\nif <<([solid v] of [player v]) > []> and <not <([player action v] of [player v]) = [sit]>>> then\n    if <key ((item (7) of [controls v]) v) pressed?> then\n        if <not <(focus) < [0]>> then\n            if <(focus) > [0]> then\n                Focus\n                stop [this script v]\n            else\n                if <(SOUL) > [32]> then\n                    if <(x axis) = [0]> then\n                        Focus\n                        stop [this script v]\n                    end\n                end\n            end\n        end\n    else\n        if <(focus) > [0]> then\n            if <(focus) < [16]> then\n                set [soul v] to (temp)\n            end\n            set [focus v] to [0]\n        end\n    end\nend\nset [left v] to (round <key ((item (1) of [controls v]) v) pressed?>)\nset [right v] to (round <key ((item (2) of [controls v]) v) pressed?>)\nif <key ((item (3) of [controls v]) v) pressed?> then\n    change [up v] by (1)\nelse\n    set [up v] to [0]\nend\nif <key ((item (4) of [controls v]) v) pressed?> then\n    change [down v] by (1)\nelse\n    set [down v] to [0]\nend\nif <<key ((item (9) of [controls v]) v) pressed?> and <[inventory v] contains [map]?>> then\n    change [map v] by (1)\n    set [jump v] to [0]\n    set [sword v] to []\n    set [y axis v] to [0]\nelse\n    set [y axis v] to (((up) / ([abs v] of (up) )) - ((down) / ([abs v] of (down) )))\n    set [map v] to []\n    set [jump v] to <key ((item (5) of [controls v]) v) pressed?>\n    if <key ((item (6) of [controls v]) v) pressed?> then\n        change [sword v] by (1)\n    else\n        set [sword v] to []\n    end\nend\nif <key ((item (8) of [controls v]) v) pressed?> then\n    change [pause v] by (1)\n    if <(MENU SCREEN) > []> then\n        change [pause v] by (1)\n    end\nelse\n    set [pause v] to []\nend\nif <<<([special action v] of [player v]) = [land hard]> or <<(SPAWN Y) = [1550]> and <(ROOM) = [1]>>> and <(EDITOR) < [1]>> then\n    set [x axis v] to [0]\n    set [jump v] to [0]\n    set [sword v] to []\n    set [y axis v] to [0]\nelse\n    set [x axis v] to (((right) / ([abs v] of (right) )) - ((left) / ([abs v] of (left) )))\nend\nif <(EDITOR) > [0]> then\n    set [x axis v] to (((right) / ([abs v] of (right) )) - ((left) / ([abs v] of (left) )))\n    set [y axis v] to (((up) / ([abs v] of (up) )) - ((down) / ([abs v] of (down) )))\nend\n\ndefine Focus\nchange [focus v] by (1)\nif <(focus) = [1]> then\n    set [temp v] to (SOUL)\n    add [focus] to [particles v]\n    add ([x v] of [player v]) to [particles v]\n    add ([y v] of [player v]) to [particles v]\nend\nif <(SOUL) > [0]> then\n    change [soul v] by (-1)\n    if <((focus) mod (5)) = [1]> then\n        start sound (join [healing] ((([floor v] of ((focus) / (5)) ) mod (6)) + (1)))\n    end\nelse\n    set [focus v] to [0]\nend\nif <(focus) > [32]> then\n    start sound [focus_health_heal v]\n    set [focus v] to [-10]\n    change [health v] by (1)\n    broadcast (health healed v)\nend\nif <(HEALTH) > (MAX HEALTH)> then\n    set [health v] to (MAX HEALTH)\nend\n\nwhen I receive [change menu v]\nset volume to ((SOUND VOLUME) * (10)) %\n\n@Border/Transition\n\nwhen I receive [position tiles v]\ngo to [front v] layer\ngo [backward v] ((LAYERS - UI) - (1)) layers\ngo to x: (0) y: (0)\nif <(EDITOR) > [0]> then\n    hide\nelse\n    show\nend\n\nwhen I receive [player - exit room v]\nswitch costume to (normal v)\nwait (0.3) seconds\nrepeat until <(costume [name v]) = [Loading]>\n    next costume\nend\n\nwhen I receive [level - start game loop v]\nswitch costume to (loading v)\nrepeat until <(costume [name v]) = [Normal]>\n    switch costume to ((costume [number v]) - (1))\nend\nswitch costume to (normal v)\n\nwhen I receive [level - start game loop - respawn v]\nswitch costume to (loading v)\nrepeat until <(costume [name v]) = [Normal]>\n    switch costume to ((costume [number v]) - (1))\nend\nswitch costume to (normal v)\n\nwhen I receive [level - start game loop - new level v]\nswitch costume to (loading v)\ngo to [front v] layer\nwait (0.2) seconds\nrepeat until <(costume [name v]) = [Normal]>\n    switch costume to ((costume [number v]) - (1))\nend\nswitch costume to (normal v)\n\nwhen I receive [player - hurt v]\nif <([invulnerable v] of [player v]) < [1]> then\n    switch costume to (normal v)\n    repeat (3)\n        next costume\n    end\n    wait (0.08) seconds\n    repeat (3)\n        switch costume to ((costume [number v]) - (1))\n    end\nend\nswitch costume to (normal v)\n\nwhen I receive [game - stop v]\nswitch costume to (normal v)\nwait (0.3) seconds\nrepeat until <(costume [name v]) = [Loading]>\n    next costume\nend\n\nwhen I receive [tick menu v]\nshow\ngo to [front v] layer\ngo to x: (0) y: (0)\n\nwhen I receive [player - hurt - double v]\nif <([invulnerable v] of [player v]) < [1]> then\n    switch costume to (normal v)\n    repeat (6)\n        next costume\n    end\n    wait (0.05) seconds\n    repeat (6)\n        switch costume to ((costume [number v]) - (1))\n    end\nend\nswitch costume to (normal v)\n\nif <(HEALTH) < [2]> then\n    switch costume to (transition13 v)\nelse\n    switch costume to (normal2 v)\nend\n\nwhen I receive [player - exit room - up v]\nswitch costume to (normal v)\nwait (0.3) seconds\nrepeat until <(costume [name v]) = [Loading]>\n    next costume\nend\n\nif <(MAP) < [1]> then\n\nwhen I receive [player - exit room - in v]\nswitch costume to (normal v)\nwait (0.3) seconds\nrepeat until <(costume [name v]) = [Loading]>\n    next costume\nend\n\nwhen I receive [sit on bench v]\nswitch costume to (bench1 v)\nrepeat (3)\n    next costume\nend\nwait (0.03) seconds\nrepeat (3)\n    switch costume to ((costume [number v]) - (1))\nend\nswitch costume to (normal v)\n\nwhen I receive [main menu v]\nswitch costume to (normal v)\n\nwhen I receive [player - hurt - spikes v]\nif <<<([invulnerable v] of [player v]) < [1]> or <([invulnerable v] of [player v]) > [9]>> and <not <<([tile v] of [player v]) = [18]> and <([nail stage v] of [nail v]) > [0]>>>> then\n    switch costume to (transition2 v)\n    repeat (8)\n        next costume\n    end\n    wait (0.2) seconds\n    repeat (10)\n        switch costume to ((costume [number v]) - (1))\n    end\nend\nswitch costume to (normal v)\n\nwhen I receive [lifeblood glow v]\nswitch costume to (lifeblood1 v)\nrepeat (3)\n    next costume\nend\nwait (0.03) seconds\nrepeat (1)\n    next costume\nend\nswitch costume to (normal v)\n\nwhen I receive [finish diolouge v]\ngo to [front v] layer\n\n
This is Hollow Knight: Forgotten Crossroads - In Scratch! It is a fully playable version of the Hollow Knight's first area, the Forgotten Crossroads, including enemies, bosses, grubs, and geo rocks (It doesn't include Sly, Gruz Mother, charms, or the Ancestral Mound, however). I hope to eventually expand this to include more areas, enemies, and features. Enjoy!\n\n---STORY---\nIf you haven't played Hollow Knight, it is a 2D platform RPG set in a ruined underground kingdom of bugs. Most of the inhabitants have succumbed to the infection, a dangerous plague that has spread throughout the kingdom, corrupting bugs. Your goal is to contain the infection, or destroy it completely. There are many areas to explore, and many enemies you encounter. This project only includes the first area, the Forgotten Crossroads.\n\n---CONTROLS---\nYou can view and change controls in the options menu, accessible from the main menu and the pause menu.\nTo open the pause menu press P.\nThe controls are by default set to the default Hollow Knight controls, but I would recommend changing them to WASD, Space for jump, J for nail and K for focus, which I find just a bit more intuitive.\n\n---HOW TO PLAY---\n--The Nail--\nAttack enemies and objects with your nail to hurt them.\nThe direction you are facing determines which direction you swing your nail.\nIf you look up while swinging your nail, you will swing upwards. Same for downwards.\nIf you hit spikes or an enemy while attacking downward, you will bounce a small distance off of them. This can be used to reach places you can't ordinarily reach.\n--Your Health--\nThe five white masks in the upper left are your health.\nIf you touch an enemy, it will hurt you, removing one mask. \nWhen you reach zero masks, you will die.\n--Soul--\nHitting an enemy with your nail will give you a small amount of soul.\nSoul is contained within the large circle in the upper-left.\nWhen your soul vessel is one-third full, you can focus the soul to heal one mask.\nIf your soul vessel is not full enough, it will be gray.\nWhen it gets to one-third full, it turns white.\n--Geo--\nGeo is this game's form of currency.\nYou can get it from enemies and geo rocks.\nGeo has little use in this recreation, however. Shops and such may be added later!\n--NPCs--\nThere are several NPCs (non-player characters) around the world. \nTalk to them by pressing up\nThey may give you helpful information, or offer their services. Sometimes, however, they are entirely useless.\n--Benches--\nSit on a bench by pressing up.\nGet off a bench by pressing down.\nSitting on a bench will restore your health.\nWhen you die, you will return to the last bench you sat on.\n--Grubs--\nYou can find grubs trapped in jars around the world.\nSave them by breaking their jars.\nThe Grubfather, located in the upper left of the Crossroads, will reward you for saving the Grubs.\n--The Shade--\nWhen you die, you will leave an dark stain of your previous life on the world, which takes the form of a black ghost known as the Shade.\nYou must return to where you last died and defeat your Shade to get back your geo.