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.
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.
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)!