still working out movement
This commit is contained in:
@@ -20,10 +20,10 @@ public partial class BasicMovement : PegAction
|
||||
{
|
||||
PegController pegController = PEG._pegController;
|
||||
Map map = pegController._playArea._map;
|
||||
Vector2I cell = PEG._path[0];
|
||||
MapCell cell = PEG._path[0];
|
||||
|
||||
Tween subtween = CreateTween();
|
||||
Vector2 target = map.GetCellPositionFromAddress(cell);
|
||||
Vector2 target = cell.GlobalPosition;
|
||||
|
||||
subtween.TweenProperty(PEG, "global_position", target, 0.25f);
|
||||
PEG._path.RemoveAt(0);
|
||||
@@ -32,23 +32,23 @@ public partial class BasicMovement : PegAction
|
||||
|
||||
public override void DoImmediately(Peg PEG)
|
||||
{
|
||||
List<Vector2I> path = PEG.GetBestPath(true);
|
||||
List<MapCell> path = PEG.GetBestPath(true);
|
||||
PegController pegController = PEG._pegController;
|
||||
Map map = pegController._playArea._map;
|
||||
if (path?.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Vector2I cell = path[0];
|
||||
MapCell cell = path[0];
|
||||
|
||||
map.SetCellPeg(map._cells[cell], PEG);
|
||||
map.SetCellPeg(cell, PEG);
|
||||
PEG._path.Add(cell);
|
||||
}
|
||||
|
||||
public override bool MeetsCriteria(Peg PEG)
|
||||
{
|
||||
List<Vector2I> bestPath = PEG.GetBestPath(true);
|
||||
return base.MeetsCriteria(PEG) && bestPath.Count > 0 && (int)PEG._pegController._playArea._map.GetCellTileData(bestPath[0]).GetCustomData("disposition") != -(int)PEG._disposition;
|
||||
List<MapCell> bestPath = PEG.GetBestPath(true);
|
||||
return base.MeetsCriteria(PEG) && bestPath.Count > 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,10 @@ public partial class ThrustSpear : PegAction
|
||||
public override Tween CreateAnimation(Peg PEG)
|
||||
{
|
||||
MapCell target = Target(PEG);
|
||||
if (target == PEG._cell)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Tween subtween = CreateTween();
|
||||
|
||||
subtween.TweenProperty(_image, "visible", true, 0.0f);
|
||||
@@ -36,5 +40,4 @@ public partial class ThrustSpear : PegAction
|
||||
return PEG.Goal();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
script = ExtResource("1_revbx")
|
||||
|
||||
[node name="Image" type="Sprite2D" parent="." unique_id=1133735272]
|
||||
visible = false
|
||||
position = Vector2(0, -4.999999)
|
||||
scale = Vector2(0.1, 0.1)
|
||||
texture = ExtResource("2_nwcvh")
|
||||
|
||||
Reference in New Issue
Block a user