mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-08 20:56:01 +00:00
Bad tank movement
This commit is contained in:
parent
12f0062fe8
commit
90d2a95fa8
10 changed files with 514 additions and 8 deletions
|
|
@ -1,23 +1,37 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cirno.Scripts.Components.Actors;
|
||||
using Godot;
|
||||
|
||||
public partial class ActorFreeMovement : MovementHandler
|
||||
{
|
||||
public override Vector2 FacingDirection
|
||||
{
|
||||
get => _parent.FacingDirection;
|
||||
set => _parent.FacingDirection = value;
|
||||
}
|
||||
|
||||
private Actor _parent;
|
||||
public override Vector2 MovementDirection
|
||||
{
|
||||
get => _parent.MovementDirection;
|
||||
set => _parent.MovementDirection = value;
|
||||
}
|
||||
|
||||
public override void Init(Actor parent)
|
||||
{
|
||||
_parent = parent;
|
||||
base.Init(parent);
|
||||
|
||||
MovementDirection = Vector2.Zero;
|
||||
_parent.FacingDirection = Vector2.Down;
|
||||
FacingDirection = Vector2.Down;
|
||||
}
|
||||
|
||||
public override void Move(double delta)
|
||||
{
|
||||
MovementDirection = AggregateInputProviders();
|
||||
|
||||
_parent.Velocity = MovementDirection * _parent.MovementSpeed;
|
||||
|
||||
_parent.MoveAndSlide();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue