db0 / godot-card-game-framework

A framework which comes with prepared scenes and classes to kickstart your card game, as well as a powerful scripting engine to use to provide full rules enforcement.
http://dbzer0.com/projects/godot-card-game-framework/
GNU Affero General Public License v3.0
895 stars 96 forks source link

Support multiple card containers using the same anchor #98

Closed db0 closed 3 years ago

db0 commented 3 years ago

Currently if the dev configures the placement of two CardContainers to use the same anchor (e.g. bottom right), then they will overlap.

Optimally, the game should detect this, and shift the one of them one rect_size away.

The problem is, the direction to push is not obvious. It not only depends on the anchor, but also on the wishes of the developer. One might want two piles next to each other, while another might like one pile on top of the other.

I'm thinking two more exported vars called "overlap_shift_direction" and "index_shift_priority" which will determine in which of the piles shifts, and towards which location. The index_shift_priority would be either "lower" or "higher". Lower would shift the lower index container when they overlap. while "higher" would shift the higher index. "overlap_shift_direction" would be "up" or "down", "left", "right" and would determine in which direction the container with the index_shift_priority shifts when it is overlapping.

They also need to take into account card stack size and adjust accordingly.