Read emojunky player/cursor/debug surfaces

Delegated run·Sep 14, 2026  21:03·Prompted by Fable·Run by Sonnet 5Sonnet 5 xhigh
Ctrl + F
Show

Transcript

Fable·21:03:30·Sep 14, 2026Prompter

Read-only survey of C:/Users/a327e/Desktop/a327ex/emojunky/ (an Anchor 3 Lua game). Report conclusions with file:line cites, under ~1800 words, organized by the numbered questions. Do not modify anything.

  1. THE HUMAN'S DRAW. In view.lua find draw_player (rooms 1-3) and draw_dig_human (room 4) and any helpers they call: what rectangle(s) they draw for the body (size in tiles/px, where the origin is relative to the controller's x/y: is p.x, p.y the feet, the center, the top-left?), how facing is drawn, what changes per state (crouch, hang, climb, rope, dead, hurt flash), where the hearts/HP and the "fall damage" floating text are drawn. Also list what controller.lua exposes for state: the exact state names (grep state == / set_state), the facing field, the body width/height constants in tuning.lua (T.body_w, T.body_h or similar), the fields for airborne/grounded, fall time, last damage / hurt flag / HP, and whether there is any "hurt" timestamp a draw could read (e.g. p.hurt_t, p.last_dmg_t, p.dmg). Report how the robot-stage human differs (is it the same controller table? human vs p?).
  2. THE ROBOT'S DRAW: draw_robot — just the size and origin, one paragraph (it stays a rectangle this pass; I only need to know the human and robot draw the same way or not).
  3. THE DEBUG TEXT. List every text the game draws and the function that draws it: the F1 readouts (draw_debug, draw_dig_debug), the help strips at the bottom of rooms 1-3 and room 4, the top HUD in room 4 (draw_hud, draw_dig_hud: DEPTH, the stats line "dig N nuggets N mines N chain N seed N", the clock, the bar), the room labels (draw_labels), the robot marker, the calibration room's pit labels. For each: which layer it goes on now (should be ui_content_layer or bg_layer), which font, and whether debug_on gates it. Where is debug_on initialized (boot.lua) and what key toggles it.
  4. THE CURSOR HOST CONTRACT. Read emoji/cursor.lua fully: what spawn_cursor() needs (a cursor_layer global? a click bind? mouse position source?), what the_cursor:update(dt) and the_cursor:draw() do, whether it hides the OS cursor (engine_set_cursor_visible or similar), and its "pop"/press states and error persona if present. Then look at how a host wires it: grep C:/Users/a327e/Desktop/a327ex/ABAgames/knightvspawns/boot.lua and main.lua for cursor_layer, spawn_cursor, the_cursor, bind('click' and quote the lines (the LAYERS list there appends { 'cursor', outline = true } at the end; note whether the cursor layer gets the camera or stays screen space, and where in draw() the cursor draws).
  5. THE SPRINGS. In emoji/juice.lua: the exact signatures of hitfx_init(self) and what springs it adds (hit, squash_x, squash_y, their freq/bounce/base), spring_pull(spring, name, delta, freq, bounce), hitfx_hit, and how a draw reads them (self.spring.hit.x? self.spring:get('squash_x')?). Cite windrang's player draw at C:/Users/a327e/Desktop/a327ex/ABAgames/windrang/main.lua:536-545 and its hitfx_init call at ~280 for the pattern, plus the image_draw/layer_image call form it uses to draw slight_smile scaled (function name and argument order), and how dizzy_img is loaded (main.lua ~93). In emojunky, slight_smile and dizzy assets exist in assets/; check whether emoji/init.lua already loads slight_smile as a global and whether dizzy is loaded anywhere (emoji/init.lua) or would need an image_load in boot.lua.
  6. ROOM 4's HUMAN AND THE FALL: in game.lua / controller.lua, where fall damage is applied (function name, the field decremented, any event/flag set at that moment) so a "dizzy for N seconds after damage" can hook there without changing mechanics.
Sonnet 5xhigh·21:03:33·Sep 14, 2026Worked for 3m 7s
Thinking21:03:33

I'll start by exploring the emojunky project's directory structure.

Glob**/*.lua21:03:33Output not recorded
Input
**/*.lua
Bashcd "C:/Users/a327e/Desktop/a327ex/emojunky" && ls -la && echo "---emoji---" && l...21:03:33Output not recorded
Input
cd "C:/Users/a327e/Desktop/a327ex/emojunky" && ls -la && echo "---emoji---" && l...
Thinking21:03:38

I'm going to look into view.lua next, checking the drawing functions for the player, robot, debug info, HUD, and labels.

Grep^local function draw_|^function draw_|^local function M\.|draw_player|draw_dig_human|draw_robot|draw_debug|draw_dig_debug|draw_hud|draw_dig_hud|draw_labels21:03:38Output not recorded
Input
^local function draw_|^function draw_|^local function M\.|draw_player|draw_dig_human|draw_robot|draw_debug|draw_dig_debug|draw_hud|draw_dig_hud|draw_labels
Grepstate ==|set_state|self\.state =|\.facing|hurt_t|last_dmg|\.dmg\b|body_w|body_h|airborne|grounded|fall_t|hp\b|HP\b21:03:38Output not recorded
Input
state ==|set_state|self\.state =|\.facing|hurt_t|last_dmg|\.dmg\b|body_w|body_h|airborne|grounded|fall_t|hp\b|HP\b
Thinking21:03:44

I should dig deeper into view.lua, checking the various drawing functions—player rendering, dig-mode rendering, robot rendering, debug overlays, HUD elements, labels, markers, popups, and effects—to understand how each piece fits together.

ReadC:/Users/a327e/Desktop/a327ex/emojunky/view.lua21:03:44Output not recorded
Input
C:/Users/a327e/Desktop/a327ex/emojunky/view.lua
Thinking21:03:49

This CLAUDE.md file gives useful context. I want to keep reading view.lua, looking at the drawing functions for the robot, dig human, dig debug overlay, dig HUD, robot marker, dig popups, and dig effects.

ReadC:/Users/a327e/Desktop/a327ex/emojunky/view.lua21:03:49Output not recorded
Input
C:/Users/a327e/Desktop/a327ex/emojunky/view.lua
Thinking21:03:56

I've got most of view.lua covered now, but I still need to check tuning.lua and controller.lua for player_hh, hitbox dimensions, HP fields, state lists, debug flags, and boot.lua details—plus grep controller.lua for the crouch/hang/climb/rope/dead/hurt state handling.

I want to see how set_state assignments work and whether p.crouched changes player_hh or the draw logic, so I'll search controller.lua for the player_hh function signature and any state-setting code.

Grepfunction player_hh|p\.state = |p\.state='|T\.hitbox_w|T\.hitbox_h|T\.body_w|T\.body_h|D\.hw|D\.hh\b|T\.hp\b|p\.hp\b|hurt_flash|notice_t|notice_text|last_land_t|last_land_dmg|last_land_h|do_land|player_hurt|fall_time = 021:03:57Output not recorded
Input
function player_hh|p\.state = |p\.state='|T\.hitbox_w|T\.hitbox_h|T\.body_w|T\.body_h|D\.hw|D\.hh\b|T\.hp\b|p\.hp\b|hurt_flash|notice_t|notice_text|last_land_t|last_land_dmg|last_land_h|do_land|player_hurt|fall_time = 0
Grephitbox_w|hitbox_h|body_w|body_h|D\.hw|D\.hh\b|\bhp = |hp\s*=21:03:57Output not recorded
Input
hitbox_w|hitbox_h|body_w|body_h|D\.hw|D\.hh\b|\bhp = |hp\s*=
Thinking21:04:09

I'm compiling the full list of player state names like hang, climb_up, lower_off, rope, jump, fall, slide, stand, walk, run, crouch, and dead, checking whether 'peek' also appears as a distinct state. Then I want to trace where the hp field and any hurt timestamp field originate for the player.

I noticed the global hurt_flash for screen effects and per-landing fields like last_land_t/last_land_dmg/last_land_h that decrement over time, so I want to check if room 4's human has an equivalent reset in the spawn_player function around line 528, and confirm whether that controller table is shared for room4. I also want to check game.lua and robot.lua for how the player table is used, particularly around fall damage function naming for hooking dizzy states after damage, and read controller.lua's land/hurt logic and spawn/reset sections plus the purpose of notice_text/notice_t globals.

ReadC:/Users/a327e/Desktop/a327ex/emojunky/controller.lua21:04:09Output not recorded
Input
C:/Users/a327e/Desktop/a327ex/emojunky/controller.lua
ReadC:/Users/a327e/Desktop/a327ex/emojunky/controller.lua21:04:09Output not recorded
Input
C:/Users/a327e/Desktop/a327ex/emojunky/controller.lua
Thinking21:04:16

I've confirmed the `player` global is the single controller table shared across rooms 1-4, so room 4's draw_dig_human isn't using a separate "human" variable. Now I want to check game.lua for any standalone "human" identifier to be sure there's no distinct global I'm missing.

I'm also enumerating the movement states — hang, climb_up, lower_off, rope, crouch, stand, walk, run, jump, fall, slide, dead — and checking whether "peek" is its own state or just a flag on the player table used while crouched or hanging. Let me grep for all unique `p.state ==` comparisons to get the complete list.

Grep'human'|human\.|local human|human =21:04:16Output not recorded
Input
'human'|human\.|local human|human =
Bashcd "C:/Users/a327e/Desktop/a327ex/emojunky" && grep -oE "p\.state == '[a-z_]+'" ...21:04:16Output not recorded
Input
cd "C:/Users/a327e/Desktop/a327ex/emojunky" && grep -oE "p\.state == '[a-z_]+'" ...
Grepdebug_on|F1|bind\('f1|key ==|player_reset\(|spawn_player21:04:16Output not recorded
Input
debug_on|F1|bind\('f1|key ==|player_reset\(|spawn_player
Thinking21:04:26

"human" turns out to just be the run.state value for when the player controller drives the human character, not a separate table—confirmed no distinct "human = player" entity exists elsewhere. Now I'm compiling the full list of player states like crouch, stand, walk, run, etc.

Going through the assignments, I count twelve total states: stand, walk, run, crouch, jump, fall, slide, hang, climb_up, lower_off, rope, and dead. Next I want to check boot.lua for the debug toggle key, F1 binding, layer definitions, and cursor spawn logic, so I'll read through that file completely.

ReadC:/Users/a327e/Desktop/a327ex/emojunky/boot.lua21:04:26Output not recorded
Input
C:/Users/a327e/Desktop/a327ex/emojunky/boot.lua
Thinking21:04:31

No emoji cursor spawning here, confirming this instance doesn't use it. I want to check main.lua next for how the debug toggle works with F1, how the layer globals are set up, and the order of draw calls including emoji rendering.

ReadC:/Users/a327e/Desktop/a327ex/emojunky/main.lua21:04:31Output not recorded
Input
C:/Users/a327e/Desktop/a327ex/emojunky/main.lua
Thinking21:04:37

I confirm F1 toggles debug_on directly, and draw_hud always runs regardless of debug_on while draw_debug is gated by it—now checking whether room4's game.lua follows the same pattern with draw_dig_hud versus draw_dig_debug gating.

ReadC:/Users/a327e/Desktop/a327ex/emojunky/game.lua21:04:37Output not recorded
Input
C:/Users/a327e/Desktop/a327ex/emojunky/game.lua
Thinking21:04:53

This answers Q6 well: fall damage runs through controller.lua's landing handler which decrements HP, and it sets a timestamp flag that game.lua checks against the previous tick to detect when a landing has just resolved.

I could hook a dizzy timer right there—checking if the landing timestamp advanced and damage was nonzero—without touching the core landing or damage mechanics. Now I want to check view.lua's draw function to understand room4's layer order and drawing sequence.

ReadC:/Users/a327e/Desktop/a327ex/emojunky/view.lua21:04:53Output not recorded
Input
C:/Users/a327e/Desktop/a327ex/emojunky/view.lua

Now let's look at the cursor.lua, juice.lua, windrang's draw pattern, and knightvspawns' boot/main for the cursor host contract, plus emoji/init.lua for asset loading.

ReadC:/Users/a327e/Desktop/a327ex/emojunky/emoji/cursor.lua21:04:56Output not recorded
Input
C:/Users/a327e/Desktop/a327ex/emojunky/emoji/cursor.lua
ReadC:/Users/a327e/Desktop/a327ex/emojunky/emoji/juice.lua21:04:56Output not recorded
Input
C:/Users/a327e/Desktop/a327ex/emojunky/emoji/juice.lua
Thinking21:05:03

I should check anchor/spring.lua to confirm the exact signature for spring_add and spring_pull, then look at windrang's player draw code, hitfx_init call, dizzy_img load, and knightvspawns boot/main files for reference.

Bashcd "C:/Users/a327e/Desktop/a327ex/ABAgames" && sed -n '85,100p' windrang/main.lu...21:05:04Output not recorded
Input
cd "C:/Users/a327e/Desktop/a327ex/ABAgames" && sed -n '85,100p' windrang/main.lu...
Grepcursor_layer|spawn_cursor|the_cursor|bind\('click'21:05:04Output not recorded
Input
cursor_layer|spawn_cursor|the_cursor|bind\('click'
Grepcursor_layer|spawn_cursor|the_cursor|bind\('click'21:05:04Output not recorded
Input
cursor_layer|spawn_cursor|the_cursor|bind\('click'
Thinking21:05:17

I found the dizzy_until pattern in windrang, which tracks a timed state by comparing current time against a stored expiry timestamp - exactly the approach needed for the Q6 hook of being dizzy for N seconds. Now I'm checking knightvspawns boot.lua for the cursor_layer declaration, main.lua's draw order for cursor update/draw placement, and related references.

Bashcd "C:/Users/a327e/Desktop/a327ex/ABAgames/knightvspawns" && grep -n "emoji_laye...21:05:17Output not recorded
Input
cd "C:/Users/a327e/Desktop/a327ex/ABAgames/knightvspawns" && grep -n "emoji_laye...
Bashcd "C:/Users/a327e/Desktop/a327ex/ABAgames/knightvspawns" && sed -n '860,875p' b...21:05:17Output not recorded
Input
cd "C:/Users/a327e/Desktop/a327ex/ABAgames/knightvspawns" && sed -n '860,875p' b...
Thinking21:05:23

I've confirmed cursor_layer sits outside WORLD_LAYERS in screen space, placed last in the LAYERS list so it draws on top, with the_cursor:draw() called right at the end of draw() after emoji_render, and the_cursor:update(dt) called near the end of update().

Now let me check emoji/init.lua for how slight_smile and dizzy are loaded, and verify slight_smile.png and dizzy.png exist in the emojunky assets folder.

Bashcd "C:/Users/a327e/Desktop/a327ex/ABAgames/knightvspawns" && sed -n '10770,10780...21:05:23Output not recorded
Input
cd "C:/Users/a327e/Desktop/a327ex/ABAgames/knightvspawns" && sed -n '10770,10780...
Bashcd "C:/Users/a327e/Desktop/a327ex/emojunky" && grep -n "slight_smile\|dizzy\|ima...21:05:23Output not recorded
Input
cd "C:/Users/a327e/Desktop/a327ex/emojunky" && grep -n "slight_smile\|dizzy\|ima...
Thinking21:05:29

I confirmed that emojunky's emoji/init.lua loads slight_smile globally but never loads dizzy, even though the dizzy.png asset exists in the assets folder — it would need an explicit image_load call added, similar to how windrang handles it in boot.lua.

Now I need to check anchor/spring.lua for the spring_add and spring_pull signatures to answer Q5 accurately.

Grepfunction spring_add|function spring_pull|function spring_new|function spring_update|function spring_get21:05:29Output not recorded
Input
function spring_add|function spring_pull|function spring_new|function spring_update|function spring_get

Now I have everything needed. Let me do a final check on a couple of small things: p.hurt flag existence, and the exact image_draw/layer_image argument order confirmation (already have it), plus confirm spring_add(s, name, x, frequency, bounce) base value is x (the third positional arg, the spring's initial/rest value), which matches hitfx_init's calls spring_add(e.spring, 'hit', 1, 3, 0.7) etc.

Grepimage_load\(|assets/dizzy|assets/slight_smile21:05:34Output not recorded
Input
image_load\(|assets/dizzy|assets/slight_smile

No image_load calls exist anywhere in emojunky's boot.lua — confirmed dizzy would need one added there. I now have everything needed to answer all six questions.


1. The human's draw

draw_player (view.lua:207-252, rooms 1-3) draws two rectangles for the body, both keyed off p.x, p.y where p.x, p.y is the horizontal-center / vertical-center point, at the FEET-relative half-height — i.e. p.y is the center of the hitbox, not the feet or top-left (feet = p.y + hh, top-left = p.x - D.hw, p.y - hh).

  • Hitbox (outline only): bx,by = (p.x - D.hw)*TILE_PX, (p.y - hh)*TILE_PX, size T.hitbox_w*TILE_PX × hh*2*TILE_PX (view.lua:210-211,223), where hh = player_hh(p) (controller.lua:33-34) is D.hh_crouch when crouched, else D.hh.
  • Sprite (filled body, the one that gets the fall-tell color): 1.15x the hitbox, feet-aligned: sw = T.hitbox_w*1.15*TILE_PX, sh = hh*2*1.15*TILE_PX, sx = p.x*TILE_PX - sw/2, sy = (p.y+hh)*TILE_PX - sh (view.lua:214-218).
  • Facing: a 3x3 "facing pip" square offset by p.facing*(sw*0.22) from center (view.lua:220-221); no mirroring of a sprite (it's flat rects).
  • Per-state changes: crouch shrinks hh (drawn shorter, same code path, no separate branch). Airborne states (jump, fall, slide) draw a two-tick "hand window" on the facing side (view.lua:226-230). slide additionally draws a wall-side budget bar (view.lua:235-240). dead/hurt have no distinct draw branch — color is the only "hurt" tell, via fall_color(p) (view.lua:157-164), which returns FALL_COLORS[4] (red) when p.state == 'dead', otherwise a tier color read from p.fall_time. There is no separate white-flash/blink for a hit.
  • HP/hearts: draw_hud (view.lua:267-298) draws T.hp 9x9 squares on ui_content_layer (lit COL_HEART vs COL_HEART_OFF), rope pips below them, and a full-screen red border flash driven by global hurt_flash (decays dt*3, set to 1 in do_land, controller.lua:353).
  • Fall-damage floating text: drawn in draw_player itself but queued onto effects_layer (not game_layer) — '-%s %.1f tiles' using p.last_land_dmg/p.last_land_h, gated on p.last_land_t > 0 (view.lua:244-248); p.last_land_t is stamped to 1.2 in do_land (controller.lua:350) and ticks down in player_update (controller.lua:636).

controller.lua state exposed:

  • State names (12 total, all via p.state ==/direct assignment, no set_state helper for the player — only game_set_state for the room-4 run FSM): stand, walk, run, crouch (controller.lua:737-740), jump (587), fall (721, 896, 909, 915, 918, 1012, 1038), slide (886), hang (292), climb_up (941), lower_off (981), rope (506), dead (362).
  • Facing: p.facing, ±1 (controller.lua:185 etc; set at 245, 293, 526, 699, 830, 840, 920, 986, 1018).
  • Body size: tuning.lua:49-51 — T.hitbox_w = 0.6, T.hitbox_h = 0.8, T.hitbox_h_crouch = 0.45 (tiles); derived half-sizes D.hw = T.hitbox_w/2, D.hh = T.hitbox_h/2, D.hh_crouch = T.hitbox_h_crouch/2 (tuning.lua:296-298).
  • Airborne/grounded: no boolean field stored on p; grounded is computed on demand via on_ground(p) (called at controller.lua:657,667); airborne is implied by state (jump/fall/slide).
  • Fall time: p.fall_time, p.fall_tiles, p.fall_from_y (reset together in fall_reset, controller.lua:312-315; advanced at 866-870).
  • HP / last damage: p.hp (int, set from T.hp = 4, tuning.lua:108), decremented in player_hurt(p, n) (controller.lua:358-365, no stun applied). Last-damage record: p.last_land_h, p.last_land_dmg, p.last_land_t (set together in do_land, controller.lua:350) — p.last_land_t is the closest thing to a "hurt timestamp": it's a countdown (1.2s) rather than an absolute time, but the tick it goes from 0→1.2 is exactly "a landing just resolved" (this is the pattern game.lua:189-194 already uses: was_land_t = player.last_land_t before player_update, then compare after). There is no p.hurt_t/p.dmg field and no i-frames/stun of any kind — do_land's comment says "HP only in this batch; no stun."
  • Global (not per-player) hurt state: hurt_flash (screen-flash decay, boot.lua:88), notice_text/notice_t (a short floating message like "NO ROPES", unrelated to damage — controller.lua:386-388).

Robot-stage human: draw_dig_human (view.lua:564-586, room 4) reads the exact same global player table — not a separate human variable. (The only thing named human anywhere is run.state == 'human', the room-4 loop state that means "the human is currently being driven," in game.lua; the player controller itself is always player/p.) game_spawn_human() (game.lua:55-66) just calls player_reset(x, y). draw_dig_human shares player_hh(p), D.hw, T.hitbox_w for the box, adds the sketch's skin/shirt/eye rectangles as fractional insets of that same box, and draws the identical hitbox outline + fall-damage text + notice text as draw_player — it is functionally draw_player with cosmetic overlays, on game_layer.

2. The robot's draw

draw_robot (view.lua:526-539) is a plain rectangle sized T.hitbox_w*TILE_PX × T.hitbox_h*TILE_PX — the same tuning constants as the human's hitbox — with origin bx,by = (robot.x - D.hw)*TILE_PX, (robot.y - D.hh)*TILE_PX, i.e. robot.x, robot.y is the center, same convention as the player. Two small eye squares sit on the facing side; color/eye-color swap between "on" (yellow, run.state=='play') and "off" (grey, plus a small red "dead" chip above it). So yes — human and robot draw the same way this pass: centered origin, hh/hw half-extents from tuning, filled rect + accent details, no sprite/rotation.

3. The debug text

TextFunctionLayerFontGated by debug_on?
F1 readout, rooms 1-3draw_debug (view.lua:301-332)ui_content_layerfonts.debugyes (main.lua:153)
F1 readout, room 4draw_dig_debug (view.lua:773-809)ui_content_layerfonts.debugyes (view.lua:861)
Help strip, rooms 1-3last line inside draw_debug itself (view.lua:330-331)ui_content_layerfonts.debugyes (part of draw_debug)
Help strip, room 4draw_dig_hud calling dig_help_lines() (view.lua:689-698,726-733)ui_content_layerfonts.debugno — always on while run.total_t/run.t are inside help_time/human_help_time
Top HUD, rooms 1-3 (hearts/ropes/DEPTH/BEST/SEED)draw_hud (view.lua:267-298)ui_content_layerfonts.debugno, always drawn
Top HUD, room 4 (DEPTH, stats line, seed, clock, bar, hearts/ropes)draw_dig_hud (view.lua:653-717)ui_content_layerfonts.hud (DEPTH/clock) + fonts.debug (stats/seed/ropes)no, always drawn
Room labels / calibration pit depthsdraw_labels (view.lua:255-265)bg_layerfonts.debugno
Robot off-screen markerdraw_robot_marker (view.lua:595-608)ui_content_layerfonts.debugno (gated by run.marker_on, not debug_on)
Floating fall-damage / notice textinside draw_player/draw_dig_human (view.lua:244-251, 578-585)effects_layerfonts.debugno
Dig popups (+5s LINE 1, CHAIN x3)draw_dig_popups (view.lua:635-644)effects_layerfonts.hudno
Loop banners (powerdown/camp/dead)draw_dig_hud → dig_banner_text (view.lua:700-716,749-765)ui_content_layerfonts.hud/fonts.debugno

debug_on is initialized true in boot.lua:83; the F1 bind (bind('debug', 'key:f1'), boot.lua:74) is toggled directly in main.lua:101: if input_pressed('debug') then debug_on = not debug_on end.

4. The cursor host contract

emoji/cursor.lua's own header (cursor.lua:17-26) states the requirements: bind('click', 'mouse:1'); a 'cursor'-named entry in emoji_layers (draws to the auto-created cursor_layer global); spawn_cursor() called after emoji_layers; then the_cursor:update(dt) at the end of update() and the_cursor:draw() in draw(). Mouse position comes from mouse_position()/mouse_delta() (cursor.lua:89-90), not a bind. cursor:new calls mouse_set_visible(false) (cursor.lua:57) to hide the OS cursor. cursor:draw() (cursor.lua:138-160) applies click-squash + movement-squash as an outer transform and rotation + main-spring scale as an inner one, offset (+7,+9) to land the sprite's fingertip on the mouse. cursor:error(duration) (cursor.lua:78-83) is the red-X "error persona," styled flat with no spring; cursor:flash/cursor:pulse (62-73) are the pop/press-adjacent acknowledgements (a click press/release also pulls the main spring directly in update, cursor.lua:124-135).

Host wiring, quoted from ABAgames/knightvspawns:

  • boot.lua:76: LAYERS[#LAYERS + 1] = { 'cursor', outline = true } — appended after everything else including per-player UI panel/content layers and storm/wave.
  • boot.lua:77: emoji_layers(LAYERS)
  • boot.lua:871: spawn_cursor() (called after reset(...), near the end of boot).
  • main.lua:93: bind('click', 'mouse:1') -- cursor + move commit read 'click'
  • main.lua:10776: the_cursor:update(dt) — near the end of update().
  • main.lua:12217: the_cursor:draw(), immediately followed by main.lua:12228: emoji_render() — i.e. the cursor draws last, right before the composite, on top of everything.
  • The cursor layer is not in that game's WORLD_LAYERS/camera-attach list — it stays screen space, same as emojunky's ui_content etc.

emojunky's own boot.lua currently has none of this: no 'cursor' entry in emoji_layers({...}) (boot.lua:36-47), no spawn_cursor() call, and no bind('click', ...) — only bind('dig','mouse:1') and bind('flag','mouse:2') (boot.lua:79-80). All of it would need to be added to wire the cursor in.

5. The springs

  • hitfx_init(e) (juice.lua:53-59) — signature hitfx_init(e), requires e.timer already set (timer_new()), creates e.spring = e.spring or spring_new() then adds three named springs via spring_add(s, name, x, frequency, bounce): spring_add(e.spring, 'hit', 1, 3, 0.7), spring_add(e.spring, 'squash_x', 1, 3, 0.5), spring_add(e.spring, 'squash_y', 1, 3, 0.5) — base value 1 for all three (they multiply into scale), freq 3, bounce 0.7(hit)/0.5(squash). Also sets e.flashing = false.
  • spring_pull(s, name, force, frequency, bounce) (anchor/spring.lua:102-...) — adds force to s[name].x; frequency/bounce are optional overrides of the spring's stiffness/damping for that pull only.
  • hitfx_hit(e, pull, flash_duration) (juice.lua:63-71) pulls the hit spring (spring_pull(e.spring,'hit', pull or 0.3, 3, 0.5)) and, unless flash_duration == false, sets e.flashing = true for flash_duration or 0.1s via a named timer tag 'hitfx_flash'.
  • A draw reads springs as self.spring.<name>.x (a plain field on the spring's sub-table), e.g. windrang's player draw (ABAgames/windrang/main.lua:536-545):
  local img = time < self.dizzy_until and dizzy_img or slight_smile
  local s   = (22/img.width)*self.spring.hit.x
  local sx  = s*self.spring.squash_x.x
  local sy  = s*self.spring.squash_y.x
  ...
  layer_push(game_layer, self.x, self.y, r, sx, sy)
  layer_image(game_layer, img, 0, 0, nil, self.flashing and white())
  layer_pop(game_layer)

hitfx_init(self) is called once in player:new at ABAgames/windrang/main.lua:280. layer_image(layer, image, x, y, flip?, flash_color?)'s draw-position args are 0,0 because the preceding layer_push already translated/scaled/rotated to the entity's transform. dizzy_img is loaded once at boot: ABAgames/windrang/main.lua:93: dizzy_img = image_load('dizzy', 'assets/dizzy.png').

  • In emojunky, emoji/init.lua:49 loads slight_smile = image_load('slight_smile', 'assets/slight_smile.png') as a global already — so slight_smile is ready to use. dizzy is not loaded anywhere in emojunky's emoji/init.lua (grepped, no match) despite assets/dizzy.png existing on disk; it would need its own image_load('dizzy', 'assets/dizzy.png') call, most naturally in boot.lua (which has no image_load calls of its own yet either), mirroring windrang's pattern.

6. Room 4's human and the fall

Fall damage is applied in do_land(p) (controller.lua:347-356), which computes dmg = fall_damage_for(fall_height_for_time(p.fall_time)) and, if dmg > 0, calls player_hurt(p, dmg == 99 and p.hp or dmg) (controller.lua:352) — player_hurt (controller.lua:358-365) is the function that actually decrements the field: p.hp = math.max(0, p.hp - n), setting p.state = 'dead' if it reaches 0. do_land also stamps p.last_land_h, p.last_land_dmg, p.last_land_t = h, dmg, 1.2 and sets the global hurt_flash = 1 at the moment of damage (controller.lua:350,353).

Game.lua already has the exact non-mutating hook point documented in its own comment (game.lua:179-182,189-194): game_human(dt) snapshots was_land_t = player.last_land_t before player_update, then after it, if player.last_land_t > was_land_t and player.last_land_dmg > 0 then ... end is true on precisely the tick a damaging landing resolved. A "dizzy for N seconds" feature can add e.g. player.dizzy_until = time + N inside that same if block in game_human (or inside do_land's if dmg > 0 then branch in controller.lua:351-354) without touching player_hurt/do_land's HP math, then have draw_dig_human/draw_player read time < player.dizzy_until the way windrang's player draw reads time < self.dizzy_until for its dizzy_img swap.

Back to Delve Deep, My Unstoppable Machine!!! 1

Settings