implement auto tile pickup and visual candy stacking on player head
This commit is contained in:
@@ -253,7 +253,17 @@ func _give_candy(pid: int, color: int) -> void:
|
||||
func _update_candy_badge(pid: int) -> void:
|
||||
var count = player_candies.get(pid, 0)
|
||||
var mult = 1.0 + count * MULTI_STEP
|
||||
var color = player_candy_color.get(pid, -1)
|
||||
rpc("sync_candy_badge", pid, count, mult)
|
||||
|
||||
# Update the 3D meshes on the player's head across all clients
|
||||
var all_players = get_tree().get_nodes_in_group("Players")
|
||||
for player in all_players:
|
||||
var curr_pid = player.get("peer_id") if "peer_id" in player else player.name.to_int()
|
||||
if curr_pid == pid:
|
||||
if player.has_method("sync_candy_stack"):
|
||||
player.rpc("sync_candy_stack", count, color)
|
||||
break
|
||||
|
||||
func get_multiplier(pid: int) -> float:
|
||||
var count = player_candies.get(pid, 0)
|
||||
@@ -420,8 +430,8 @@ func setup_mission_tiles() -> void:
|
||||
func get_spawn_points(count: int) -> Array:
|
||||
var points = []
|
||||
var corners = [
|
||||
Vector2i(2, 2), Vector2i(ARENA_COLS - 3, 2),
|
||||
Vector2i(2, ARENA_ROWS - 3), Vector2i(ARENA_COLS - 3, ARENA_ROWS - 3)
|
||||
Vector2i(2, 2), Vector2i(ARENA_COLS - 2, 2),
|
||||
Vector2i(2, ARENA_ROWS - 2), Vector2i(ARENA_COLS - 2, ARENA_ROWS - 2)
|
||||
]
|
||||
for i in range(count):
|
||||
points.append(corners[i % corners.size()])
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user