Rework manual tubes: steerable goo with a leader indicator

Manual tubes (TubeSteer):
- The slime is pulled fully into the tube on entry; tubes too short for it
  squash it to fit, with a few pixels poking out of each mouth.
- A leader slides quickly through the goo without moving it, and drags the
  goo at normal speed once past an end. At covered junctions it can turn into
  another arm, or pull into an empty branch, draining the goo from all sides.
- Only coloured pixels go in; a black outline is drawn around the goo, with
  rounded ends in the tube.
- The leader is a pulsing circle; colour, border colour and radius are set
  under "Tube Indicator" on the Player.

Tiles and level:
- Plain tube tiles are now manual, green ones automatic. Test level tubes
  repainted plain so they stay manual.

Also included (earlier work): goo tube prototype (TubeGoo, purple tiles) and a
max length for the automatic pixel stream.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
SnekInAScarf 2026-11-11 12:03:12 -08:00
parent 32d82b4bd1
commit beeebbf47e

View file

@ -64,6 +64,10 @@ const INDICATOR_PULSE_SPEED = 2.5 # Radians per second (a pulse every 2.5s or so
const INDICATOR_MIN_OPACITY = 0.4
const INDICATOR_MAX_OPACITY = 0.6
const INDICATOR_MAX_LIGHTEN = 0.2
# The circle is hidden while the goo is going in or pouring out. It grows in
# once the goo is all in, and shrinks away quickly when it starts to pour out.
const INDICATOR_APPEAR_TIME = 0.25 # Seconds.
const INDICATOR_DISAPPEAR_TIME = 0.1 # Seconds.
const DIRECTIONS: Array[Vector2i] = [Vector2i.UP, Vector2i.RIGHT, Vector2i.DOWN, Vector2i.LEFT]
const NEIGHBORS_4: Array[Vector2i] = [Vector2i.UP, Vector2i.RIGHT, Vector2i.DOWN, Vector2i.LEFT]
@ -105,6 +109,7 @@ var _isPouring := false # Once we're leaving: the leader carries on out by itsel
var _stickOut := 0
var _moveOwed := 0.0 # Time we're owed moving but haven't used, in seconds.
var _time := 0.0
var _indicatorShown := 0.0 # How far the circle has grown in, from 0 (hidden) to 1.
# The pixels: row r holds pixels r * _pixelsPerRow up to the next row's, going
# across its _laneCount lanes and round again.
@ -214,6 +219,10 @@ func steer(input: Vector2, delta: float) -> void:
func _process(delta: float) -> void:
_time += delta
if _isTakingIn or _isPouring:
_indicatorShown = maxf(_indicatorShown - delta / INDICATOR_DISAPPEAR_TIME, 0.0)
else:
_indicatorShown = minf(_indicatorShown + delta / INDICATOR_APPEAR_TIME, 1.0)
queue_redraw()
@ -704,21 +713,24 @@ func _draw() -> void:
for at: Vector2i in movingPixels:
draw_rect(Rect2(Vector2(at), Vector2.ONE), movingPixels[at])
if leaderPixelCount > 0:
if leaderPixelCount > 0 and _indicatorShown > 0.0:
_draw_indicator(leaderCentre / leaderPixelCount)
# The circle marking the leader, pulsing its opacity and brightness slowly.
# While it's appearing or disappearing, it's smaller and fainter.
func _draw_indicator(centre: Vector2) -> void:
var wave := 0.5 + 0.5 * sin(_time * INDICATOR_PULSE_SPEED)
var opacity := lerpf(INDICATOR_MIN_OPACITY, INDICATOR_MAX_OPACITY, wave)
var shown := ease(_indicatorShown, 0.5) # Quick to start growing, settling gently.
var opacity := lerpf(INDICATOR_MIN_OPACITY, INDICATOR_MAX_OPACITY, wave) * shown
var lighten := INDICATOR_MAX_LIGHTEN * wave
var fill := indicatorColor.lightened(lighten)
fill.a *= opacity
var border := indicatorBorderColor.lightened(lighten)
border.a *= opacity
draw_circle(centre, indicatorRadius, fill)
draw_circle(centre, indicatorRadius, border, false, 1.0)
var radius := indicatorRadius * shown
draw_circle(centre, radius, fill)
draw_circle(centre, radius, border, false, 1.0)
# Which way a row's lanes spread at `vertex`: across the tube there.