Player movement and camera

This commit is contained in:
Marco 2025-06-11 15:28:26 +02:00
commit a324f2e347
43 changed files with 1777 additions and 316 deletions

View file

@ -14,14 +14,14 @@ public partial class MovementPattern : AttackPattern
[Export] public Tween.EaseType easeType = Tween.EaseType.InOut;
[Export] public AttackPattern shootingPattern;
public override IPatternMachine MakeMachine(Node2D parent)
public override IPatternMachine MakeMachine(Node parent)
{
return new MovementPatternMachine(this, parent);
}
public class MovementPatternMachine(MovementPattern pattern, Node2D parent) : IPatternMachine
public class MovementPatternMachine(MovementPattern pattern, Node parent) : IPatternMachine
{
public Node2D Parent => parent;
public Node Parent => parent;
public MovementPattern Pattern { get; } = pattern;
private IPatternMachine _machine;
@ -39,10 +39,11 @@ public partial class MovementPattern : AttackPattern
Boss = boss;
tween = parent.CreateTween();
isComplete = false;
Vector2 targetPosition = (Boss?.HomePosition ?? boss.ParentObject.GlobalPosition) + Pattern.relativeTargetPosition;
Vector2 targetPosition = (Boss?.HomePosition ?? parent.GlobalPosition) + Pattern.relativeTargetPosition;
tween.TweenProperty(Parent, "position", targetPosition, Pattern.moveDuration)
tween.TweenProperty(boss.ParentObject, "position", targetPosition, Pattern.moveDuration)
.SetTrans(Pattern.transitionType)
.SetEase(Pattern.easeType)
.Finished += () => isComplete = true;