match3: improve tile selector
This commit is contained in:
@@ -623,6 +623,12 @@ func _input(event: InputEvent) -> void:
|
|||||||
if current_state == GameState.SWAPPING or current_state == GameState.PROCESSING:
|
if current_state == GameState.SWAPPING or current_state == GameState.PROCESSING:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Handle action_east (B button/ESC) to deselect selected tile
|
||||||
|
if event.is_action_pressed("action_east") and current_state == GameState.SELECTING:
|
||||||
|
DebugManager.log_debug("action_east pressed - deselecting current tile", "Match3")
|
||||||
|
_deselect_tile()
|
||||||
|
return
|
||||||
|
|
||||||
# Handle keyboard/gamepad navigation
|
# Handle keyboard/gamepad navigation
|
||||||
if event.is_action_pressed("move_up"):
|
if event.is_action_pressed("move_up"):
|
||||||
_move_cursor(Vector2i.UP)
|
_move_cursor(Vector2i.UP)
|
||||||
@@ -825,7 +831,9 @@ func _are_adjacent(tile1: Node2D, tile2: Node2D) -> bool:
|
|||||||
|
|
||||||
func _attempt_swap(tile1: Node2D, tile2: Node2D) -> void:
|
func _attempt_swap(tile1: Node2D, tile2: Node2D) -> void:
|
||||||
if not _are_adjacent(tile1, tile2):
|
if not _are_adjacent(tile1, tile2):
|
||||||
DebugManager.log_debug("Tiles are not adjacent, cannot swap", "Match3")
|
DebugManager.log_debug("Tiles are not adjacent, selecting new tile instead", "Match3")
|
||||||
|
_deselect_tile()
|
||||||
|
_select_tile(tile2)
|
||||||
return
|
return
|
||||||
|
|
||||||
DebugManager.log_debug(
|
DebugManager.log_debug(
|
||||||
|
|||||||
Reference in New Issue
Block a user