implement auto tile pickup and visual candy stacking on player head

This commit is contained in:
god
2026-07-06 02:31:17 +08:00
parent b3a421bb55
commit 717e8cedae
3 changed files with 63 additions and 4 deletions
+12 -2
View File
@@ -373,9 +373,18 @@ func set_speed_multiplier(multiplier: float):
# likely uses a fixed speed or duration on all clients.
# Let's check how 'start_movement_along_path' is implemented in player.gd.
# Handle goal pickups (shared logic)
# ... (This happens after the move is completed, or during the move)
pass
func _on_movement_finished():
# Auto-pickup logic for Candy Survival
if LobbyManager.game_mode == "Candy Survival":
if player.has_method("grab_item"):
# Check if there is an item at current_position and if the board has space
if player.playerboard_manager and player.playerboard_manager.has_empty_slot():
player.grab_item(player.current_position)
if not movement_queue.is_empty():
var next_target = movement_queue.pop_front()
# Use a small delay or call_deferred to avoid recursion issues,
@@ -386,6 +395,7 @@ func _on_movement_finished():
current_move_direction = Vector2i.ZERO
emit_signal("movement_finished")
else:
is_moving = false
current_move_direction = Vector2i.ZERO
emit_signal("movement_finished")