Page 1 of 1

Why does my image disappear?

Posted: 22 May 2020, 18:27
by Bids
Hi!
When using placeOnObject and slideToObject I had saw the following behaviour:
I'm developping the card game Bids and when a specific card is played, I want a token (= a little image, png) to fly to the player that played this card. I do this with the following code, which worked perfectly fine.

Code: Select all

 this.placeOnObject('allytoken_' + player_id,'overall_player_board_'+ player_id);       
this.slideToObject('allytoken_' + player_id, 'allyplaceholder_' + player_id).play();  
When the turn ends, the little image (what I can the token) is still there, but when I refresh the page, the image is gone. If I refresh before the turn ends, nothing happens with the little image, so something goes wrong when the turn ends. The handling of the end of a turn is almost the same as what happens in Hearts. I just don't understand why that image disappears, while all other cards stay the same. Anyone has an idea if I have to find the error in the tpl-file or in the .js file?
Many thanks in advance!

Re: Why does my image disappear?

Posted: 22 May 2020, 18:47
by Marcuda
When you refresh the page the client loses all current information and everything has to be recreated in the setup function of your .js file.

I would check three things:
1. Is the card play that triggers this animation recorded to the server?
2. Is that information (card and/or token placement) returned to the client from getAllDatas in game.php?
3. Do you position the bird tokens in your .js setup function?

Re: Why does my image disappear?

Posted: 22 May 2020, 19:33
by Bids
Thanks a lot! I forgot indeed to include it in the getalldatas :roll: