summaryrefslogtreecommitdiff
path: root/scripts/tile_manager.gd
blob: 191b39ff7d531a4d15332a5bb5b5a78b37038b27 (plain)
1
2
3
4
5
6
7
8
9
extends Node

@export var tile_set : TileSet = preload("res://resources/tiles.tres")

func get_tile_texture(atlas_coords: Vector2i) -> Texture:
	var source : TileSetAtlasSource = tile_set.get_source(0)
	var texture_region : Rect2i = source.get_tile_texture_region(atlas_coords)
	var tile_image : Image = source.texture.get_image().get_region(texture_region)
	return ImageTexture.create_from_image(tile_image)