im making a multiplayer card game its my first time making a multiplayer game so im having some problems with syncronizing the card sprites it does not change the image for both players since its my first game i dont really know how to do that and the docs didn`t help either
about what im trying to do its actually something not that hard to do i think im trying to make a card placeholder for you to place the cards there to use the effect and show the card to the other players thats basically it but the problem is
it only shows the card to the player that placed it and idk really know how to fix that also i did try to use rpc but it just showed 6k errors in 30 seconds(not kidding) idk if i did something worng but what i know it didn`t work
This first part is the code that is on the main script:
func _on_area_2d_mouse_entered():
for Card in $Cards.get_children():
if Card.state == InMouse:
Card.pos = 2
#detects when the card is inside the place holder and can be placed
func _on_area_2d_mouse_exited():
for Card in $Cards.get_children():
if Card.state == InMouse:
Card.pos = 1
#detects when the card left the place holder area
func _physics_process(_delta):
for Card in $Cards.get_children():
if Card.pos == 2:
$CardBase.change(Card.CardImg)
Card.queue_free()
#calls the function on the card placeholder script to put the card on it basically
This second one is the one that is inside the placeholder script:
func change(img):
$Card.texture = load(img)
$Card.scale = cscale
#this is the function that places the card on the place holder basically
i did put some notes for better undestanding of what part of the code is doing what
my problem is that this only works for the player placing the card idk really know how to fix that i tried rpc but i think i did something worng and it didn’t work because of that so i removed it from the code the problem i faced when i tried using rpc rn was that nothing happend
i tried this but the problem still remains it only shows for 1 client
func _physics_process(_delta):
for Card in $Cards.get_children():
if Card.pos == 2:
rpc("show_card")
@rpc("any_peer", "call_local", "reliable")
func show_card():
for Card in $Cards.get_children():
if Card.pos == 2:
$CardBase.change(Card.CardImg)
Card.queue_free()