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

in Engine by (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.

by (20,475 points)
selected by

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.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.