Godot Version 4
Good afternoon, I was watching a video on how to make a sprite have colors in gradients, but I ran into a problem: the godot engine update also brought changes and now it gives me an error that I can’t solve, it’s because of the interpolations of gradients on a scene I would appreciate some help…
This is the script and it is about a health bar.-
extends HBoxContainer
@export var salud_gradiante : Gradient
@export var escena_objeto : PackedScene
@export var salud_maxima:float = 15
var salud = 0
func _ready():
salud = salud_maxima
setup_salud()
pass
func setup_salud():
#var objeto = escena_objeto.instantiate()
for i in range(salud_maxima):
add_child(escena_objeto.instantiate())
update_color()
func _process(delta):
pass
func update_color():
for i in get_children():
i.modulate = salud_gradiante.interpolate(float(i.get_index()/ salud_maxima))
and this is the error: (Invalid call. Nonexistent function ‘interpolate’ in base ‘Gradient’.)