24.3 C
New York
Sunday, July 27, 2025

godot – Arc Slot Structure and Card Show Overlap


I am combating a persistent drawback in my Godot 4.4.1 venture involving “energy slots” organized round a desk or enviornment background. Regardless of how I construction my nodes and replace my code, I maintain 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 typically seem beneath the desk background or UI, as a substitute of in entrance.
  • Makes an attempt to fan playing cards horizontally in every slot both end in 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 parented all energy slots to a Node2D container. Nonetheless, the arc association and card stacking points persist.

Every participant can have 3 playing cards.

What I am Attempting To Obtain

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

What I’ve Already Tried

  • Mother or father all slots beneath 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 beneath 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 heart or do not comply with the arc in any respect.
  • Typically playing cards seem beneath the background or UI, regardless of z_index modifications.
  • 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 structure bugs.

Questions

  1. What are essentially the most dependable methods in Godot 4 to maintain Node2D-based slots distributed in a precise 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 all the time seem on the proper place, not stacking or floating off-screen?
  4. What are widespread gotchas with z-index, CanvasLayer, or dad or mum/little one 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 many others.
    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

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 area for finest accuracy?
  • Is CanvasLayer/Management all the time drawn on high of Node2D, no matter z-index?
  • May Management-based containers (VBox/HBox) inside a Node2D slot trigger surprising stacking?

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

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles