Compare commits

...

11 Commits

Author SHA1 Message Date
jonathan 3bb4fcd129 Added damage fly number 2025-11-11 15:55:41 +01:00
Jonathan 0507f1ee3d Merge pull request 'Sleeping in bed now loads the new fight world scene' (#27) from feature/integrate_new_fight into develop
Reviewed-on: #27
2025-11-11 14:49:31 +01:00
Jonathan 651ec2cc68 Merge pull request 'Fixed enemy groups show in different spots and even when all enemies are dead' (#28) from bug/enemy_group into develop
Reviewed-on: #28
2025-11-11 14:49:24 +01:00
jonathan 54bfc3c021 🐛 Fixed enemy groups show in different spots and even when all enemies are dead 2025-11-11 14:06:58 +01:00
jonathan 1531ffbf8d Sleeping in bed now loads the new fight world scene 2025-11-11 12:49:38 +01:00
jonathan 74096f2c71 🐛Fixed sprite outline fallback 2025-11-11 12:44:36 +01:00
Jonathan 1c5d776a3a Merge pull request 'Fixed wrong dependency' (#26) from bug/scene_dependency into develop
Reviewed-on: #26
2025-11-11 11:19:54 +01:00
jonathan c814d7606d 🐛Fixed wrong dependency 2025-11-11 11:12:54 +01:00
Jonathan e1a61fb1e2 Merge pull request 'made dead fighters shrink to telegraph to the player that they are dead' (#25) from feature/dead_squash into develop
Reviewed-on: #25
2025-11-11 10:20:44 +01:00
Jonathan a9446ec770 Merge pull request '🐛 Fixed fighters keep fighting at 0 hp' (#24) from bug/enemy_die into develop
Reviewed-on: #24
2025-11-11 10:14:19 +01:00
jonathan 50b2c04cb4 🐛 Fixed fighters keep fighting at 0 hp 2025-11-04 13:55:37 +01:00
17 changed files with 173 additions and 40 deletions
+18
View File
@@ -0,0 +1,18 @@
[gd_scene load_steps=2 format=3 uid="uid://l1hdihubffeg"]
[ext_resource type="Script" uid="uid://b5i41b6502xam" path="res://scripts/CSharp/Common/Fight/FighterDamageIndicatorFlyingNumber.cs" id="1_m0ub6"]
[node name="DamageFlyingNuber" type="Node2D" node_paths=PackedStringArray("_label")]
script = ExtResource("1_m0ub6")
_label = NodePath("Label")
[node name="Label" type="Label" parent="."]
custom_minimum_size = Vector2(200, 100)
offset_left = -100.0
offset_top = -50.0
offset_right = 100.0
offset_bottom = 50.0
theme_override_font_sizes/font_size = 56
text = "888"
horizontal_alignment = 1
vertical_alignment = 1
@@ -9,7 +9,7 @@ region = Rect2(1133.19, 93.65, 460.526, 347.391)
[node name="BlobFighterVisual" instance=ExtResource("1_80xdf")]
[node name="Sprite2D" parent="Visuals" index="0"]
[node name="Sprite2D" parent="SquashParent/Visuals" index="0"]
position = Vector2(23, -96)
scale = Vector2(0.547474, 0.547474)
texture = SubResource("AtlasTexture_ane0o")
@@ -1,10 +1,12 @@
[gd_scene load_steps=9 format=3 uid="uid://7jsxokx67gpq"]
[gd_scene load_steps=11 format=3 uid="uid://7jsxokx67gpq"]
[ext_resource type="Script" uid="uid://by88f32fou7lh" path="res://scripts/CSharp/Common/Fight/FighterVisual.cs" id="1_hai27"]
[ext_resource type="Texture2D" uid="uid://f7htcxiwvuup" path="res://art/animation/vesna/Side/S01-Idle/0001.png" id="2_6l7g5"]
[ext_resource type="Script" uid="uid://boprnfciqgixf" path="res://scripts/CSharp/Common/Fight/UI/TargetSelectionClick.cs" id="3_wil2y"]
[ext_resource type="Texture2D" uid="uid://qlfwuakhe57t" path="res://art/ui/UI/attack_select_wheel.png" id="4_8ldlc"]
[ext_resource type="Script" uid="uid://b2dx06p6i7pu0" path="res://scripts/CSharp/Common/Fight/UI/FighterHealthBarVisual.cs" id="5_xv37w"]
[ext_resource type="Script" uid="uid://c250yp2mdq83e" path="res://scripts/CSharp/Common/Fight/FighterDamageIndicatorVisual.cs" id="6_0qs42"]
[ext_resource type="PackedScene" uid="uid://l1hdihubffeg" path="res://prefabs/fight/damage_flying_nuber.tscn" id="7_y6dyb"]
[sub_resource type="AtlasTexture" id="AtlasTexture_wil2y"]
atlas = ExtResource("2_6l7g5")
@@ -17,25 +19,41 @@ size = Vector2(250, 401)
radius = 173.0
height = 588.0
[node name="VesnaFighterVisual" type="Node2D" node_paths=PackedStringArray("_visualParent", "_targetSelectionParent", "healthBarVisual")]
[node name="VesnaFighterVisual" type="Node2D" node_paths=PackedStringArray("_visualParent", "_targetSelectionParent", "_squashParent", "healthBarVisual", "_fighterDamageIndicatorVisual")]
script = ExtResource("1_hai27")
_visualParent = NodePath("Visuals")
_visualParent = NodePath("SquashParent/Visuals")
_targetSelectionParent = NodePath("TargetSelection")
healthBarVisual = NodePath("HealthBar")
_squashParent = NodePath("SquashParent")
healthBarVisual = NodePath("SquashParent/HealthBar")
_fighterDamageIndicatorVisual = NodePath("DamageIndicator")
[node name="Visuals" type="Node2D" parent="."]
[node name="SquashParent" type="Node2D" parent="."]
[node name="Sprite2D" type="Sprite2D" parent="Visuals"]
[node name="Visuals" type="Node2D" parent="SquashParent"]
[node name="Sprite2D" type="Sprite2D" parent="SquashParent/Visuals"]
position = Vector2(-31, -199)
scale = Vector2(0.451719, 0.451719)
texture = SubResource("AtlasTexture_wil2y")
[node name="ChacacterSizeIndicator" type="CollisionShape2D" parent="Visuals"]
[node name="ChacacterSizeIndicator" type="CollisionShape2D" parent="SquashParent/Visuals"]
editor_description = "This is a reference to the space, a normal sized humanoid character should occupy"
visible = false
position = Vector2(0, -200.5)
shape = SubResource("RectangleShape2D_6l7g5")
[node name="HealthBar" type="Node2D" parent="SquashParent" node_paths=PackedStringArray("_tmpHealthLabel")]
script = ExtResource("5_xv37w")
_tmpHealthLabel = NodePath("tmpLabel")
[node name="tmpLabel" type="Label" parent="SquashParent/HealthBar"]
offset_left = -110.0
offset_top = -528.0
offset_right = 111.0
offset_bottom = -431.0
theme_override_font_sizes/font_size = 71
text = "xx / xx"
[node name="TargetSelection" type="Node2D" parent="."]
process_mode = 4
visible = false
@@ -55,17 +73,10 @@ position = Vector2(-3, -227)
scale = Vector2(1.65625, 1.65625)
texture = ExtResource("4_8ldlc")
[node name="HealthBar" type="Node2D" parent="." node_paths=PackedStringArray("_tmpHealthLabel")]
script = ExtResource("5_xv37w")
_tmpHealthLabel = NodePath("tmpLabel")
[node name="tmpLabel" type="Label" parent="HealthBar"]
offset_left = -110.0
offset_top = -528.0
offset_right = 111.0
offset_bottom = -431.0
theme_override_font_sizes/font_size = 71
text = "xx / xx"
[node name="DamageIndicator" type="Node2D" parent="."]
position = Vector2(3, -190)
script = ExtResource("6_0qs42")
_flyingNumberPrefab = ExtResource("7_y6dyb")
[connection signal="TargetSelected" from="TargetSelection/Click" to="." method="ClickedTarget"]
[connection signal="mouse_entered" from="TargetSelection/Click" to="TargetSelection/HoverIndicator" method="show"]
+1 -1
View File
@@ -5,6 +5,6 @@
[node name="BabushkaSceneBootstrap" type="Node2D"]
[node name="BabushkaSceneStartMenu" parent="." instance=ExtResource("1_15ton")]
_sceneNamesToLoad = PackedStringArray("res://scenes/Babushka_scene_fight_world_room.tscn")
_sceneNamesToLoad = PackedStringArray("res://scenes/Babushka_scene_farm_outside_2d.tscn")
[node name="SceneParent" type="Node" parent="."]
+1 -1
View File
@@ -39,7 +39,7 @@
[ext_resource type="Resource" uid="uid://d1uuxp1lp4aro" path="res://resources/items/tomato_seed.tres" id="35_64mdn"]
[ext_resource type="Texture2D" uid="uid://65e44yde224q" path="res://art/farm/Babushka_house_01.png" id="36_e5b7x"]
[ext_resource type="Resource" uid="uid://duq7tshxv6uhp" path="res://resources/items/beet_seed.tres" id="36_fv1t2"]
[ext_resource type="Texture2D" uid="uid://b4krfobwq3r3h" path="res://art/test_tomatos.png" id="36_l7ekk"]
[ext_resource type="Texture2D" uid="uid://cyyxqmphcrjj" path="res://art/farm/farming/farmobjekte/tomaten/tomaten_template.png" id="36_l7ekk"]
[ext_resource type="AudioStream" uid="uid://cfqg50am0swb7" path="res://audio/Music/Farming_90BPM_69Bars_Loop.wav" id="37_8ey8m"]
[ext_resource type="AudioStream" uid="uid://dku1rq5cocisg" path="res://audio/Music/Farming_90BPM_69Bars.wav" id="37_di1ed"]
[ext_resource type="Shader" uid="uid://braevmqauoek7" path="res://shader/swaying_plant.gdshader" id="37_taxvr"]
+12 -5
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=13 format=3 uid="uid://ceaa2qj2bmw43"]
[gd_scene load_steps=14 format=3 uid="uid://ceaa2qj2bmw43"]
[ext_resource type="Script" uid="uid://cssdu8viimwm6" path="res://scripts/CSharp/Common/SceneTransition.cs" id="1_c6eln"]
[ext_resource type="Texture2D" uid="uid://cugtxcfuds31r" path="res://art/indoor/Babushka_bg_01.png" id="2_j25a2"]
@@ -17,6 +17,10 @@ size = Vector2(3836, 1086)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_2spkc"]
size = Vector2(238.25, 189.75)
[sub_resource type="CircleShape2D" id="CircleShape2D_phqdf"]
resource_local_to_scene = true
radius = 381.93
[sub_resource type="CircleShape2D" id="CircleShape2D_2spkc"]
resource_local_to_scene = true
radius = 509.071
@@ -24,7 +28,7 @@ radius = 509.071
[node name="VesnasRoom" type="Node2D"]
y_sort_enabled = true
script = ExtResource("1_c6eln")
_sceneNamesToLoad = PackedStringArray("res://scenes/Babushka_scene_indoor_common_room.tscn", "res://scenes/Babushka_scene_forest_fight_1_2d.tscn")
_sceneNamesToLoad = PackedStringArray("res://scenes/Babushka_scene_indoor_common_room.tscn", "res://scenes/Babushka_scene_fight_world_room.tscn")
[node name="Colliders" type="Node2D" parent="."]
position = Vector2(1297, 5292)
@@ -97,10 +101,13 @@ _followNode = NodePath("../Vesna/CharacterBody2D")
[node name="CanvasLayer" parent="." instance=ExtResource("24_xwo8y")]
[node name="BedInteraction" parent="." instance=ExtResource("8_phqdf")]
position = Vector2(-1429, 487)
_useSprite = false
position = Vector2(-1415, 489)
_id = 1
[node name="CollisionShape3D" parent="BedInteraction/Area2D" index="0"]
position = Vector2(-382, 9)
shape = SubResource("CircleShape2D_phqdf")
[node name="QuestCompleter" type="Node" parent="BedInteraction"]
script = ExtResource("8_j25a2")
questResource = ExtResource("9_heyef")
@@ -108,7 +115,6 @@ toStatus = 2
[node name="DoorInteraction" parent="." instance=ExtResource("8_phqdf")]
position = Vector2(777, 201)
_useSprite = false
_id = 0
[node name="CollisionShape3D" parent="DoorInteraction/Area2D" index="0"]
@@ -119,4 +125,5 @@ shape = SubResource("CircleShape2D_2spkc")
[connection signal="Interacted" from="DoorInteraction" to="." method="LoadScene"]
[editable path="Vesna"]
[editable path="BedInteraction"]
[editable path="DoorInteraction"]
@@ -13,7 +13,7 @@ public partial class InteractionArea2D : Node2D
[Export] private bool _useOutline = true;
[Export] private ShaderMaterial _outlineMaterial;
[Export] private CanvasItem? _spriteToOutline; // keep to not break old usages. TODO: remove later
[Export] private CanvasItem[] _spritesToOutline;
[Export] private CanvasItem[] _spritesToOutline = [];
[Export] private bool _showLabel = true;
[Export] private int _id = -1; // TODO: remove
@@ -60,6 +60,12 @@ public class AllyAttackAction : FighterAction
await currentFighterVisual.AnimatePosToTarget(targetFighterVisual);
_ = targetFighterVisual.AnimateHit();
foreach (var hit in minigameDetail.damageHits!)
{
targetFighterVisual.SpawnDamageIndicatorNumber(hit);
}
await currentFighterVisual.AnimatePosToBase();
}
}
@@ -6,6 +6,9 @@ namespace Babushka.scripts.CSharp.Common.Fight.Actions;
public class BlobAttackAction : FighterAction
{
// settings
private const int Damage = 3;
public override Variant<float, Func<bool>> GetAnimationEnd()
{
return 1;
@@ -18,7 +21,7 @@ public class BlobAttackAction : FighterAction
public override void ExecuteAction()
{
FightWorld.Instance.allyFighters.vesnaFighter.AddHealth(-3);
FightWorld.Instance.allyFighters.vesnaFighter.AddHealth(-Damage);
}
public override async Task AnimateAction(AllFightersVisual allFightersVisual)
@@ -31,6 +34,7 @@ public class BlobAttackAction : FighterAction
await currentFighterVisual.AnimatePosToTarget(targetFighterVisual);
_ = targetFighterVisual.AnimateHit();
targetFighterVisual.SpawnDamageIndicatorNumber(Damage);
await currentFighterVisual.AnimatePosToBase();
}
}
@@ -192,6 +192,8 @@ public partial class FightHappening : Node
HappeningData.actionStaging = null;
HappeningData.fightersEnterStaging = null;
RemoveDeadFighters();
if (!FightWorld.Instance.allyFighters.IsAlive())
{
ChangeState(FightState.EnemyWin);
@@ -345,6 +347,17 @@ public partial class FightHappening : Node
vesnaFighter.health = vesnaFighter.maxHealth;
GD.Print("Vesna has been revived. This is for the current prototype only");
}
private void RemoveDeadFighters()
{
foreach (var f in HappeningData.fighterTurn)
{
if (f.IsDead())
{
HappeningData.fighterTurn.Remove(f);
}
}
}
#endregion // Game Logic
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using Babushka.scripts.CSharp.Common.Util;
using Godot;
@@ -15,15 +16,14 @@ public partial class FightRoomSceneSetup : Node
{
var room = FightWorld.Instance.currentRoom!;
var i = 0;
foreach (var availableParent in _enemyGroupSpawns.Shuffle())
foreach (var (parent, group) in _enemyGroupSpawns.Zip(room.enemyGroups))
{
var enemyGroup = room.enemyGroups[i];
if (group.AreAllDead())
continue;
var roamingEnemyGroup = _roamingEnemyGroupPrefab.Instantiate<RoamingEnemyGroup>();
roamingEnemyGroup.Initialize(enemyGroup, _fightSceneSwitcher);
availableParent.AddChild(roamingEnemyGroup);
if (i >= room.enemyGroups.Count - 1) break;
i++;
roamingEnemyGroup.Initialize(group, _fightSceneSwitcher);
parent.AddChild(roamingEnemyGroup);
}
}
}
@@ -0,0 +1,22 @@
using System;
using Godot;
namespace Babushka.scripts.CSharp.Common.Fight;
public partial class FighterDamageIndicatorFlyingNumber : Node2D
{
[Export] private Label _label;
public void Initialize(int number)
{
_label.Text = number.ToString();
var tween = CreateTween();
var xMovement = GD.RandRange(-150, 150);
var yMovement = GD.RandRange(-400, -250);
tween.Parallel().TweenProperty(this, "position:x", xMovement, .6);
tween.Parallel().TweenProperty(this, "position:y", yMovement, .6)
.SetEase(Tween.EaseType.Out).SetTrans(Tween.TransitionType.Quad);
tween.Chain().TweenCallback(Callable.From(QueueFree));
}
}
@@ -0,0 +1 @@
uid://b5i41b6502xam
@@ -0,0 +1,16 @@
using Godot;
namespace Babushka.scripts.CSharp.Common.Fight;
public partial class FighterDamageIndicatorVisual : Node2D
{
[Export] private PackedScene _flyingNumberPrefab;
public void SpawnFlyingNumber(int number)
{
var flyingNumberInstance = _flyingNumberPrefab.Instantiate<FighterDamageIndicatorFlyingNumber>();
AddChild(flyingNumberInstance);
flyingNumberInstance.Initialize(number);
}
}
@@ -0,0 +1 @@
uid://c250yp2mdq83e
+29 -3
View File
@@ -1,9 +1,12 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
namespace Babushka.scripts.CSharp.Common.Fight;
public class FighterTurn
public class FighterTurn : IEnumerable<FightWorld.Fighter>
{
private class Node
{
@@ -13,7 +16,8 @@ public class FighterTurn
private Node? _currentNode;
public FightWorld.Fighter Current => _currentNode?.fighter ?? throw new InvalidOperationException("No current fighter");
public FightWorld.Fighter Current =>
_currentNode?.fighter ?? throw new InvalidOperationException("No current fighter");
public void Next()
{
@@ -84,7 +88,7 @@ public class FighterTurn
{
// if removing current, keep current
// it will be implicitly deleted by loss of reference on the next Next() call
node.next = node.next.next;
return true;
}
@@ -94,4 +98,26 @@ public class FighterTurn
return false;
}
public IEnumerator<FightWorld.Fighter> GetEnumerator()
{
if (_currentNode == null) return Enumerable.Empty<FightWorld.Fighter>().GetEnumerator();
var list = new List<FightWorld.Fighter>();
var n = _currentNode;
while (true)
{
list.Add(n.fighter);
if (n.next == _currentNode)
break;
n = n.next;
}
return list.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
+10 -2
View File
@@ -19,7 +19,11 @@ public partial class FighterVisual : Node2D
[ExportCategory("References")]
[Export] private Node2D _visualParent = null!;
[Export] private Node2D _targetSelectionParent = null!;
[Export] private Node2D _squashParent = null!;
[Export] public FighterHealthBarVisual healthBarVisual = null!;
[Export] private FighterDamageIndicatorVisual _fighterDamageIndicatorVisual;
private FightWorld.Fighter _boundFighter;
@@ -75,8 +79,8 @@ public partial class FighterVisual : Node2D
public async Task AnimateHit()
{
var tween = GetTree().CreateTween();
tween.TweenProperty(this, "scale", new Vector2(1.4f, 0.6f), 0.15);
tween.TweenProperty(this, "scale", new Vector2(1, 1), 0.4)
tween.TweenProperty(_squashParent, "scale", new Vector2(1.4f, 0.6f), 0.15);
tween.TweenProperty(_squashParent, "scale", new Vector2(1, 1), 0.4)
.SetTrans(Tween.TransitionType.Cubic).SetEase(Tween.EaseType.Out);
await ToSignal(tween, "finished");
}
@@ -90,4 +94,8 @@ public partial class FighterVisual : Node2D
// tween.TweenProperty(this, "scale", new Vector2(1, 1), 0.4)
// .SetTrans(Tween.TransitionType.Cubic).SetEase(Tween.EaseType.Out);
//}
public void SpawnDamageIndicatorNumber(int number)
{
_fighterDamageIndicatorVisual.SpawnFlyingNumber(number);
}
}