Files
chaussette.sale/personages/player_animation_tree.gd
Thomas fe463ad396 Initial commit
Un bout de jeu, qui fait pas grand chose mais on progresse.
2025-02-21 17:59:47 +01:00

18 lines
609 B
GDScript

extends Node2D
@export var animation_tree: AnimationTree
@onready var player : Player = get_owner()
var last_facing_direction = Vector2(0,-1) # facing south
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
var idle = !player.velocity
if !idle:
last_facing_direction = player.velocity.normalized()
animation_tree.set("parameters/walking/blend_position", last_facing_direction)
animation_tree.set("parameters/idling/blend_position", last_facing_direction)
animation_tree.set("parameters/grabing/blend_position", last_facing_direction)