Here it is. If you have a tilesheet like Kenny’s 1-bit pack:
https://kenney.nl/assets/1-bit-pack
Then you can you it as an atlas in TextureRect. Choose New AtlasTexture and then add it to the atlas option below that.
To change your TextureRect to be a portion of the tilesheet, ignore all the .atlas code and just directly call self.texture.region = Rect2
extends TextureRect
var id: int = 0
var item_name: String = ""
var item_region: Vector2 = Vector2(0,0)
var item_region_dict = {"empty": Vector2(0,416),
"apple": Vector2(512,288), "sword": Vector2(544,448), "armor": Vector2(554,336),
"cheese": Vector2(576,288), "helmet": Vector2(544,320), "shield": Vector2(528,352),
"bow": Vector2(656,368), "staff": Vector2(608,384),
}
func define(new_id, new_name):
id = new_id
item_name = new_name
self.texture.region = Rect2(item_region_dict[item_name], Vector2(16, 16))