Merge branch 'develop' into feature/farming_bugfixes_and_magic_word

# Conflicts:
#	scenes/Babushka_scene_farm_outside_2d.tscn
#	scenes/Babushka_scene_indoor_vesnas_room.tscn
#	scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs
feature/farming_bugfixes_and_magic_word
kziolkowski 2 months ago
commit 093546f3e4

@ -5,6 +5,6 @@
[node name="BabushkaSceneBootstrap" type="Node2D"] [node name="BabushkaSceneBootstrap" type="Node2D"]
[node name="BabushkaSceneStartMenu" parent="." instance=ExtResource("1_15ton")] [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="."] [node name="SceneParent" type="Node" parent="."]

@ -38,6 +38,7 @@
[ext_resource type="Resource" uid="uid://d1uuxp1lp4aro" path="res://resources/items/tomato_seed.tres" id="35_64mdn"] [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="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="Resource" uid="uid://duq7tshxv6uhp" path="res://resources/items/beet_seed.tres" id="36_fv1t2"]
[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://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="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"] [ext_resource type="Shader" uid="uid://braevmqauoek7" path="res://shader/swaying_plant.gdshader" id="37_taxvr"]
@ -598,7 +599,7 @@ texture = ExtResource("13_0qu0h")
[node name="JelenaMockupBg03" type="Sprite2D" parent="ParallaxBackground/background layer 4"] [node name="JelenaMockupBg03" type="Sprite2D" parent="ParallaxBackground/background layer 4"]
z_index = -200 z_index = -200
material = SubResource("ShaderMaterial_wtdui") material = SubResource("ShaderMaterial_wtdui")
position = Vector2(7893.0005, 727) position = Vector2(7923, 727)
scale = Vector2(2.75, 2.75) scale = Vector2(2.75, 2.75)
texture = ExtResource("13_0qu0h") texture = ExtResource("13_0qu0h")

@ -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="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"] [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"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_2spkc"]
size = Vector2(238.25, 189.75) 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"] [sub_resource type="CircleShape2D" id="CircleShape2D_2spkc"]
resource_local_to_scene = true resource_local_to_scene = true
radius = 509.071 radius = 509.071
@ -24,7 +28,7 @@ radius = 509.071
[node name="VesnasRoom" type="Node2D"] [node name="VesnasRoom" type="Node2D"]
y_sort_enabled = true y_sort_enabled = true
script = ExtResource("1_c6eln") 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="."] [node name="Colliders" type="Node2D" parent="."]
position = Vector2(1297, 5292) position = Vector2(1297, 5292)
@ -97,10 +101,13 @@ _followNode = NodePath("../Vesna/CharacterBody2D")
[node name="CanvasLayer" parent="." instance=ExtResource("24_xwo8y")] [node name="CanvasLayer" parent="." instance=ExtResource("24_xwo8y")]
[node name="BedInteraction" parent="." instance=ExtResource("8_phqdf")] [node name="BedInteraction" parent="." instance=ExtResource("8_phqdf")]
position = Vector2(-1429, 487) position = Vector2(-1415, 489)
_useOutline = false
_id = 1 _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"] [node name="QuestCompleter" type="Node" parent="BedInteraction"]
script = ExtResource("8_j25a2") script = ExtResource("8_j25a2")
questResource = ExtResource("9_heyef") questResource = ExtResource("9_heyef")
@ -108,7 +115,6 @@ toStatus = 2
[node name="DoorInteraction" parent="." instance=ExtResource("8_phqdf")] [node name="DoorInteraction" parent="." instance=ExtResource("8_phqdf")]
position = Vector2(777, 201) position = Vector2(777, 201)
_useOutline = false
_id = 0 _id = 0
[node name="CollisionShape3D" parent="DoorInteraction/Area2D" index="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"] [connection signal="Interacted" from="DoorInteraction" to="." method="LoadScene"]
[editable path="Vesna"] [editable path="Vesna"]
[editable path="BedInteraction"]
[editable path="DoorInteraction"] [editable path="DoorInteraction"]

@ -59,7 +59,7 @@ public partial class AllFightersVisual : Node
if (from == FightHappening.FightState.ActionAnim) if (from == FightHappening.FightState.ActionAnim)
{ {
_fighterVisuals.Values.ForEach(fv => fv.UpdateHealthBar()); _fighterVisuals.Values.ForEach(fv => fv.UpdateVisuals());
} }
} }

