Files
peggle-roguelike/Pegs/Actions/Shortbow.cs
T

34 lines
955 B
C#

using Godot;
using System;
using System.Linq;
public partial class Shortbow : PegAction
{
public override void _Ready()
{
base._Ready();
_category = "attack";
_priority = 1;
_cost = 2;
_range = 1;
_usesMax = 1;
_usesRemaining = _usesMax;
}
public override Tween CreateAnimation(Peg PEG)
{
Vector2 target = PEG._pegController._playerController._towers.OrderBy(t => (t.GlobalPosition - GlobalPosition).Length()).ToList()[0].GlobalPosition;
Tween subtween = CreateTween();
subtween.TweenProperty(_image, "visible", true, 0.0f);
subtween.TweenProperty(_image, "global_position", target, 0.5f);
subtween.TweenCallback(Callable.From(() =>
{
PEG._pegController._playerController.ChangeHealth(-1, this);
Position = Vector2.Zero;
Visible = false;
}));
return subtween;
}
}