sábado, 3 de febrero de 2024

al presionar una tecla se anima la animacion de godot3d;

 extends Node3D


# Variable para controlar si la animación está activa

var is_animating = false


# Called when the node enters the scene tree for the first time.

func _ready():

pass


# Called every frame. 'delta' is the elapsed time since the previous frame.

func _process(delta):

# Reproduce la animación al presionar la tecla "M"

if Input.is_action_pressed("ui_right"):  # Reemplaza "ui_accept" con el código de acción real de la tecla "M"

if not is_animating:

$AnimationPlayer.play("Armature|zombietictocchica|default")

is_animating = true

# Evita repetir la animación mientras se mantiene presionada la tecla

elif is_animating and not Input.is_action_pressed("ui_right"):

is_animating = false