0 votes

Hello,

I'm working on making an inventory using the grid container. So far it works and looks pretty nice but I've realized there isn't an obvious way to set the position of an object in a GridContainer? I'm creating instances of objects as TextureRects and making them children to the GridConatiner.

I've also tried to redo this with an ItemList instead of a grid. But this doesn't appear to have a signal for when the mouse enters an item. (I have custom tooltips that utilize this)

See here: https://i.imgur.com/N5ASrjv.gifv (place holder sprites lol)

Thanks

asked Jan 9 in Engine by Jefff (15 points)

1 Answer

+2 votes
Best answer

GridContainer contents are ordered by child order. You can use Node.add_child_below_node() when you add the item or Node.move_child() to rearrange.

answered Jan 9 by kidscancode (17,772 points)
selected Jan 9 by Jefff

Oh, I see that points be in a better direction.

I suppose this would be pretty useful then:

getparent().movechild(self, index)
https://docs.godotengine.org/en/3.1/classes/class_node.html#class-node-method-move-child

Thanks! :)

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.