1
Fork 0
mirror of https://github.com/Steffo99/swear-jar.git synced 2024-11-22 15:44:21 +00:00
swear-jar/color/Colored.gd

25 lines
407 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-02 21:24:01 +00:00
func randomize_hue():
hue = Randomizer.rng.randf()