adding in some example pegs and their actions. organizing folders, still working on pathing for some reason it won't move sometimes, and causes the looping to break

This commit is contained in:
2026-06-26 02:36:01 -04:00
parent fc32baa071
commit 350d2bc4d1
33 changed files with 366 additions and 165 deletions
+9 -16
View File
@@ -9,7 +9,7 @@ public partial class Tower : HoverableNode
public int _launchSpeed = 1000, _arcIterations = 50;
public Vector2 _aimOffset, _arcEnd;
public List<Vector2> _arc = new();
public Marker2D _offset, _attackSpawn;
public Marker2D _offset, _ballSpawn;
public Area2D _area;
public Commander _commander;
public override void _Ready()
@@ -17,7 +17,7 @@ public partial class Tower : HoverableNode
base._Ready();
_offset = GetNode<Marker2D>("Offset");
_attackSpawn = GetNode<Marker2D>("AttackSpawn");
_ballSpawn = GetNode<Marker2D>("BallSpawn");
// Click += HandleClick;
}
public override void _Process(double delta)
@@ -29,19 +29,19 @@ public partial class Tower : HoverableNode
{
if (_arcEnd != GetGlobalMousePosition())
{
DrawArc(_attackSpawn.GlobalPosition, GetGlobalMousePosition());
DrawArc(_ballSpawn.GlobalPosition, GetGlobalMousePosition());
}
if (Input.IsActionJustPressed("rightClick"))
{
_commander.UnloadAttack();
_commander.UnloadBall();
_aiming = false;
}
else if (Input.IsActionJustPressed("leftClick"))
{
_aimOffset = ToLaunchVector(CalculateLaunchAngle(_attackSpawn.GlobalPosition, GetGlobalMousePosition()));
_aimOffset = ToLaunchVector(CalculateLaunchAngle(_ballSpawn.GlobalPosition, GetGlobalMousePosition()));
_commander.ShootCurrentAttack(_aimOffset);
_commander.ShootCurrentBall(_aimOffset);
ClearArc();
_aiming = false;
@@ -52,7 +52,7 @@ public partial class Tower : HoverableNode
if (Input.IsActionJustPressed("leftClick"))
{
_aiming = true;
_commander.LoadAttack(_attackSpawn.Position);
_commander.LoadBall(_ballSpawn.Position);
}
}
}
@@ -112,7 +112,7 @@ public partial class Tower : HoverableNode
public void ClearArc()
{
Path2D path = _commander._attack.GetNode<Path2D>("PredictedPath");
Path2D path = _commander._ball.GetNode<Path2D>("PredictedPath");
path.Curve.ClearPoints();
}
@@ -144,7 +144,7 @@ public partial class Tower : HoverableNode
}
}
Path2D path = _commander._attack.GetNode<Path2D>("PredictedPath");
Path2D path = _commander._ball.GetNode<Path2D>("PredictedPath");
path.Curve.ClearPoints();
for (int i = 0; i < arc.Count; i++)
@@ -193,11 +193,4 @@ public partial class Tower : HoverableNode
return Vector2.FromAngle(ANGLE) * _launchSpeed;
}
public void OnMouseEntered(){
_hovered = true;
}
public void OnMouseExited(){
_hovered = true;
}
}