mirror of
https://github.com/Steffo99/swear-jar.git
synced 2024-11-25 00:54:19 +00:00
24 lines
407 B
GDScript
24 lines
407 B
GDScript
extends Node
|
|
class_name Colored
|
|
|
|
@export var shader: Shader
|
|
|
|
@onready var parent: Sprite2D = get_parent()
|
|
|
|
var hue: float:
|
|
get:
|
|
return hue
|
|
set(value):
|
|
hue = value
|
|
if parent.material:
|
|
parent.material.set_shader_parameter("hue", value)
|
|
|
|
|
|
func _ready():
|
|
var material = ShaderMaterial.new()
|
|
material.shader = shader
|
|
parent.material = material
|
|
|
|
|
|
func randomize_hue():
|
|
hue = Randomizer.rng.randf()
|