18 lines
630 B
GDScript
18 lines
630 B
GDScript
extends Node3D
|
|
|
|
@export var animation_tree: AnimationTree
|
|
@onready var parent: CharacterBody3D = $".."
|
|
@onready var animation_player: AnimationPlayer = $"../AnimationPlayer"
|
|
|
|
func _physics_process(delta: float) -> void:
|
|
if parent.velocity.length() <= .1:
|
|
#animation_tree.set("parameters/attack/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE)
|
|
animation_tree.set("parameters/idle_walk_blend/blend_amount", 1)
|
|
else:
|
|
animation_tree.set("parameters/idle_walk_blend/blend_amount", -1)
|
|
|
|
func dying():
|
|
animation_tree.active = false
|
|
animation_player.speed_scale = randf_range(.8,1.2)
|
|
animation_player.play("custom/death")
|