Initial commit
Un bout de jeu, qui fait pas grand chose mais on progresse.
This commit is contained in:
17
personages/player_animation_tree.gd
Normal file
17
personages/player_animation_tree.gd
Normal file
@@ -0,0 +1,17 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user