1
Fork 0
mirror of https://github.com/Steffo99/swear-jar.git synced 2024-11-25 17:14:20 +00:00
swear-jar/color/Colored.gd
2023-10-02 23:24:01 +02:00

23 lines
395 B
GDScript

extends Node
class_name Colored
@export var shader: Shader
@onready var hue: float:
get:
return hue
set(value):
hue = value
if parent.material:
parent.material.set_shader_parameter("hue", value)
@onready var parent: Sprite2D = get_parent()
func _ready():
var material = ShaderMaterial.new()
hue = Randomizer.rng.randf()
material.shader = shader
parent.material = material