Skip to content
Discussion options

You must be logged in to vote

Hi!
I’ve found the solution.
To get the item in the first or second slot, I needed to use the get_item_at method in GridConstraint.
https://github.com/peter-kish/gloot/blob/master/docs/grid_constraint.md

Here’s the code:

extends CanvasLayer

@onready var grid = $Control/HotbarInventory/GridConstraint

func _ready():
	var first_item = grid.get_item_at(Vector2i(0, 0))
	var second_item = grid.get_item_at(Vector2i(1, 0))
	
	print(first_item)
	print(second_item)

Thank you so much for your help!
I can’t believe I missed that in the documentation earlier. 😊

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ivankrivenko
Comment options

@ivankrivenko
Comment options

Answer selected by ivankrivenko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants