← ExekiteCONTENT HISTORY

Update to Exekite

Snapshot Nov 17, 2026 · 12:11 UTC · version 1.0.0

Collection source: downloaded plugin package.

WHAT CHANGED

First saved snapshot

No earlier snapshot is available to establish a change.

Save Exekite and check future changes in Following.

Up to 3 plugins free · no card required.

Compare saved observations

Download comparison JSON
Full technical diff · 0 changed fields
Full snapshot data
{
  "description": "For Exekite-hosted Godot games only. Anchored HUD and menu layout, phone readability after viewport scaling, physical control bounds, and touch-first prompt text. Use for title, pause, win/lose and retry UI as well as in-game counters. Includes a working responsive CanvasLayer example.",
  "included_files": [
    {
      "relative_path": "responsive_overlay.gd",
      "size_in_bytes": 6302
    }
  ],
  "name": "hud-and-overlay-layout",
  "skill_md_contents": "---\nname: hud-and-overlay-layout\ndescription: \"For Exekite-hosted Godot games only. Anchored HUD and menu layout, phone readability after viewport scaling, physical control bounds, and touch-first prompt text. Use for title, pause, win/lose and retry UI as well as in-game counters. Includes a working responsive CanvasLayer example.\"\n---\n\n# HUD and overlay layout\n\nValid node positions do not establish readable UI. Check geometry and input in\nGodot, then inspect the exported game for visual contrast and phone usability.\n\n## The ordering trap\n\n`set_anchors_preset()` REWRITES `offset_left/top/right/bottom`. Set an anchor\npreset after positioning and your position is discarded. And `position` is\nPARENT-relative, never anchor-relative — it only mimics anchor-relative\nplacement while the node is outside the tree (the parent rect reads zero there,\nso the offsets absorb the value), which is why build-then-add code appears to\nwork. On a node already inside a laid-out tree, `position = Vector2(-120, 12)`\nmeans 120px left of the parent's LEFT edge. Use `offset_left` / `offset_top` /\n`offset_right` / `offset_bottom` for anchor-relative placement — they are\nanchor-relative in and out of the tree.\n\n```gdscript\n# WRONG — the preset overwrites everything you just set\nlabel.position = Vector2(20, 20)\nlabel.set_anchors_preset(Control.PRESET_TOP_LEFT)\n\n# RIGHT — anchor first, then offset from that anchor\nlabel.set_anchors_preset(Control.PRESET_TOP_LEFT)\nlabel.offset_left = 20\nlabel.offset_top = 20\n```\n\n`set_anchors_preset(preset, true)` — the second argument is `keep_offsets` —\nkeeps them instead. Use it when you have already positioned the node.\n\n## Anchor to the corner the value belongs to\n\nA HUD that anchors everything top-left drifts off a wide screen. Anchor each\nelement where it should stay:\n\n```gdscript\nfunc _build_hud() -> CanvasLayer:\n    var layer := CanvasLayer.new()          # a CanvasLayer does NOT scroll with the camera\n    var root := Control.new()\n    root.set_anchors_preset(Control.PRESET_FULL_RECT)\n    root.mouse_filter = Control.MOUSE_FILTER_IGNORE   # or it eats every click\n    layer.add_child(root)\n\n    var score := Label.new()\n    score.set_anchors_preset(Control.PRESET_TOP_LEFT)\n    score.offset_left = 16\n    score.offset_top = 12\n    root.add_child(score)\n\n    var lives := Label.new()\n    lives.set_anchors_preset(Control.PRESET_TOP_RIGHT)\n    lives.offset_left = -120                # negative — measured from the RIGHT edge\n    lives.offset_top = 12\n    root.add_child(lives)\n    return layer\n```\n\nAnchored to the right, `offset_left` is measured from that edge — so it is\nnegative. A positive value there puts the label off-screen, which is exactly\nthe class this skill exists for.\n\n## Put the HUD on a CanvasLayer, always\n\nA `Control` parented into the gameplay tree moves with the camera. In a\nscrolling game it leaves the screen the moment the player walks right. A\n`CanvasLayer` is in screen space and does not move.\n\n## Verifying without a viewport\n\nYou cannot see it. You can still assert it, and the assertion is cheap:\n\n```gdscript\nfunc _ready() -> void:\n    await get_tree().process_frame          # sizes are not final until one frame has passed\n    var vp := get_viewport_rect()\n    for c in _hud_controls:\n        var r := c.get_global_rect()\n        assert(vp.encloses(r), \"HUD element %s is outside the viewport: %s vs %s\" % [c.name, r, vp])\n```\n\nA failed `assert` emits a `SCRIPT ERROR:` line, which the playtest tier\nsurfaces as a runtime-error warning — the off-screen element becomes a visible\nengine error. `push_error` works too, and this paragraph used to say it did\nnot: measured on Godot 4.6.1, `push_error(\"x\")` prints\n\n```\nERROR: x\n   at: push_error (core/variant/variant_utility.cpp:1024)\n```\n\n— `ERROR:` at column 0, not `USER ERROR:`, and `^ERROR:` is one of the three\npatterns the extractor matches (`gate/checks/boot.ts` `GENERIC_ERROR_RE`). The\nold advice steered authors away from the one call that reaches the gate.\nRemove the check, or keep it behind a constant, once the layout is settled.\n\nContainer-managed rectangles may not be final in `_ready()`. Await deferred\nlayout before asserting them; explicitly sized controls can already have a\nnonzero rectangle, so checking only for nonzero size is insufficient.\n\n## Keep text and buttons usable after phone scaling\n\nA 1280×720 game fitted into a 390px-wide phone has only about 390×219px of\nvisible game content. A 16-unit font becomes 4.88px and a 48-unit Start button\nbecomes 14.63px high. Anchoring alone cannot fix this.\n\nRead `responsive_overlay.gd` in **this skill's directory** for a complete,\nnative-tested example. Copy and adapt it into the game's own scripts: its title,\ncounts and action names are examples. Never reference the skill's `/opt/...`\npath from exported game code, and do not register it as a platform autoload.\n\nThe example puts one manually sized Control directly under a CanvasLayer. Give\nthat root TOP_LEFT anchors, not FULL_RECT, and update its size and scale together\non `get_viewport().size_changed`. Its child anchors and containers then lay out\nagainst the smaller usable UI rectangle:\n\n```gdscript\nvar stretch := get_viewport().get_screen_transform().get_scale().abs()\nvar pixel_ratio := maxf(1.0, DisplayServer.screen_get_scale())\nvar css_scale := minf(stretch.x, stretch.y) / pixel_ratio\nvar ui_scale := maxf(1.0, 1.0 / maxf(0.001, css_scale))\nui_root.scale = Vector2.ONE * ui_scale\nui_root.size = get_viewport().get_visible_rect().size / ui_scale\n```\n\nUse at least 16-unit text and 44×44-unit button hit areas under this root.\nReflow the content to its new size; enlarging a desktop layout alone makes it\noverflow. On a short phone viewport, use a short title, one goal sentence and\nStart; compact the HUD to counters plus Pause/Mute. The example pause menu puts\nResume above a row containing Mute and Retry, so all three fit even in 180px of\nheight. Put desktop keyboard instructions in a separate help view or omit them\non touch devices. Apply this layout to **every** title, pause, win, lose and retry\nscreen, including the longest counter values and Unmute label.\n\nMenu buttons retain keyboard focus and a visible focus style. Release a hidden\nscreen's focus before rebuilding it, restore the matching button when only its\nlabel changes, and focus the active primary action on a new menu. HUD buttons\nmay use FOCUS_NONE so Space does not activate a previously clicked Mute button.\nCoalesce menu rebuilds with `call_deferred()`: removing the emitting button\nduring its `pressed` callback can interrupt Godot's ongoing GUI input dispatch.\nThe game controller still needs one owner for each menu activation and a\nrelease-to-arm latch before gameplay consumes that same Start/Retry key; this\nUI example does not implement a gameplay ability latch.\n\nAfter container layout settles, validate **physical** bounds for each screen.\nThe example's `physical_rect(control)` applies the viewport and canvas transforms\nand divides by display density. Compare those rectangles with the similarly\ntransformed viewport rectangle, require every button's width and height to be\nat least 44px, and check the font's transformed size is at least 16px. Check\nportrait, landscape and resizing while a menu is already open. Native headless\ndensity is a model; verify the exported browser canvas at its actual CSS size\nand device pixel ratio, including trusted taps and keyboard menu navigation.\n\nSee Godot's [viewport transform chain](https://docs.godotengine.org/en/4.6/tutorials/2d/2d_transforms.html)\nand [display scale](https://docs.godotengine.org/en/4.6/classes/class_displayserver.html#class-displayserver-method-screen-get-scale).\n\n## Touch players see buttons, not keys\n\nOn a touchscreen (`DisplayServer.is_touchscreen_available()`), the platform's\ntouch overlay draws a joystick and the buttons the game registered with\n`configure_actions`. Every instruction the game shows must then name what the\nplayer can touch: the joystick (\"Drag to walk\") and each button by its label\n(\"Hold CAST to cast\", \"Tap SHOO\"). Never name a key (\"Hold SPACE\", \"E\",\n\"P pause\", \"A/D\"). Keep both texts and pick one at runtime:\n\n```gdscript\nfunc _hint(keys: String, touch: String) -> String:\n\treturn touch if DisplayServer.is_touchscreen_available() else keys\n\nhint_label.text = _hint(\"Hold SPACE to cast\", \"Hold CAST to cast\")\n```\n\nGive each touch button one short word (CAST, SHOO, PAUSE). The overlay fits a\nlonger label by shrinking or wrapping it, which costs legibility.\n\n## Readable controls and populated state\n\nChanging a Button's `font_color` does not change its background. Dark text on the\ndefault dark button is nearly invisible even though its rect is valid. Choose the\nforeground and StyleBox background together, including hover, pressed, disabled\nand focus states; a bright primary button needs a real bright background style.\nInspect the rendered title and pause screens, not just their node positions.\n\nCheck the first playable frame before taking damage or collecting anything:\nhealth, score and cooldown must already show their current values. Wire signals\nand then render state explicitly (see `signals-and-events`). Verify changed values\nstill fit: adding the initially missing hearts must not push the objective off-screen.\nA gate pass does not establish visual contrast or initial HUD completeness.\n\nDraw critical HUD icons such as hearts with geometry, or use a font whose glyph\ncoverage you verified in the exported game. Unverified Unicode hearts and other\nsymbols can render as empty boxes even when the health number is correct.\n\n## The other two ways UI vanishes\n\n- **`modulate.a` left at 0**, or a fade-in tween that never starts. The node is\n  present, sized and positioned; nothing draws.\n- **A parent with `visible = false`**. Visibility is inherited, so a hidden\n  container hides a perfectly placed child. Check the chain, not the node.\n"
}

SHA-256 of public snapshot: f8baf3c78c5e8564f63a3b8a29f37ccbadcdf2c706a0fe0436c0a79e67ccf9bc