@ -192,6 +192,8 @@ public partial class FightHappening : Node
HappeningData.actionStaging = null; HappeningData.actionStaging = null;
HappeningData.fightersEnterStaging = null; HappeningData.fightersEnterStaging = null;
RemoveDeadFighters();
if (!FightWorld.Instance.allyFighters.IsAlive()) if (!FightWorld.Instance.allyFighters.IsAlive())
{ {
ChangeState(FightState.EnemyWin); ChangeState(FightState.EnemyWin);
@ -346,6 +348,17 @@ public partial class FightHappening : Node
GD.Print("Vesna has been revived. This is for the current prototype only"); 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 #endregion // Game Logic
#region Utility #region Utility

@ -1,4 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using Babushka.scripts.CSharp.Common.Util; using Babushka.scripts.CSharp.Common.Util;
using Godot; using Godot;
@ -15,15 +16,14 @@ public partial class FightRoomSceneSetup : Node
{ {
var room = FightWorld.Instance.currentRoom!; var room = FightWorld.Instance.currentRoom!;
var i = 0; foreach (var (parent, group) in _enemyGroupSpawns.Zip(room.enemyGroups))
foreach (var availableParent in _enemyGroupSpawns.Shuffle())
{ {
var enemyGroup = room.enemyGroups[i]; if (group.AreAllDead())
continue;
var roamingEnemyGroup = _roamingEnemyGroupPrefab.Instantiate<RoamingEnemyGroup>(); var roamingEnemyGroup = _roamingEnemyGroupPrefab.Instantiate<RoamingEnemyGroup>();
roamingEnemyGroup.Initialize(enemyGroup, _fightSceneSwitcher); roamingEnemyGroup.Initialize(group, _fightSceneSwitcher);
availableParent.AddChild(roamingEnemyGroup); parent.AddChild(roamingEnemyGroup);
if (i >= room.enemyGroups.Count - 1) break;
i++;
} }
} }
} }

@ -1,9 +1,12 @@
using System; using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq;
namespace Babushka.scripts.CSharp.Common.Fight; namespace Babushka.scripts.CSharp.Common.Fight;
public class FighterTurn public class FighterTurn : IEnumerable<FightWorld.Fighter>
{ {
private class Node private class Node
{ {
@ -13,7 +16,8 @@ public class FighterTurn
private Node? _currentNode; 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() public void Next()
{ {
@ -94,4 +98,26 @@ public class FighterTurn
return false; 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();
}
} }

@ -7,7 +7,6 @@ using Godot.Collections;
namespace Babushka.scripts.CSharp.Common.Fight; namespace Babushka.scripts.CSharp.Common.Fight;
public partial class FighterVisual : Node2D public partial class FighterVisual : Node2D
{ {
#region Shortcuts #region Shortcuts
@ -28,21 +27,17 @@ public partial class FighterVisual : Node2D
public void Initialize(FightWorld.Fighter fighter) public void Initialize(FightWorld.Fighter fighter)
{ {
_boundFighter = fighter; _boundFighter = fighter;
UpdateMirrorState(); UpdateVisuals();
UpdateHealthBar();
} }
/// <summary> public void UpdateVisuals()
/// fighter visuals should always look to the right in the scene.
/// This function flips the sprites horizontally, when the fighter is an enemy.
/// </summary>
private void UpdateMirrorState()
{ {
_visualParent.Scale = new Vector2(_boundFighter.IsInFormation(HappeningData.enemyFighterFormation) ? -1 : 1, 1); // fighter visuals should always look to the right in the scene.
} // This function flips the sprites horizontally, when the fighter is an enemy.
_visualParent.Scale = new Vector2(
_boundFighter.IsInFormation(HappeningData.enemyFighterFormation) ? -1 : 1,
_boundFighter.IsDead() ? .3f : 1);
public void UpdateHealthBar()
{
healthBarVisual.UpdateHealth(_boundFighter.GetHealth(), _boundFighter.maxHealth); healthBarVisual.UpdateHealth(_boundFighter.GetHealth(), _boundFighter.maxHealth);
} }

Loading…
Cancel
Save