minor change for testing, still a bunch to do. someh=thing that popped up, should hostile and friendly pegs go at the same time or staggered
This commit is contained in:
@@ -23,7 +23,7 @@ public partial class SwingShortsword : PegAction
|
|||||||
Tween subtween = CreateTween();
|
Tween subtween = CreateTween();
|
||||||
subtween.TweenProperty(_image, "visible", true, 0.0f);
|
subtween.TweenProperty(_image, "visible", true, 0.0f);
|
||||||
subtween.TweenProperty(_image, "rotation", PEG.GetAngleTo(target), 0.0f);
|
subtween.TweenProperty(_image, "rotation", PEG.GetAngleTo(target), 0.0f);
|
||||||
subtween.TweenProperty(_image, "position", target, 0.5f);
|
subtween.TweenProperty(_image, "global_position", target, 0.5f);
|
||||||
subtween.TweenCallback(Callable.From(() =>
|
subtween.TweenCallback(Callable.From(() =>
|
||||||
{
|
{
|
||||||
PEG._pegController._playerController.ChangeHealth(-2, this);
|
PEG._pegController._playerController.ChangeHealth(-2, this);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ public partial class ThrustSpear : PegAction
|
|||||||
base._Ready();
|
base._Ready();
|
||||||
_category = "attack";
|
_category = "attack";
|
||||||
_priority = 1;
|
_priority = 1;
|
||||||
_cost = 2;
|
_cost = 1;
|
||||||
_range = 1;
|
_range = 1;
|
||||||
_usesMax = 1;
|
_usesMax = 1;
|
||||||
_usesRemaining = _usesMax;
|
_usesRemaining = _usesMax;
|
||||||
@@ -16,16 +16,18 @@ public partial class ThrustSpear : PegAction
|
|||||||
|
|
||||||
public override Tween CreateAnimation(Peg PEG)
|
public override Tween CreateAnimation(Peg PEG)
|
||||||
{
|
{
|
||||||
|
GD.Print(Name);
|
||||||
Map map = PEG._pegController._playArea._map;
|
Map map = PEG._pegController._playArea._map;
|
||||||
Peg pegTarget = map._addressOccupants[Target(PEG)];
|
Peg pegTarget = map._addressOccupants[Target(PEG)];
|
||||||
|
Vector2 target = pegTarget.GlobalPosition;
|
||||||
Tween subtween = CreateTween();
|
Tween subtween = CreateTween();
|
||||||
|
|
||||||
subtween.TweenProperty(_image, "visible", true, 0.0f);
|
subtween.TweenProperty(_image, "visible", true, 0.0f);
|
||||||
subtween.TweenProperty(_image, "rotation", PEG.GetAngleTo(pegTarget.GlobalPosition), 0.0f);
|
subtween.TweenProperty(_image, "rotation", PEG.GetAngleTo(target), 0.0f);
|
||||||
subtween.TweenProperty(_image, "position", pegTarget, 0.5f);
|
subtween.TweenProperty(_image, "global_position", target, 0.5f);
|
||||||
subtween.TweenCallback(Callable.From(() =>
|
subtween.TweenCallback(Callable.From(() =>
|
||||||
{
|
{
|
||||||
pegTarget.ChangeHealth(-2);
|
pegTarget.ChangeHealth(-1);
|
||||||
_image.Position = Vector2.Zero;
|
_image.Position = Vector2.Zero;
|
||||||
_image.Visible = false;
|
_image.Visible = false;
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
[gd_scene format=3 uid="uid://xx4n81m8hbxv"]
|
[gd_scene format=3 uid="uid://xx4n81m8hbxv"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://bj2lg1voxioq7" path="res://Pegs/Actions/ThrustSpear.cs" id="1_revbx"]
|
[ext_resource type="Script" uid="uid://bj2lg1voxioq7" path="res://Pegs/Actions/ThrustSpear.cs" id="1_revbx"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://32m5teus1cjj" path="res://Art/tower.png" id="2_nwcvh"]
|
||||||
|
|
||||||
[node name="ThrustSpear" type="Node2D" unique_id=460007250]
|
[node name="ThrustSpear" type="Node2D" unique_id=460007250]
|
||||||
script = ExtResource("1_revbx")
|
script = ExtResource("1_revbx")
|
||||||
|
|
||||||
[node name="Image" type="Sprite2D" parent="." unique_id=1133735272]
|
[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")
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ public partial class PegAction : Node2D
|
|||||||
|
|
||||||
public virtual bool MeetsCriteria(Peg PEG)
|
public virtual bool MeetsCriteria(Peg PEG)
|
||||||
{
|
{
|
||||||
|
if (PEG.GetType().ToString() == "Spearman")
|
||||||
|
{
|
||||||
|
GD.Print(Name,": ",PEG._staminaRemaining >= _cost, "&&", _usesRemaining > 0, "&&", (PEG._address - Target(PEG)).Length() <= _range);
|
||||||
|
}
|
||||||
return PEG._staminaRemaining >= _cost
|
return PEG._staminaRemaining >= _cost
|
||||||
&& _usesRemaining > 0
|
&& _usesRemaining > 0
|
||||||
&& (PEG._address - Target(PEG)).Length() <= _range;
|
&& (PEG._address - Target(PEG)).Length() <= _range;
|
||||||
|
|||||||
Reference in New Issue
Block a user