Page 1 of 1

Stock cards : vertical overlapping

Posted: 02 October 2022, 21:22
by Tabaskov
Hi to the developer community,

the Stock feature is super convenient to use, especially with many cards families.
However I'm having a design issue with the cards overlapping. There are two schools of thought: do I put my collection of cards of the same type horizontally or vertically? Horizontally is not a problem, the setOverlap looks very good.
However, for this game, in practice, on a table, people tend to put their cards vertically... and this is where it gets complicated.
The editor would also like to see how it would look like to group cards of the same family vertically, but I don't see how to do that easily with the Stock library. What solutions can you offer me?

Thanks ;)

Re: Stock cards : vertical overlapping

Posted: 03 October 2022, 07:17
by SwHawk
Hey,

In order to do that, you need to modify Stock's source code. I've done it in one of my projects, you can take a look at it here : https://gitlab.swhawk.eu/silver/cosmosempiresbga/-/blob/master/modules/js/Classes/COEStock.js.

You can ask me over the bga-developers discord how you can make it work. Of course you can ask me here, but it might take a little longer.

Basically you need to include this into your project (you should take a look at the docs here in order to do so), and when you've created your modified Stock component, you need to add :

Code: Select all

let myStock = new ModifiedStock();
myStock.horizontal_overlap = hOverlap_value;
myStock.vertical_overlap = vOverlap_value;
At least vertical overlap can now accept negative value showing the bottom of the card, and the cards stacking upwards, instead of downwards (using a positive overlap)

Hope this helps.

Edit: It seems that I've lost some of my BBCode-Fu, edited to correct the links

Re: Stock cards : vertical overlapping

Posted: 04 October 2022, 08:43
by Tabaskov
Thank you very much,
this track seems interesting to me, I will look at it...