untap/field.gd
2025-04-24 13:20:57 -04:00

45 lines
1.2 KiB
GDScript

extends TextureRect
var _screen_size: Vector2
var _colors: Array[Color]
var _card_scene = preload("res://card.tscn")
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
# TODO: Calculate this field's scale and position based on which no# field this is.
_screen_size = get_viewport_rect().size
var card = _card_scene.instantiate()
# TODO: Currently working with an already-cached card with a known ID to load this.
# Later on, the cards should be pulling the IDs directly from the library's list of IDs.
card.init("d3f10f07-7cfe-4a6f-8de6-373e367a731b")
add_child(card)
func set_colors(colors: Array[Color]) -> void:
_colors = colors
# TODO: Method to take list of colors, split into this format of dictionary, and apply as gradient.
var gradient_data := {
0.0: Color.MAROON,
1.0: Color.MAROON,
}
var gradient := Gradient.new()
gradient.offsets = gradient_data.keys()
gradient.colors = gradient_data.values()
var gradient_texture = GradientTexture1D.new()
gradient_texture.gradient = gradient
texture = gradient_texture
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta: float) -> void:
pass