Phones: dual floating thumbsticks (move right, attack left)

TouchSticks: a finger on the right half of the screen is a move stick where it lands (the move_* actions), one on the left half an attack stick (the aim_* actions, with fire held past the aim dead zone, so the weapon attacks that way each time it's ready). Buttons get their touches first; the sticks only act while the scarecrow can, and a pause or freeze lets them go.

On phones a tap is also an emulated left click, so fire and offhand lose their mouse buttons and ScarecrowCombat ignores emulated mouse events for its aim device. A held finger still skips the intro, and a tap skips the farmers' return.

Docs: the first device run's numbers (night 20 held 60 FPS) and the sticks. Graph update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Forrest 2026-10-14 13:48:59 -04:00
parent 59aa97c7a3
commit 8c81d815eb
19 changed files with 3917 additions and 3655 deletions

View file

@ -133,7 +133,7 @@ const SKIP_HOLD := 1.0
const SKIP_FADE := 0.4
const REVEAL_FADE := 0.5
## What holding skips: Space / Enter / A (ui_accept), E / X (interact), the mouse button / RT
## (fire).
## (fire), and on a phone, a finger anywhere on the screen.
const SKIP_ACTIONS: Array[StringName] = [&"ui_accept", &"interact", &"fire"]
## Degrees the lines' shots look under their subject, so it stands in the frame's upper half,
## clear of the dialogue box.
@ -158,6 +158,7 @@ var _skipping := false
var _revealing := false
var _hold: float = 0.0
var _armed := false
var _fingers := {} # touch index -> true while that finger is down (phones' taps no longer press fire)
var _last_frame: int = 0
var _talked := false
var _line: int = -1
@ -1517,12 +1518,26 @@ func _ground_at(at: Vector3) -> float:
return float((hit["position"] as Vector3).y) if not hit.is_empty() else 0.0
func _input(event: InputEvent) -> void:
var touch := event as InputEventScreenTouch
if touch != null:
if touch.pressed:
_fingers[touch.index] = true
else:
_fingers.erase(touch.index)
func _notification(what: int) -> void:
if what == NOTIFICATION_PAUSED or what == NOTIFICATION_UNPAUSED:
_fingers.clear() # a finger lifted while paused never told us
func _poll_skip(delta: float) -> void:
var frame := Engine.get_process_frames()
if frame > _last_frame + 2:
_armed = false # back from a pause: a key still down from the menu doesn't count
_last_frame = frame
var held := false
var held := not _fingers.is_empty()
for action in SKIP_ACTIONS:
held = held or Input.is_action_pressed(action)
if not held or (blocked.is_valid() and bool(blocked.call())):