Added healing
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 8.4 KiB |
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://crak7ton4lab0"
|
||||||
|
path="res://.godot/imported/EmptyFightButton.png-941012f14ef5a6d6a385ea2e7599c6bb.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://art/ui/UI/EmptyFightButton.png"
|
||||||
|
dest_files=["res://.godot/imported/EmptyFightButton.png-941012f14ef5a6d6a385ea2e7599c6bb.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
@@ -1,10 +1,12 @@
|
|||||||
[gd_scene load_steps=9 format=3 uid="uid://cpanatqdjjpa3"]
|
[gd_scene load_steps=11 format=3 uid="uid://cpanatqdjjpa3"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://by88f32fou7lh" path="res://scripts/CSharp/Common/Fight/Fighter.cs" id="1_f3j2x"]
|
[ext_resource type="Script" uid="uid://by88f32fou7lh" path="res://scripts/CSharp/Common/Fight/Fighter.cs" id="1_f3j2x"]
|
||||||
[ext_resource type="Texture2D" uid="uid://om2axn1vfa5o" path="res://art/animation/Vesna2D/Vesna Anims Sequences/S01-Idle/0001.png" id="2_2ud32"]
|
[ext_resource type="Texture2D" uid="uid://om2axn1vfa5o" path="res://art/animation/Vesna2D/Vesna Anims Sequences/S01-Idle/0001.png" id="2_2ud32"]
|
||||||
[ext_resource type="Texture2D" uid="uid://qlfwuakhe57t" path="res://art/ui/UI/attack_select_wheel.png" id="3_80knd"]
|
[ext_resource type="Texture2D" uid="uid://qlfwuakhe57t" path="res://art/ui/UI/attack_select_wheel.png" id="3_80knd"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bn56p0ytuo060" path="res://art/ui/UI/AttackButton.png" id="4_0tqnl"]
|
|
||||||
[ext_resource type="AudioStream" uid="uid://pvqav5xbin5r" path="res://audio/sfx/Battle/Vesna/SFX_Battle_Vesna_Defense_08.wav" id="5_4r2vf"]
|
[ext_resource type="AudioStream" uid="uid://pvqav5xbin5r" path="res://audio/sfx/Battle/Vesna/SFX_Battle_Vesna_Defense_08.wav" id="5_4r2vf"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://6h85o7fj7gmu" path="res://art/animation/Vesna3D/vesna-more-tools.png" id="5_l04qi"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://crak7ton4lab0" path="res://art/ui/UI/EmptyFightButton.png" id="5_rjjub"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://c3wht0nakaki1" path="res://art/ui/UI/icons/icon-fruit-tomatoe.png" id="6_l04qi"]
|
||||||
[ext_resource type="AudioStream" uid="uid://bjmyose6dedsb" path="res://audio/sfx/Battle/Vesna/SFX_Battle_Vesna_Attack_04.wav" id="6_u1ayv"]
|
[ext_resource type="AudioStream" uid="uid://bjmyose6dedsb" path="res://audio/sfx/Battle/Vesna/SFX_Battle_Vesna_Attack_04.wav" id="6_u1ayv"]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_0tqnl"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_0tqnl"]
|
||||||
@@ -45,7 +47,6 @@ position = Vector2(3, -76)
|
|||||||
shape = SubResource("CircleShape2D_0tqnl")
|
shape = SubResource("CircleShape2D_0tqnl")
|
||||||
|
|
||||||
[node name="FightButtons" type="Node2D" parent="."]
|
[node name="FightButtons" type="Node2D" parent="."]
|
||||||
visible = false
|
|
||||||
position = Vector2(3, -714)
|
position = Vector2(3, -714)
|
||||||
|
|
||||||
[node name="CircleBackground" type="Sprite2D" parent="FightButtons"]
|
[node name="CircleBackground" type="Sprite2D" parent="FightButtons"]
|
||||||
@@ -59,7 +60,15 @@ position = Vector2(0, -536)
|
|||||||
[node name="ButtonBackground" type="Sprite2D" parent="FightButtons/AttackButton"]
|
[node name="ButtonBackground" type="Sprite2D" parent="FightButtons/AttackButton"]
|
||||||
z_index = 200
|
z_index = 200
|
||||||
scale = Vector2(2.48, 2.48)
|
scale = Vector2(2.48, 2.48)
|
||||||
texture = ExtResource("4_0tqnl")
|
texture = ExtResource("5_rjjub")
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="FightButtons/AttackButton/ButtonBackground"]
|
||||||
|
position = Vector2(6.04839, -10.0806)
|
||||||
|
rotation = -1.0088
|
||||||
|
scale = Vector2(0.249373, 0.25079)
|
||||||
|
texture = ExtResource("5_l04qi")
|
||||||
|
region_enabled = true
|
||||||
|
region_rect = Rect2(291.897, 15.8974, 272.82, 479.385)
|
||||||
|
|
||||||
[node name="Area2D" type="Area2D" parent="FightButtons/AttackButton"]
|
[node name="Area2D" type="Area2D" parent="FightButtons/AttackButton"]
|
||||||
collision_layer = 16
|
collision_layer = 16
|
||||||
@@ -67,6 +76,25 @@ collision_layer = 16
|
|||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="FightButtons/AttackButton/Area2D"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="FightButtons/AttackButton/Area2D"]
|
||||||
shape = SubResource("CircleShape2D_4r2vf")
|
shape = SubResource("CircleShape2D_4r2vf")
|
||||||
|
|
||||||
|
[node name="HealButton" type="Node2D" parent="FightButtons"]
|
||||||
|
position = Vector2(427, -334)
|
||||||
|
|
||||||
|
[node name="ButtonBackground" type="Sprite2D" parent="FightButtons/HealButton"]
|
||||||
|
z_index = 200
|
||||||
|
scale = Vector2(2.48, 2.48)
|
||||||
|
texture = ExtResource("5_rjjub")
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="FightButtons/HealButton/ButtonBackground"]
|
||||||
|
position = Vector2(4.83871, 0)
|
||||||
|
scale = Vector2(0.279343, 0.279343)
|
||||||
|
texture = ExtResource("6_l04qi")
|
||||||
|
|
||||||
|
[node name="Area2D" type="Area2D" parent="FightButtons/HealButton"]
|
||||||
|
collision_layer = 16
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="FightButtons/HealButton/Area2D"]
|
||||||
|
shape = SubResource("CircleShape2D_4r2vf")
|
||||||
|
|
||||||
[node name="HealthShow" type="Label" parent="."]
|
[node name="HealthShow" type="Label" parent="."]
|
||||||
z_index = 200
|
z_index = 200
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
@@ -92,3 +120,4 @@ stream = ExtResource("6_u1ayv")
|
|||||||
[connection signal="Attacking" from="." to="AttackAudio" method="play" binds= [0.0]]
|
[connection signal="Attacking" from="." to="AttackAudio" method="play" binds= [0.0]]
|
||||||
[connection signal="DamageTaken" from="." to="HitAudio" method="play" binds= [0.0]]
|
[connection signal="DamageTaken" from="." to="HitAudio" method="play" binds= [0.0]]
|
||||||
[connection signal="input_event" from="FightButtons/AttackButton/Area2D" to="." method="AttackMouseEvent"]
|
[connection signal="input_event" from="FightButtons/AttackButton/Area2D" to="." method="AttackMouseEvent"]
|
||||||
|
[connection signal="input_event" from="FightButtons/HealButton/Area2D" to="." method="HealMouseEvent"]
|
||||||
|
|||||||
@@ -765,6 +765,7 @@ texture = SubResource("NoiseTexture2D_e5alv")
|
|||||||
[node name="Fence" type="Node2D" parent="."]
|
[node name="Fence" type="Node2D" parent="."]
|
||||||
|
|
||||||
[node name="Fight1" type="Node2D" parent="."]
|
[node name="Fight1" type="Node2D" parent="."]
|
||||||
|
position = Vector2(0, 11)
|
||||||
|
|
||||||
[node name="FightStarter" type="Node2D" parent="Fight1" node_paths=PackedStringArray("_fightInstance")]
|
[node name="FightStarter" type="Node2D" parent="Fight1" node_paths=PackedStringArray("_fightInstance")]
|
||||||
position = Vector2(-1669, 72)
|
position = Vector2(-1669, 72)
|
||||||
@@ -808,7 +809,7 @@ position = Vector2(-133, 19)
|
|||||||
position = Vector2(32, 562)
|
position = Vector2(32, 562)
|
||||||
|
|
||||||
[node name="Fight2" type="Node2D" parent="."]
|
[node name="Fight2" type="Node2D" parent="."]
|
||||||
position = Vector2(3706, 0)
|
position = Vector2(3088, -22)
|
||||||
|
|
||||||
[node name="FightStarter" type="Node2D" parent="Fight2" node_paths=PackedStringArray("_fightInstance")]
|
[node name="FightStarter" type="Node2D" parent="Fight2" node_paths=PackedStringArray("_fightInstance")]
|
||||||
position = Vector2(-1669, 72)
|
position = Vector2(-1669, 72)
|
||||||
@@ -843,13 +844,13 @@ position = Vector2(0, 525)
|
|||||||
position = Vector2(1162, -12)
|
position = Vector2(1162, -12)
|
||||||
|
|
||||||
[node name="EnemyPos1" parent="Fight2/FightBaseScene/EnemyPositions" index="0"]
|
[node name="EnemyPos1" parent="Fight2/FightBaseScene/EnemyPositions" index="0"]
|
||||||
position = Vector2(-18, -482)
|
position = Vector2(251, -441)
|
||||||
|
|
||||||
[node name="EnemyPos2" parent="Fight2/FightBaseScene/EnemyPositions" index="1"]
|
[node name="EnemyPos2" parent="Fight2/FightBaseScene/EnemyPositions" index="1"]
|
||||||
position = Vector2(-133, 19)
|
position = Vector2(-385, 166)
|
||||||
|
|
||||||
[node name="EnemyPos3" parent="Fight2/FightBaseScene/EnemyPositions" index="2"]
|
[node name="EnemyPos3" parent="Fight2/FightBaseScene/EnemyPositions" index="2"]
|
||||||
position = Vector2(32, 562)
|
position = Vector2(178, 594)
|
||||||
|
|
||||||
[node name="YSorted" type="Node2D" parent="."]
|
[node name="YSorted" type="Node2D" parent="."]
|
||||||
z_index = 1
|
z_index = 1
|
||||||
|
|||||||
@@ -106,9 +106,24 @@ public partial class FightInstance : Node2D //TODO: remake
|
|||||||
ResetFriendlyActions();
|
ResetFriendlyActions();
|
||||||
_fightStateManager.CurrentFightState = FightStateManager.FightState.Input;
|
_fightStateManager.CurrentFightState = FightStateManager.FightState.Input;
|
||||||
break;
|
break;
|
||||||
|
case FightStateManager.FightState.Heal:
|
||||||
|
Heal();
|
||||||
|
GetTree().CreateTimer(1).Timeout += () => _fightStateManager.CurrentFightState = FightStateManager.FightState.Input;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
private void Heal()
|
||||||
|
{
|
||||||
|
// TODO: make heal staging system
|
||||||
|
_friendlyFighters.Where(f => !f.IsDead()).ForEach(f =>
|
||||||
|
{
|
||||||
|
f.Health += 50;
|
||||||
|
f.HealAnimation();
|
||||||
|
f.DecrementActions();
|
||||||
|
});
|
||||||
|
UpdateHealthVisual();
|
||||||
|
}
|
||||||
private void ResetEnemyActions()
|
private void ResetEnemyActions()
|
||||||
{
|
{
|
||||||
_enemyFighters.ForEach(f => f.ResetActions());
|
_enemyFighters.ForEach(f => f.ResetActions());
|
||||||
@@ -313,6 +328,11 @@ public partial class FightInstance : Node2D //TODO: remake
|
|||||||
_fightStateManager.CurrentFightState = FightStateManager.FightState.FriendAttackAnim;
|
_fightStateManager.CurrentFightState = FightStateManager.FightState.FriendAttackAnim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SelectHeal(Fighter fighter)
|
||||||
|
{
|
||||||
|
_fightStateManager.CurrentFightState = FightStateManager.FightState.Heal;
|
||||||
|
}
|
||||||
|
|
||||||
public bool CheckWinAndSetState()
|
public bool CheckWinAndSetState()
|
||||||
{
|
{
|
||||||
if (_enemyFighters.All(f => f.IsDead()))
|
if (_enemyFighters.All(f => f.IsDead()))
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ public partial class FightStateManager : Node
|
|||||||
EnemyWinAnim,
|
EnemyWinAnim,
|
||||||
ChangeSideToEnemy,
|
ChangeSideToEnemy,
|
||||||
ChangeSideToFriendly,
|
ChangeSideToFriendly,
|
||||||
|
Heal,
|
||||||
}
|
}
|
||||||
|
|
||||||
private FightState _fightStateBacking = FightState.None;
|
private FightState _fightStateBacking = FightState.None;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ public partial class Fighter : Node2D
|
|||||||
[Signal] public delegate void DamageTakenEventHandler();
|
[Signal] public delegate void DamageTakenEventHandler();
|
||||||
[Signal] public delegate void AttackingEventHandler();
|
[Signal] public delegate void AttackingEventHandler();
|
||||||
[Signal] public delegate void DyingEventHandler();
|
[Signal] public delegate void DyingEventHandler();
|
||||||
|
[Signal] public delegate void HealedEventHandler();
|
||||||
|
|
||||||
|
|
||||||
private int _health;
|
private int _health;
|
||||||
@@ -36,6 +37,10 @@ public partial class Fighter : Node2D
|
|||||||
_health = 0;
|
_health = 0;
|
||||||
Die();
|
Die();
|
||||||
}
|
}
|
||||||
|
if (_health > maxHealth)
|
||||||
|
{
|
||||||
|
_health = maxHealth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,11 +94,22 @@ public partial class Fighter : Node2D
|
|||||||
ClickedAttack();
|
ClickedAttack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void HealMouseEvent(Node viewport, InputEvent inputEvent, int shapeIdx)
|
||||||
|
{
|
||||||
|
if (inputEvent.IsPressed())
|
||||||
|
ClickedHeal();
|
||||||
|
}
|
||||||
|
|
||||||
private void ClickedAttack()
|
private void ClickedAttack()
|
||||||
{
|
{
|
||||||
fightInstance.SelectAttack(this);
|
fightInstance.SelectAttack(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ClickedHeal()
|
||||||
|
{
|
||||||
|
fightInstance.SelectHeal(this);
|
||||||
|
}
|
||||||
|
|
||||||
private void ClickedTarget()
|
private void ClickedTarget()
|
||||||
{
|
{
|
||||||
fightInstance.SelectTargetAndAttack(this);
|
fightInstance.SelectTargetAndAttack(this);
|
||||||
@@ -148,8 +164,18 @@ public partial class Fighter : Node2D
|
|||||||
{
|
{
|
||||||
return _actions > 0;
|
return _actions > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DecrementActions()
|
public void DecrementActions()
|
||||||
{
|
{
|
||||||
_actions--;
|
_actions--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void HealAnimation()
|
||||||
|
{
|
||||||
|
EmitSignalHealed();
|
||||||
|
var tween = GetTree().CreateTween();
|
||||||
|
tween.TweenProperty(this, "scale", new Vector2(0.6f, 1.4f), 0.15);
|
||||||
|
tween.TweenProperty(this, "scale", new Vector2(1, 1), 0.4)
|
||||||
|
.SetTrans(Tween.TransitionType.Cubic).SetEase(Tween.EaseType.Out);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user