Mostrando entradas con la etiqueta GDScript 3 animaciones turnandose cada 5 segundos automaticamente en el mismo personaje;. Mostrar todas las entradas
Mostrando entradas con la etiqueta GDScript 3 animaciones turnandose cada 5 segundos automaticamente en el mismo personaje;. Mostrar todas las entradas

martes, 24 de junio de 2025

GDScript 3 animaciones turnandose cada 5 segundos automaticamente en el mismo personaje; Godot 4.4;

 extends Node3D


@onready var animation_player = $AnimationPlayer

var animations = ["CAE", "POLI", "COJO"]

var current_animation_index = 0

var time_since_last_animation = 0.0

const ANIMATION_CHANGE_INTERVAL = 5.0


func _ready() -> void:

# Start with the first animation

animation_player.play(animations[current_animation_index])

pass

func _process(delta: float) -> void:

time_since_last_animation += delta


if time_since_last_animation >= ANIMATION_CHANGE_INTERVAL:

time_since_last_animation = 0.0

# Move to the next animation

current_animation_index = (current_animation_index + 1) % animations.size()

animation_player.play(animations[current_animation_index])

pass