✨ Defeated enemygroups now drop a beet_seed
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
[gd_scene load_steps=2 format=3 uid="uid://n5cj71bxxjkk"]
|
[gd_scene load_steps=3 format=3 uid="uid://n5cj71bxxjkk"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://dqe1i2qmpttwf" path="res://scripts/CSharp/Common/Fight/FightWorld.cs" id="1_tnyce"]
|
[ext_resource type="Script" uid="uid://dqe1i2qmpttwf" path="res://scripts/CSharp/Common/Fight/FightWorld.cs" id="1_tnyce"]
|
||||||
|
[ext_resource type="Resource" uid="uid://duq7tshxv6uhp" path="res://resources/items/beet_seed.tres" id="2_lxs0o"]
|
||||||
|
|
||||||
[node name="FightWorldAutoload" type="Node2D"]
|
[node name="FightWorldAutoload" type="Node2D"]
|
||||||
script = ExtResource("1_tnyce")
|
script = ExtResource("1_tnyce")
|
||||||
|
_itemToDropByEnemyGroup = ExtResource("2_lxs0o")
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
[ext_resource type="Shader" uid="uid://xnky830dtfsn" path="res://shader/repeat_texture.gdshader" id="23_2ouqg"]
|
[ext_resource type="Shader" uid="uid://xnky830dtfsn" path="res://shader/repeat_texture.gdshader" id="23_2ouqg"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c25udixd5m6l0" path="res://prefabs/characters/Vesna.tscn" id="24_ffcio"]
|
[ext_resource type="PackedScene" uid="uid://c25udixd5m6l0" path="res://prefabs/characters/Vesna.tscn" id="24_ffcio"]
|
||||||
[ext_resource type="Resource" uid="uid://dlcmqfjvgphqu" path="res://resources/items/rake.tres" id="25_3h260"]
|
[ext_resource type="Resource" uid="uid://dlcmqfjvgphqu" path="res://resources/items/rake.tres" id="25_3h260"]
|
||||||
[ext_resource type="Resource" uid="uid://cndd64batns31" path="res://resources/items/wateringcan.tres" id="26_1bhpp"]
|
|
||||||
[ext_resource type="Shader" uid="uid://braevmqauoek7" path="res://shader/swaying_plant.gdshader" id="27_txtka"]
|
[ext_resource type="Shader" uid="uid://braevmqauoek7" path="res://shader/swaying_plant.gdshader" id="27_txtka"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dgavbfci8x178" path="res://art/nature/grass/grass-1.png" id="28_ejigw"]
|
[ext_resource type="Texture2D" uid="uid://dgavbfci8x178" path="res://art/nature/grass/grass-1.png" id="28_ejigw"]
|
||||||
[ext_resource type="Texture2D" uid="uid://h2b5aufaaw7w" path="res://art/nature/grass/grass-2.png" id="29_pjemw"]
|
[ext_resource type="Texture2D" uid="uid://h2b5aufaaw7w" path="res://art/nature/grass/grass-2.png" id="29_pjemw"]
|
||||||
@@ -41,6 +40,7 @@
|
|||||||
[ext_resource type="Script" uid="uid://dbu8afaiohpdh" path="res://scripts/CSharp/Common/Fight/FightRoomSceneSetup.cs" id="40_cvg1r"]
|
[ext_resource type="Script" uid="uid://dbu8afaiohpdh" path="res://scripts/CSharp/Common/Fight/FightRoomSceneSetup.cs" id="40_cvg1r"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bcld43daavmrn" path="res://prefabs/fight/fight_scene_switcher.tscn" id="40_elhbh"]
|
[ext_resource type="PackedScene" uid="uid://bcld43daavmrn" path="res://prefabs/fight/fight_scene_switcher.tscn" id="40_elhbh"]
|
||||||
[ext_resource type="PackedScene" uid="uid://qfdiudt3vpai" path="res://prefabs/fight/roaming_enemy_group.tscn" id="41_cvg1r"]
|
[ext_resource type="PackedScene" uid="uid://qfdiudt3vpai" path="res://prefabs/fight/roaming_enemy_group.tscn" id="41_cvg1r"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dpbbroif2tnil" path="res://prefabs/interactions/generic_item_on_ground_2d.tscn" id="41_x3yi1"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ruj2u"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ruj2u"]
|
||||||
shader = ExtResource("16_0fard")
|
shader = ExtResource("16_0fard")
|
||||||
@@ -64,9 +64,9 @@ colors = PackedColorArray(0.348791, 0.400092, 0.435264, 1, 0.219333, 0.251087, 0
|
|||||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_d5x6a"]
|
[sub_resource type="FastNoiseLite" id="FastNoiseLite_d5x6a"]
|
||||||
|
|
||||||
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_d53cn"]
|
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_d53cn"]
|
||||||
seamless = true
|
|
||||||
color_ramp = SubResource("Gradient_663j1")
|
|
||||||
noise = SubResource("FastNoiseLite_d5x6a")
|
noise = SubResource("FastNoiseLite_d5x6a")
|
||||||
|
color_ramp = SubResource("Gradient_663j1")
|
||||||
|
seamless = true
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_k0jkw"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_k0jkw"]
|
||||||
shader = ExtResource("23_2ouqg")
|
shader = ExtResource("23_2ouqg")
|
||||||
@@ -84,9 +84,9 @@ fractal_gain = 0.795
|
|||||||
domain_warp_enabled = true
|
domain_warp_enabled = true
|
||||||
|
|
||||||
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_pjpt5"]
|
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_pjpt5"]
|
||||||
seamless = true
|
|
||||||
color_ramp = SubResource("Gradient_eryax")
|
|
||||||
noise = SubResource("FastNoiseLite_wgikv")
|
noise = SubResource("FastNoiseLite_wgikv")
|
||||||
|
color_ramp = SubResource("Gradient_eryax")
|
||||||
|
seamless = true
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_yvxfs"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_yvxfs"]
|
||||||
shader = ExtResource("27_txtka")
|
shader = ExtResource("27_txtka")
|
||||||
@@ -765,7 +765,6 @@ y_sort_enabled = true
|
|||||||
[node name="Vesna" parent="YSorted" instance=ExtResource("24_ffcio")]
|
[node name="Vesna" parent="YSorted" instance=ExtResource("24_ffcio")]
|
||||||
position = Vector2(8202, 1950)
|
position = Vector2(8202, 1950)
|
||||||
_hoe = ExtResource("25_3h260")
|
_hoe = ExtResource("25_3h260")
|
||||||
_wateringCan = ExtResource("26_1bhpp")
|
|
||||||
|
|
||||||
[node name="CharacterBody2D" parent="YSorted/Vesna" index="0"]
|
[node name="CharacterBody2D" parent="YSorted/Vesna" index="0"]
|
||||||
y_sort_enabled = true
|
y_sort_enabled = true
|
||||||
@@ -776,11 +775,9 @@ y_sort_enabled = true
|
|||||||
[node name="Animated Sprites" parent="YSorted/Vesna/CharacterBody2D/visuals" index="0"]
|
[node name="Animated Sprites" parent="YSorted/Vesna/CharacterBody2D/visuals" index="0"]
|
||||||
y_sort_enabled = true
|
y_sort_enabled = true
|
||||||
animation = &"diagonal item"
|
animation = &"diagonal item"
|
||||||
|
frame = 0
|
||||||
frame_progress = 0.0
|
frame_progress = 0.0
|
||||||
|
|
||||||
[node name="WateringCanUI" parent="YSorted/Vesna/CharacterBody2D" index="2" node_paths=PackedStringArray("_stages")]
|
|
||||||
_stages = [null, null, null, null, null, null]
|
|
||||||
|
|
||||||
[node name="ForestVisuals" type="Node2D" parent="YSorted"]
|
[node name="ForestVisuals" type="Node2D" parent="YSorted"]
|
||||||
y_sort_enabled = true
|
y_sort_enabled = true
|
||||||
position = Vector2(-60, -250)
|
position = Vector2(-60, -250)
|
||||||
@@ -864,10 +861,10 @@ region_rect = Rect2(1699, 76, 280, 230)
|
|||||||
[node name="bush4" type="Sprite2D" parent="YSorted/ForestVisuals/Static/greenery/left side"]
|
[node name="bush4" type="Sprite2D" parent="YSorted/ForestVisuals/Static/greenery/left side"]
|
||||||
modulate = Color(0.8428, 0.8771, 0.98, 1)
|
modulate = Color(0.8428, 0.8771, 0.98, 1)
|
||||||
material = SubResource("ShaderMaterial_yvxfs")
|
material = SubResource("ShaderMaterial_yvxfs")
|
||||||
position = Vector2(16878, 2099)
|
position = Vector2(16884, 1943)
|
||||||
scale = Vector2(2, 2)
|
scale = Vector2(2, 2)
|
||||||
texture = ExtResource("19_edja8")
|
texture = ExtResource("19_edja8")
|
||||||
offset = Vector2(0, -172)
|
offset = Vector2(-3, -94)
|
||||||
region_enabled = true
|
region_enabled = true
|
||||||
region_rect = Rect2(0, 604, 248, 228)
|
region_rect = Rect2(0, 604, 248, 228)
|
||||||
|
|
||||||
@@ -1232,10 +1229,10 @@ region_rect = Rect2(130, 0, 201, 278)
|
|||||||
modulate = Color(0.8428, 0.8771, 0.98, 1)
|
modulate = Color(0.8428, 0.8771, 0.98, 1)
|
||||||
y_sort_enabled = true
|
y_sort_enabled = true
|
||||||
material = SubResource("ShaderMaterial_yvxfs")
|
material = SubResource("ShaderMaterial_yvxfs")
|
||||||
position = Vector2(3348, 2074)
|
position = Vector2(3346.379, 1926.0276)
|
||||||
scale = Vector2(-2.40318, 3.59175)
|
scale = Vector2(-2.40318, 3.59175)
|
||||||
texture = ExtResource("19_edja8")
|
texture = ExtResource("19_edja8")
|
||||||
offset = Vector2(0, -172)
|
offset = Vector2(-0.67456055, -130.80212)
|
||||||
region_enabled = true
|
region_enabled = true
|
||||||
region_rect = Rect2(130, 0, 201, 278)
|
region_rect = Rect2(130, 0, 201, 278)
|
||||||
|
|
||||||
@@ -2156,6 +2153,7 @@ _sceneRoot = NodePath("..")
|
|||||||
script = ExtResource("40_cvg1r")
|
script = ExtResource("40_cvg1r")
|
||||||
_enemyGroupSpawns = [NodePath("../YSorted/EnemyGroupSpawns/Spawn1"), NodePath("../YSorted/EnemyGroupSpawns/Spawn2"), NodePath("../YSorted/EnemyGroupSpawns/Spawn3"), NodePath("../YSorted/EnemyGroupSpawns/Spawn4")]
|
_enemyGroupSpawns = [NodePath("../YSorted/EnemyGroupSpawns/Spawn1"), NodePath("../YSorted/EnemyGroupSpawns/Spawn2"), NodePath("../YSorted/EnemyGroupSpawns/Spawn3"), NodePath("../YSorted/EnemyGroupSpawns/Spawn4")]
|
||||||
_roamingEnemyGroupPrefab = ExtResource("41_cvg1r")
|
_roamingEnemyGroupPrefab = ExtResource("41_cvg1r")
|
||||||
|
_itemOnGroundPrefab = ExtResource("41_x3yi1")
|
||||||
_fightSceneSwitcher = NodePath("../FightSceneSwitcher")
|
_fightSceneSwitcher = NodePath("../FightSceneSwitcher")
|
||||||
|
|
||||||
[editable path="YSorted/Vesna"]
|
[editable path="YSorted/Vesna"]
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Babushka.scripts.CSharp.Common.Util;
|
using Babushka.scripts.CSharp.Common.Inventory;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
namespace Babushka.scripts.CSharp.Common.Fight;
|
namespace Babushka.scripts.CSharp.Common.Fight;
|
||||||
|
|
||||||
public partial class FightRoomSceneSetup : Node
|
public partial class FightRoomSceneSetup : Node
|
||||||
{
|
{
|
||||||
[Export(PropertyHint.ArrayType)] private Node2D[] _enemyGroupSpawns;
|
[Export(PropertyHint.ArrayType)] private Node2D[] _enemyGroupSpawns = null!;
|
||||||
[Export] private PackedScene _roamingEnemyGroupPrefab;
|
[Export] private PackedScene _roamingEnemyGroupPrefab = null!;
|
||||||
[Export] private FightSceneSwitcher _fightSceneSwitcher;
|
[Export] private PackedScene _itemOnGroundPrefab = null!;
|
||||||
|
[Export] private FightSceneSwitcher _fightSceneSwitcher = null!;
|
||||||
|
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
@@ -19,11 +20,30 @@ public partial class FightRoomSceneSetup : Node
|
|||||||
foreach (var (parent, group) in _enemyGroupSpawns.Zip(room.enemyGroups))
|
foreach (var (parent, group) in _enemyGroupSpawns.Zip(room.enemyGroups))
|
||||||
{
|
{
|
||||||
if (group.AreAllDead())
|
if (group.AreAllDead())
|
||||||
continue;
|
{
|
||||||
|
SpawnLoot(group, parent);
|
||||||
var roamingEnemyGroup = _roamingEnemyGroupPrefab.Instantiate<RoamingEnemyGroup>();
|
}
|
||||||
roamingEnemyGroup.Initialize(group, _fightSceneSwitcher);
|
else
|
||||||
parent.AddChild(roamingEnemyGroup);
|
{
|
||||||
|
SpawnEnemies(group, parent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SpawnEnemies(FightWorld.FighterGroup group, Node2D parent)
|
||||||
|
{
|
||||||
|
var roamingEnemyGroup = _roamingEnemyGroupPrefab.Instantiate<RoamingEnemyGroup>();
|
||||||
|
roamingEnemyGroup.Initialize(group, _fightSceneSwitcher);
|
||||||
|
parent.AddChild(roamingEnemyGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SpawnLoot(FightWorld.FighterGroup group, Node2D parent)
|
||||||
|
{
|
||||||
|
if (group.lootToDrop == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var onGroundInstance = _itemOnGroundPrefab.Instantiate<ItemOnGround2D>();
|
||||||
|
onGroundInstance.itemInstance = group.lootToDrop;
|
||||||
|
parent.AddChild(onGroundInstance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Babushka.scripts.CSharp.Common.Fight.Actions;
|
using Babushka.scripts.CSharp.Common.Fight.Actions;
|
||||||
|
using Babushka.scripts.CSharp.Common.Inventory;
|
||||||
using Babushka.scripts.CSharp.Common.Util;
|
using Babushka.scripts.CSharp.Common.Util;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
@@ -19,6 +20,7 @@ public partial class FightWorld : Node
|
|||||||
None,
|
None,
|
||||||
EndOfNight
|
EndOfNight
|
||||||
}
|
}
|
||||||
|
|
||||||
public required Dictionary<int, Room> paths;
|
public required Dictionary<int, Room> paths;
|
||||||
public required List<FighterGroup> enemyGroups;
|
public required List<FighterGroup> enemyGroups;
|
||||||
public Special specialRoom = Special.None;
|
public Special specialRoom = Special.None;
|
||||||
@@ -27,6 +29,7 @@ public partial class FightWorld : Node
|
|||||||
public class FighterGroup
|
public class FighterGroup
|
||||||
{
|
{
|
||||||
public required List<Fighter> fighters;
|
public required List<Fighter> fighters;
|
||||||
|
public ItemInstance? lootToDrop = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FightHappeningData
|
public class FightHappeningData
|
||||||
@@ -81,6 +84,9 @@ public partial class FightWorld : Node
|
|||||||
public FightHappeningData? fightHappeningData = null;
|
public FightHappeningData? fightHappeningData = null;
|
||||||
public AllyFighters allyFighters = new();
|
public AllyFighters allyFighters = new();
|
||||||
|
|
||||||
|
// settings
|
||||||
|
[Export] private ItemResource? _itemToDropByEnemyGroup;
|
||||||
|
|
||||||
public void ResetFightWorld()
|
public void ResetFightWorld()
|
||||||
{
|
{
|
||||||
Generate();
|
Generate();
|
||||||
@@ -89,10 +95,10 @@ public partial class FightWorld : Node
|
|||||||
|
|
||||||
public void Generate()
|
public void Generate()
|
||||||
{
|
{
|
||||||
world = new Generator().GenerateWorld();
|
world = new Generator(this).GenerateWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Generator
|
private class Generator(FightWorld fightWorld)
|
||||||
{
|
{
|
||||||
public World GenerateWorld()
|
public World GenerateWorld()
|
||||||
{
|
{
|
||||||
@@ -113,7 +119,7 @@ public partial class FightWorld : Node
|
|||||||
{
|
{
|
||||||
rooms.Add(GenerateDisconnectedRoom());
|
rooms.Add(GenerateDisconnectedRoom());
|
||||||
}
|
}
|
||||||
|
|
||||||
rooms.Add(new Room
|
rooms.Add(new Room
|
||||||
{
|
{
|
||||||
paths = [],
|
paths = [],
|
||||||
@@ -162,6 +168,11 @@ public partial class FightWorld : Node
|
|||||||
fighters = []
|
fighters = []
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (fightWorld._itemToDropByEnemyGroup != null)
|
||||||
|
{
|
||||||
|
enemyGroup.lootToDrop = new ItemInstance { blueprint = fightWorld._itemToDropByEnemyGroup };
|
||||||
|
}
|
||||||
|
|
||||||
var enemyCount = GD.RandRange(2, 3);
|
var enemyCount = GD.RandRange(2, 3);
|
||||||
|
|
||||||
for (var i = 0; i < enemyCount; i++)
|
for (var i = 0; i < enemyCount; i++)
|
||||||
|
|||||||
Reference in New Issue
Block a user