Containers not working

Godot Version

4.2.2.stable

Question

image


the Armour is overlapping so are the keys and the cells but it only looks like one because they have the same sprite they are added like this

but I don’t know what I’m doing wrong I added print statements and they are in the container but all still have the same position here is the code hastebin

Please provide the goal appearance of this UI, such as a scene edit screenshot.

Before we do that, I’d like to discuss best programming practices. The code we write should be self-explanatory, which is why we use meaningful names. Instead of adding a comment for each line of code, we only add comments for parts that might not be clear.

But actually in programming, an unclear program means an ill-instructed program, this is why when seeing a huge, tedious function, we consider breaking it into smaller parts. A well-structured program will automatically attain readability, performance, and much more.

Sounds like your container does not have a size, try to give it a min size to see if it change anything

I added Coments so none whould be confused I understand it but I didnt knoew if other would be confused

1 Like

Heres the parts

image
kind of like enter the gungeon

that dose nothing

1 Like

As far as I know, only nodes that inherit from Control (that is, the ones with green icons) will obey a container. I don’t think an AnimatedSprite2D will behave how you want it to.

1 Like

This is correct!

In order to make use of a control node’s auto-positioning it must inherit from Control. Hopefully you can accomplish what you want using a combination of TextureRect (a control texture) and either an AnimationPlayer or a Tween (assuming it’s animated and that’s why you wanted the animated sprite)!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.