#46: sprint becomes a permanent speed upgrade

Owning the Sprint upgrade now multiplies the scarecrow's speed by
sprint_speed_mult (1.25) all the time, walking and running, on every
platform; the run clip speeds up to match. The hold-to-sprint burst is
gone: sprint_time, sprint_cooldown, the stamina state in PlayerCharacter
(can_sprint is now has_sprint), and the HUD's stamina bar. The upgrade
keeps its id, cost, and name; its text is "Run 25% faster, always".
The sprint input action stays in project.godot, unused.

Tests: test_scarecrow's sprint checks cover 1x without it, x1.25 with it
(run and walk, clip speed, network strength), 30 s with no time limit,
no cooldown, the next morning, and no platform dependence; test_nights
checks it after the retry and a loaded save; test_economy checks the
text matches the multiplier, the menu row, and that an old save's
{"sprint": 1} still owns it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Forrest 2026-10-14 14:32:39 -04:00
parent f0291133fd
commit 962c7b0b93
9 changed files with 138 additions and 149 deletions

View file

@ -5,8 +5,7 @@ extends Control
## arc sweeping round while fear recharges, glowing blue when it's ready (a flash as it
## becomes ready); greyed out while the scarecrow is down. Beside it the health bar, one
## segment per point of max health (red filled, grey empty; while patching, the segments the
## patch will fill fill in), and under it, once the Sprint upgrade is bought, a thin green
## bar: the sprint's stamina (draining while sprinting, filling back while it recharges).
## patch will fill fill in).
## * Bottom-center: the hotbar, one slot per main weapon owned (locked ones aren't shown),
## numbered by the key that picks it (ScarecrowCombat.owned_main: weapon_k picks slot k), the
## one in hand highlighted; then past a divider the off-hand weapons owned (pumpkin bombs), in a
@ -24,10 +23,8 @@ const SEGMENT_SKEW := 7.0
## The health bar grows a segment per point of max health up to this width, then its segments
## get narrower.
const BAR_MAX_WIDTH := 360.0
const STAMINA_HEIGHT := 6.0
const HEALTH := Color(0.88, 0.14, 0.12)
const EMPTY := Color(0.62, 0.62, 0.6, 0.85)
const STAMINA := Color(0.3, 0.9, 0.25)
const SLOT := Vector2(78.0, 72.0)
const SLOT_GAP := 16.0
const DIVIDER_GAP := 30.0
@ -88,24 +85,6 @@ func _process(delta: float) -> void:
queue_redraw()
## Whether the green stamina bar shows: only once the Sprint upgrade is bought.
func stamina_shown() -> bool:
var body := kit.player if kit != null else null
return body != null and body.config != null and body.can_sprint()
## The green bar's fill, 0..1: the sprint left while sprinting, its recharge after, else full.
func stamina() -> float:
if not stamina_shown():
return 1.0
var body := kit.player
if body.sprinting:
return clampf(body.sprint_left / maxf(body.config.sprint_time, 0.001), 0.0, 1.0)
if body.sprint_recharge > 0.0:
return clampf(1.0 - body.sprint_recharge / maxf(body.config.sprint_cooldown, 0.001), 0.0, 1.0)
return 1.0
## The hotbar's slots as shown, left to right: {weapon, key (the number that picks it; 0 for
## the off-hand), offhand, selected}. Empty while it's hidden (build mode, no weapons).
func slots() -> Array[Dictionary]:
@ -163,7 +142,6 @@ func _draw_health() -> void:
var hp := kit.hp()
var step := minf(SEGMENT.x + SEGMENT_GAP, (BAR_MAX_WIDTH + SEGMENT_GAP) / top)
var seg := Vector2(maxf(step - SEGMENT_GAP, 4.0), SEGMENT.y)
var width := step * top - SEGMENT_GAP
var healing := 0
var heal_frac := 0.0
if kit.patching:
@ -179,16 +157,6 @@ func _draw_health() -> void:
if i < hp: # a darker stroke along the bottom, like paint pooling
Sketch.line(self, at + Vector2(3.0, seg.y - 4.0), at + Vector2(seg.x - 3.0, seg.y - 4.0), full.darkened(0.3), 3.0, 60.0 + i, 0.6)
Sketch.outline(self, pts, Color(Sketch.INK, 0.55), 1.5, 80.0 + i, 0.8, 1)
if not stamina_shown():
return
# The stamina bar, as wide as the health bar.
var bar := Rect2(BAR_ORIGIN + Vector2(0.0, SEGMENT.y + 12.0), Vector2(maxf(width, 120.0), STAMINA_HEIGHT))
var y := bar.get_center().y
Sketch.line(self, Vector2(bar.position.x, y), Vector2(bar.end.x, y), Color(Sketch.INK, 0.6), STAMINA_HEIGHT + 3.0, 101.0, 0.6)
Sketch.line(self, Vector2(bar.position.x, y), Vector2(bar.end.x, y), Color(0.16, 0.3, 0.14, 0.9), STAMINA_HEIGHT, 101.0, 0.6)
var fill := stamina()
if fill > 0.0:
Sketch.line(self, Vector2(bar.position.x, y), Vector2(bar.position.x + bar.size.x * fill, y), STAMINA, STAMINA_HEIGHT, 102.0, 0.6)
## A health segment: a slanted brush stroke.