goals synced
This commit is contained in:
@@ -180,9 +180,32 @@ func _on_playerboard_slot_clicked(event, slot_index):
|
||||
ActionState.PUTTING:
|
||||
local_player_character.handle_put_slot_selected(slot_index)
|
||||
|
||||
func update_goals_ui():
|
||||
if not local_player_character:
|
||||
return
|
||||
|
||||
for i in range(9): # 9 slots in the goals UI
|
||||
var slot = $PlayergoalsUI.get_child(i)
|
||||
var goal_value = local_player_character.goals[i]
|
||||
|
||||
# Hide all tile textures first
|
||||
slot.get_node("TileHeart").hide()
|
||||
slot.get_node("TileDiamond").hide()
|
||||
slot.get_node("TileStar").hide()
|
||||
slot.get_node("TileCoin").hide()
|
||||
|
||||
# Show the appropriate texture based on goal value
|
||||
match goal_value:
|
||||
7: slot.get_node("TileHeart").show()
|
||||
8: slot.get_node("TileDiamond").show()
|
||||
9: slot.get_node("TileStar").show()
|
||||
10: slot.get_node("TileCoin").show()
|
||||
|
||||
func update_playerboard_ui():
|
||||
if not local_player_character:
|
||||
return
|
||||
|
||||
update_goals_ui() # Update goals UI whenever playerboard updates
|
||||
|
||||
for i in range(25):
|
||||
var slot = playerboard_ui.get_child(i)
|
||||
@@ -270,6 +293,7 @@ func add_player_character(peer_id):
|
||||
local_player_character = player_character
|
||||
update_button_states()
|
||||
update_playerboard_ui()
|
||||
update_goals_ui()
|
||||
|
||||
func add_bot(bot_id):
|
||||
rpc("create_bot", bot_id)
|
||||
|
||||
Reference in New Issue
Block a user