feat: add responsive HUD prompts
This commit is contained in:
+10
-1
@@ -39,7 +39,9 @@ func _capture_visual_check() -> void:
|
||||
get_tree().quit(0 if result == OK else 1)
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed(&"move_north"):
|
||||
if event.is_action_pressed(&"interact"):
|
||||
submit_test_interact()
|
||||
elif event.is_action_pressed(&"move_north"):
|
||||
_process_action(Vector2i.UP)
|
||||
elif event.is_action_pressed(&"move_south"):
|
||||
_process_action(Vector2i.DOWN)
|
||||
@@ -59,6 +61,9 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
func submit_test_action(direction: Vector2i) -> Array[TurnResult]:
|
||||
return _process_action(direction)
|
||||
|
||||
func submit_test_interact() -> Array[TurnResult]:
|
||||
return _refresh_hud_for_context()
|
||||
|
||||
func get_game_state() -> GameState:
|
||||
return game_state
|
||||
|
||||
@@ -69,6 +74,10 @@ func get_actor_cell_rect(actor_id: StringName) -> Rect2:
|
||||
return enemy_views[actor_id].get_cell_rect()
|
||||
return Rect2()
|
||||
|
||||
func _refresh_hud_for_context() -> Array[TurnResult]:
|
||||
hud.refresh(game_state)
|
||||
return []
|
||||
|
||||
func _process_action(direction: Vector2i) -> Array[TurnResult]:
|
||||
var results := game_state.try_player_action(direction)
|
||||
_sync_map_renderer_visibility()
|
||||
|
||||
Reference in New Issue
Block a user