diff --git a/Pegs/Actions/SwingShortsword.cs b/Pegs/Actions/SwingShortsword.cs index f25d55d..4f5cd7f 100644 --- a/Pegs/Actions/SwingShortsword.cs +++ b/Pegs/Actions/SwingShortsword.cs @@ -23,7 +23,7 @@ public partial class SwingShortsword : PegAction Tween subtween = CreateTween(); subtween.TweenProperty(_image, "visible", true, 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(() => { PEG._pegController._playerController.ChangeHealth(-2, this); diff --git a/Pegs/Actions/ThrustSpear.cs b/Pegs/Actions/ThrustSpear.cs index 8866c39..bc9499d 100644 --- a/Pegs/Actions/ThrustSpear.cs +++ b/Pegs/Actions/ThrustSpear.cs @@ -8,7 +8,7 @@ public partial class ThrustSpear : PegAction base._Ready(); _category = "attack"; _priority = 1; - _cost = 2; + _cost = 1; _range = 1; _usesMax = 1; _usesRemaining = _usesMax; @@ -16,16 +16,18 @@ public partial class ThrustSpear : PegAction public override Tween CreateAnimation(Peg PEG) { + GD.Print(Name); Map map = PEG._pegController._playArea._map; Peg pegTarget = map._addressOccupants[Target(PEG)]; + Vector2 target = pegTarget.GlobalPosition; Tween subtween = CreateTween(); subtween.TweenProperty(_image, "visible", true, 0.0f); - subtween.TweenProperty(_image, "rotation", PEG.GetAngleTo(pegTarget.GlobalPosition), 0.0f); - subtween.TweenProperty(_image, "position", pegTarget, 0.5f); + subtween.TweenProperty(_image, "rotation", PEG.GetAngleTo(target), 0.0f); + subtween.TweenProperty(_image, "global_position", target, 0.5f); subtween.TweenCallback(Callable.From(() => { - pegTarget.ChangeHealth(-2); + pegTarget.ChangeHealth(-1); _image.Position = Vector2.Zero; _image.Visible = false; })); diff --git a/Pegs/Actions/thrust_spear.tscn b/Pegs/Actions/thrust_spear.tscn index fab783b..dbde826 100644 --- a/Pegs/Actions/thrust_spear.tscn +++ b/Pegs/Actions/thrust_spear.tscn @@ -1,9 +1,12 @@ [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="Texture2D" uid="uid://32m5teus1cjj" path="res://Art/tower.png" id="2_nwcvh"] [node name="ThrustSpear" type="Node2D" unique_id=460007250] 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") diff --git a/Pegs/PegAction.cs b/Pegs/PegAction.cs index e197af0..44067f1 100644 --- a/Pegs/PegAction.cs +++ b/Pegs/PegAction.cs @@ -25,6 +25,10 @@ public partial class PegAction : Node2D 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 && _usesRemaining > 0 && (PEG._address - Target(PEG)).Length() <= _range;