25 lines
526 B
C#
25 lines
526 B
C#
using Godot;
|
|
using System;
|
|
|
|
public partial class Player : CharacterBody3D
|
|
{
|
|
|
|
private Vector2 direction = new Vector2();
|
|
public override void _PhysicsProcess(double delta)
|
|
{
|
|
this.Velocity = new Vector3(direction.X, 0, direction.Y);
|
|
this.Velocity *= 5;
|
|
MoveAndSlide();
|
|
}
|
|
|
|
public override void _Input(InputEvent @event)
|
|
{
|
|
direction = Input.GetVector(
|
|
"MoveLeft",
|
|
"MoveRight",
|
|
"MoveForward",
|
|
"MoveBackward"
|
|
);
|
|
}
|
|
}
|