35 lines
742 B
C#
35 lines
742 B
C#
using Godot;
|
|
using System;
|
|
using DungeonRPG.Scripts.General;
|
|
|
|
public partial class Player : CharacterBody3D
|
|
{
|
|
[Export] public AnimatedSprite3D AnimatedSprite {get; private set;}
|
|
[Export] public StateMachine StateMachine {get; private set;}
|
|
|
|
public Vector2 Direction;
|
|
public override void _Ready()
|
|
{
|
|
}
|
|
|
|
public override void _Input(InputEvent @event)
|
|
{
|
|
Direction = Input.GetVector(
|
|
GameConstants.INPUT_MOVE_LEFT,
|
|
GameConstants.INPUT_MOVE_RIGHT,
|
|
GameConstants.INPUT_MOVE_FORWARD,
|
|
GameConstants.INPUT_MOVE_BACKWARD
|
|
);
|
|
|
|
if (Direction.X != 0)
|
|
{
|
|
AnimatedSprite.FlipH = Direction.X < 0;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|