Compare commits

...

7 Commits

5 changed files with 17 additions and 22 deletions
+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"]
@@ -59,7 +59,7 @@ public partial class AllFightersVisual : Node
if (from == FightHappening.FightState.ActionAnim)
{
_fighterVisuals.Values.ForEach(fv => fv.UpdateHealthBar());
_fighterVisuals.Values.ForEach(fv => fv.UpdateVisuals());
}
}
@@ -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);
}
}
}
+7 -12
View File
@@ -7,7 +7,6 @@ using Godot.Collections;
namespace Babushka.scripts.CSharp.Common.Fight;
public partial class FighterVisual : Node2D
{
#region Shortcuts
@@ -28,21 +27,17 @@ public partial class FighterVisual : Node2D
public void Initialize(FightWorld.Fighter fighter)
{
_boundFighter = fighter;
UpdateMirrorState();
UpdateHealthBar();
UpdateVisuals();
}
/// <summary>
/// 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()
public void UpdateVisuals()
{
_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);
}