1
Fork 0
mirror of https://github.com/Steffo99/swear-jar.git synced 2024-11-28 02:14:19 +00:00
swear-jar/color/Colored.gd

26 lines
424 B
GDScript3
Raw Normal View History

2023-10-02 13:45:13 +00:00
extends Node
class_name Colored
@export var shader: Shader
@onready var parent: Sprite2D = get_parent()
var hue: float:
2023-10-02 21:24:01 +00:00
get:
return hue
set(value):
hue = value
if parent.material:
parent.material.set_shader_parameter("hue", value)
2023-10-02 13:45:13 +00:00
func _ready():
var material = ShaderMaterial.new()
material.shader = shader
parent.material = material
2023-10-14 00:27:55 +00:00
randomize_hue()
2023-10-02 21:24:01 +00:00
func randomize_hue():
hue = Randomizer.rng.randf()