...
This commit is contained in:
parent
2f4be2d317
commit
3a4b1cea9b
1 changed files with 21 additions and 0 deletions
|
|
@ -0,0 +1,21 @@
|
|||
```python
|
||||
extends Node2D
|
||||
|
||||
@onready var main: Node2D = $"."
|
||||
@onready var palette: VBoxContainer = $UI/PanelContainer/ScrollContainer/VBoxContainer
|
||||
|
||||
func _ready():
|
||||
print("Palette initialized.")
|
||||
|
||||
var atlas_texture = AtlasTexture.new()
|
||||
var atlas_image = Image.new()
|
||||
|
||||
atlas_image.load("res://assets/spritesheets/map_hex_terrain_72x72_spritesheet.png")
|
||||
atlas_texture.atlas = ImageTexture.create_from_image(atlas_image)
|
||||
atlas_texture.region = Rect2(Vector2(0,73),Vector2(72,72)) # x,y,width,height
|
||||
|
||||
var tr = TextureRect.new()
|
||||
tr.texture = atlas_texture
|
||||
|
||||
palette.add_child(tr)
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue