#41: menus and settings at phone scale
On phones the main menu, pause menu, question box, and settings fit the scaled canvas inside the safe area, with buttons and rows at least 44 pt tall (19.5:9 at 1.6x, the iPhone SE at the 1.7 cap, 4:3 iPads). The pause menu puts its buttons in a column beside the rest. Phone settings: Audio, Touch (Interface size, Swap sticks, Camera distance, Haptics, and a short touch-controls guide), Display (3D resolution scale), and Gameplay. The list scrolls by dragging, and a slider only moves after a mostly sideways drag. GameSettings saves the touch settings under [touch] and applies them live (&"touch_controls", the follow camera on phones). A hit buzzes the phone with Haptics on. Desktop menus are unchanged. Test: game/tests/mobile/menus_test.gd. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5392ae09af
commit
0c401171f3
10 changed files with 1139 additions and 46 deletions
|
|
@ -4,7 +4,8 @@ extends Node3D
|
|||
## * Health lives in FarmState and carries over between nights (D7). try_damage() is the only
|
||||
## way to hurt the scarecrow: after an accepted hit it is invulnerable for
|
||||
## invulnerability_time, so several hits on one tick cost one hit's damage. Hits blink the
|
||||
## model red, tint the screen (ScarecrowHud), and interrupt patching.
|
||||
## model red, tint the screen (ScarecrowHud), and interrupt patching. On a phone with the
|
||||
## Haptics setting on (haptics, set by GameSettings), the local scarecrow's hits buzz.
|
||||
## * Fear (fear action): every thief within fear_radius flees for fear_duration; carriers
|
||||
## drop their crop (D5) and thieves mid-steal lose their progress. Then fear_cooldown
|
||||
## seconds until the next one. A ring under the scarecrow shows that fear is ready.
|
||||
|
|
@ -27,6 +28,14 @@ signal patch_cancelled
|
|||
signal patch_denied(missing: Dictionary)
|
||||
|
||||
const BURST_TIME := 0.45
|
||||
## A hit's buzz on a phone, in milliseconds.
|
||||
const HIT_BUZZ_MS := 30
|
||||
|
||||
## Whether an accepted hit buzzes the phone: the Haptics setting on a phone (GameSettings.apply
|
||||
## sets it on every change). Read once per hit, never per frame.
|
||||
static var haptics := false
|
||||
## Buzzes so far (buzz()), for tests: the vibration itself can't be observed.
|
||||
static var buzzes := 0
|
||||
|
||||
var config: GameConfig
|
||||
var campaign: CampaignController
|
||||
|
|
@ -181,12 +190,20 @@ func try_damage(amount: int = 1) -> bool:
|
|||
s.record_event("scarecrow_damage", mini(amount, hp()))
|
||||
_set_hp(hp() - amount)
|
||||
cancel_patch()
|
||||
if haptics and remote == null: # (the host's kit for its partner doesn't buzz the host)
|
||||
buzz()
|
||||
damaged.emit(hp())
|
||||
if hp() <= 0:
|
||||
_die()
|
||||
return true
|
||||
|
||||
|
||||
## A short buzz (Input.vibrate_handheld; nothing on desktop), counted in buzzes.
|
||||
static func buzz() -> void:
|
||||
buzzes += 1
|
||||
Input.vibrate_handheld(HIT_BUZZ_MS)
|
||||
|
||||
|
||||
## Fear burst at the scarecrow. Returns how many thieves fled, or -1 if it isn't ready.
|
||||
func use_fear() -> int:
|
||||
if not alive or fear_left > 0.0:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue