implemented visibility, so pegs can only scope out as far as they can see.

This commit is contained in:
2026-06-30 18:24:11 -04:00
parent c8e81e4f48
commit b1625b15a0
8 changed files with 53 additions and 32 deletions
+12 -8
View File
@@ -9,7 +9,6 @@ public partial class BasicMovement : PegAction
base._Ready();
_category = "movement";
_priority = 0;
_healthChange = 0;
_cost = 1;
_range = 2^32;
_usesMax = 2^32;
@@ -17,23 +16,28 @@ public partial class BasicMovement : PegAction
}
public override Tween CreateAnimation(Peg PEG)
{
PegController pegController = PEG._pegController;
Map map = pegController._playArea._map;
Vector2I cell = PEG._path[0];
Tween subtween = CreateTween();
subtween.TweenProperty(PEG, "global_position", map.GetCellPositionFromAddress(cell), 0.25f);
PEG._path.RemoveAt(0);
return subtween;
}
public override void DoImmediately(Peg PEG)
{
List<Vector2I> path = PEG.GetBestPath();
PegController pegController = PEG._pegController;
Map map = pegController._playArea._map;
if (path?.Count == 0)
{
return null;
return;
}
Vector2I cell = path[0];
map.SetCellPeg(cell, PEG);
PEG._path.Add(cell);
Tween subtween = CreateTween();
subtween.TweenProperty(PEG, "global_position", map.GetCellPositionFromAddress(cell), 0.25f);
return subtween;
}
public override bool MeetsCriteria(Peg PEG)
+1 -2
View File
@@ -9,7 +9,6 @@ public partial class Shortbow : PegAction
base._Ready();
_category = "attack";
_priority = 1;
_healthChange = -1;
_cost = 2;
_range = 1;
_usesMax = 1;
@@ -24,7 +23,7 @@ public partial class Shortbow : PegAction
subtween.TweenProperty(_image, "global_position", target, 0.5f);
subtween.TweenCallback(Callable.From(() =>
{
PEG._pegController._playerController.ChangeHealth(_healthChange, this);
PEG._pegController._playerController.ChangeHealth(-1, this);
Position = Vector2.Zero;
Visible = false;
}));
+3 -4
View File
@@ -9,7 +9,6 @@ public partial class Shortsword : PegAction
base._Ready();
_category = "attack";
_priority = 1;
_healthChange = -2;
_cost = 2;
_range = 0;
_usesMax = 1;
@@ -18,14 +17,14 @@ public partial class Shortsword : PegAction
public override Tween CreateAnimation(Peg PEG)
{
Vector2 target = PEG._disposition * Vector2.Up * PEG._pegController._playArea._map._cellSize;
GD.Print(target);
Vector2 target = PEG._disposition * Vector2.Down * PEG._pegController._playArea._map._cellSize;
// GD.Print(target);
Tween subtween = CreateTween();
subtween.TweenProperty(_image, "visible", true, 0.0f);
subtween.TweenProperty(_image, "position", target, 0.5f);
subtween.TweenCallback(Callable.From(() =>
{
PEG._pegController._playerController.ChangeHealth(_healthChange, this);
PEG._pegController._playerController.ChangeHealth(-2, this);
_image.Position = Vector2.Zero;
_image.Visible = false;
}));