20.5 C
New York
Wednesday, July 23, 2025

Arc Slot Format and Card Show Overlap (Godot 4.x)


I am fighting a persistent downside in my Godot 4.4.1 undertaking involving “energy slots” organized round a desk or enviornment background. Regardless of how I construction my nodes and replace my code, I hold working into these issues:

  • Energy slot nodes and playing cards overlap or clump close to the middle of the desk as a substitute of spacing out neatly across the oval.
  • Card sprites generally seem below the desk background or UI, as a substitute of in entrance.
  • Makes an attempt to fan playing cards horizontally in every slot both lead to them stacking, rotating oddly, or being invisible.
  • Debug prints verify my slot node names and setup are right, however playing cards/cards_container layering and arc math by no means work as supposed.

I’ve reviewed tutorials and discussion board posts, however cannot get dependable outcomes. I’ve cleared the .godot cache, double-checked z-indexes, and strictly father or mother all energy slots to a Node2D container. Nonetheless, the arc association and card stacking points persist.

Every participant may have 3 playing cards.

What I am Making an attempt To Obtain

  • A number of “agent/energy slots” must be evenly distributed in an arc round an oval or enviornment.
  • Every slot shows an avatar, title, and a fan of energy playing cards, spaced out, not overlapping or hidden.
  • Playing cards should at all times present above the desk background and UI.

What I’ve Already Tried

  • Mother or father all slots below a Node2D container, not a Management or Panel.
  • Calculate arc positions and set slot rotation so every “seems to be in” or stays upright.
  • Use z_index and set it excessive for slots and playing cards.
  • Manually place/fan out TextureRects for playing cards below every slot node (inside a Node2D or Management).
  • Examine that slot and card node names/sorts match the script.

Issues Nonetheless Current

  • Slots/playing cards nonetheless overlap on the middle or do not comply with the arc in any respect.
  • Typically playing cards seem beneath the background or UI, regardless of z_index adjustments.
  • When fanning three playing cards, they could stack or rotate incorrectly, even with customized code.
  • No runtime or inspector errors, solely persistent render points and format bugs.

Questions

  1. What are essentially the most dependable methods in Godot 4 to maintain Node2D-based slots distributed in an actual arc/ellipse—particularly when referencing a Management or Panel background for arc math?
  2. How can I assure playing cards/cards_container seem visually above all background or UI, it doesn’t matter what?
  3. Is there a trick for getting fanned playing cards to at all times seem on the proper place, not stacking or floating off-screen?
  4. What are widespread gotchas with z-index, CanvasLayer, or father or mother/youngster setup that trigger playing cards or slots to fade or overlap?

Present Scene Construction

MainScreen (Node2D)
├── Background (TextureRect/Panel)         # Enviornment visible
├── PowerSlotContainer (Node2D)
│   ├── PowerSlot1 (Node2D)
│   └── PowerSlot2 (Node2D)
│       └── SlotLayout (VBoxContainer)
│           ├── NameLabel (Label)
│           ├── PowerLabel (Label)
│           └── CardFan (Node2D)
├── CanvasLayer
│   └── UI Controls/Panels

Instance Card Show Perform (pseudo-GDScript)

for i in vary(card_count):
    var card_sprite = TextureRect.new()
    # assign texture, set card_sprite.custom_minimum_size, and so forth.
    card_sprite.place.x = i * (card_width * (1 - overlap))
    card_sprite.rotation_degrees = base_angle + (fan_angle * i / max(1, card_count - 1))
    card_sprite.z_index = 25
    card_fan.add_child(card_sprite)

Nonetheless, this produces stacking, invisible, or under-table card visuals.

Screenshots/Wireframe

Added above for reference

What Am I Lacking?

  • Is there a bug or change in Godot 4.4.1 that impacts layering or Node2D–Management interplay?
  • Ought to I be doing the arc calculations in world or native house for greatest accuracy?
  • Is CanvasLayer/Management at all times drawn on high of Node2D, no matter z-index?
  • Might Management-based containers (VBox/HBox) inside a Node2D slot trigger surprising stacking?

Any sensible recommendation, working code samples, or greatest practices for slot arc/distribution and dependable 2D card fanning/layering in Godot 4 could be an enormous assist. Thanks!

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles