CardStock items disappear (seems mostly iphone related)
Posted: 03 January 2021, 02:29
For my game cribbage I create the cardstock following the hearts tutorial
and I have a function for dealing the hand
There have been reports that not all 6 cards show up for display. I never encountered this on PC/Pixel, but have seen it on my wife's iPhone
Which is pretty standard, what is not standard is I change the weight of the cards based on Rank not on Suit. An early version of this game had a toggle button that would allow you to sort by either, it was removed because sort by suit was never helpful, so that is why orderByRank is a function.
Does anyone know if changing weight could cause cards to not display. Note a refresh of the screen fixes the issue. The issue is rare but enough have mentioned it so it should be looked into. Has anyone run into this before?
Other than that I can't think of what would be the offending code.
Thank you
Mike
and I have a function for dealing the hand
Code: Select all
dealHand: function (cards) {
for (var i in cards) {
this.playerHand.addToStockWithId(this.getCardTypeId(cards[i]), cards[i].id);
}
this.playerHand.changeItemsWeight(this.orderByRank(this.playerHand.item_type));
},
orderByRank: function(cards) {
var weight = {};
for (var i in cards) {
//deconstruct i as type and suit
var color = ~~(i/14);
var rank = (i%14);
weight[i] = rank * 4 + color;
}
return weight;
},
Which is pretty standard, what is not standard is I change the weight of the cards based on Rank not on Suit. An early version of this game had a toggle button that would allow you to sort by either, it was removed because sort by suit was never helpful, so that is why orderByRank is a function.
Does anyone know if changing weight could cause cards to not display. Note a refresh of the screen fixes the issue. The issue is rare but enough have mentioned it so it should be looked into. Has anyone run into this before?
Other than that I can't think of what would be the offending code.
Thank you
Mike