signalis/src/player_animation.ts
2025-05-03 04:39:10 -05:00

28 lines
753 B
TypeScript

import { AnimationTree, float64 } from 'godot'
import Player from './player'
import PlayerInput from './player_input'
import { onready } from 'godot.annotations'
export const PlayerAnimationName = Object.freeze({
Idle: 'Idle',
Walk: 'Walking',
Run: 'SlowRun',
Interact: 'Interact',
Aim: 'PistolIdle',
Fire: 'Shooting'
} as const)
export default class PlayerAnimation extends AnimationTree {
//private static Interact = 'parameters/conditions/interact'
private static Movement = 'parameters/Movement/blend_position'
@onready('../')
player!: Player
@onready('../Input')
readonly player_input!: PlayerInput
_process(_delta: float64): void {
this.set(PlayerAnimation.Movement, this.player.velocity.length_squared())
}
}