adding in some example pegs and their actions. organizing folders, still working on pathing for some reason it won't move sometimes, and causes the looping to break
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
public partial class Shortbow : PegAction
|
||||
{
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
_priority = 1000;
|
||||
_healthChange = -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(_healthChange, this);
|
||||
Position = Vector2.Zero;
|
||||
Visible = false;
|
||||
}));
|
||||
return subtween;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://dt7qbvowj1sm4
|
||||
@@ -0,0 +1,31 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
public partial class Shortsword : PegAction
|
||||
{
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
_priority = 1000;
|
||||
_healthChange = -2;
|
||||
_cost = 2;
|
||||
_range = 0;
|
||||
_usesMax = 1;
|
||||
_usesRemaining = _usesMax;
|
||||
}
|
||||
public override Tween CreateAnimation(Peg PEG)
|
||||
{
|
||||
Vector2 target = PEG.GlobalPosition + (Vector2.Up * 50);
|
||||
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(_healthChange, this);
|
||||
_image.Position = Vector2.Zero;
|
||||
_image.Visible = false;
|
||||
}));
|
||||
return subtween;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://td6dv1t4y5os
|
||||
@@ -0,0 +1,8 @@
|
||||
[gd_scene format=3 uid="uid://duspilwelsiy3"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dt7qbvowj1sm4" path="res://Pegs/Actions/Shortbow.cs" id="1_yhiab"]
|
||||
|
||||
[node name="Shortbow" type="Node2D" unique_id=518048625]
|
||||
script = ExtResource("1_yhiab")
|
||||
|
||||
[node name="Image" type="Sprite2D" parent="." unique_id=944294157]
|
||||
@@ -0,0 +1,12 @@
|
||||
[gd_scene format=3 uid="uid://c6df6ib0qan5g"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://td6dv1t4y5os" path="res://Pegs/Actions/Shortsword.cs" id="1_rflgk"]
|
||||
[ext_resource type="Texture2D" uid="uid://32m5teus1cjj" path="res://Art/tower.png" id="2_fs74r"]
|
||||
|
||||
[node name="Shortsword" type="Node2D" unique_id=518048625]
|
||||
script = ExtResource("1_rflgk")
|
||||
|
||||
[node name="Image" type="Sprite2D" parent="." unique_id=906537972]
|
||||
visible = false
|
||||
scale = Vector2(0.1, 0.1)
|
||||
texture = ExtResource("2_fs74r")
|
||||
Reference in New Issue
Block a user