card does not appear in draw cards action

Game development with Board Game Arena Studio
Post Reply
User avatar
Italo Rufca
Posts: 6
Joined: 02 May 2020, 17:49

card does not appear in draw cards action

Post by Italo Rufca »

I have a problem in the action of draw cards, when this action is performed, the deck counter decreases but the card does not appear in the player's hand, I need to refresh the page for it to appear, how do I resolve?
User avatar
RicardoRix
Posts: 2548
Joined: 29 April 2012, 23:43

Re: card does not appear in draw cards action

Post by RicardoRix »

is this a game you're developing?

I am guessing: After the draw a card action you send back a notification? The notification handler needs to do all the appropriate UI changes.
Alternatively it could be done via a state change and you are passing back data in the args.args?

So you are handling all of this in the 'setup' which is why it works after page refresh but not after the notification (or state change). 'setup' is a called only once at startup.

You should probably track down how the deck counter is being decreased.
User avatar
Italo Rufca
Posts: 6
Joined: 02 May 2020, 17:49

Re: card does not appear in draw cards action

Post by Italo Rufca »

Yes, I am developing.

my notification is like this, I got the same code that is used in the game setup to distribute the cards.

notif_cardDraw : function(notif) {
console.log('notif_notif_cardDraw');
console.log(notif);

if (notif.args.cardDrawn != null) {
this.playerHand.addToStockWithId(notif.args.cardDrawn.type_arg,
notif.args.cardDrawn.id, "deck");
}

},
User avatar
RicardoRix
Posts: 2548
Joined: 29 April 2012, 23:43

Re: card does not appear in draw cards action

Post by RicardoRix »

do you see the message notif_notif_cardDraw in the console, and is the card not null?
Is this notification ever being called? did you register the notif?
and where is the counter being decreased?
User avatar
Victoria_La
Posts: 665
Joined: 28 December 2015, 20:55

Re: card does not appear in draw cards action

Post by Victoria_La »

if card is there but invisible its likely stylng issues, inspect HTML of you hand in browser debugging tools, do you see your card there?
If yes check where is, what size is it and what is background. You can adjust css attributes right in browser to see what exactly went wrong.
User avatar
Italo Rufca
Posts: 6
Joined: 02 May 2020, 17:49

Re: card does not appear in draw cards action

Post by Italo Rufca »

I managed to solve it, thanks. in the addToStockWithId function I was passing an extra parameter, after I removed the "deck" it worked
Post Reply

Return to “Developers”