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

24 lines
395 B
GDScript3
Raw Normal View History

2023-10-02 13:45:13 +00:00
extends Node
class_name Colored
@export var shader: Shader
2023-10-02 21:24:01 +00:00
@onready var hue: float:
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
@onready var parent: Sprite2D = get_parent()
func _ready():
var material = ShaderMaterial.new()
2023-10-02 21:24:01 +00:00
hue = Randomizer.rng.randf()
2023-10-02 13:45:13 +00:00
material.shader = shader
parent.material = material
2023-10-02 21:24:01 +00:00