Compare commits

...

20 Commits

Author SHA1 Message Date
Katharina Ziolkowski ba7d550c3f Implemented Save and Load functionality 2026-02-03 17:30:35 +01:00
Katharina Ziolkowski b65a3bbd6d Managed the freeing of entityplacers. Also cleaned up EntityManager 2026-02-03 15:36:59 +01:00
Katharina Ziolkowski bcbc074c86 First adjustments to the Entity System to make it work with different types 2026-02-03 13:55:13 +01:00
jonathan 745f54b375 WIP 2026-01-29 17:42:32 +01:00
jonathan 59d313d97d Added basic entity scripts 2025-12-18 14:27:27 +01:00
Jonathan 9032272599 Merge pull request 'BlobFighter TargetSelection ColliderShape2D Transform angepasst' (#42) from Enemy_selection_overlap into develop
Reviewed-on: #42
Reviewed-by: Jonathan <cblech@ymail.com>
2025-12-18 13:06:03 +01:00
jlink a2ef3bfaf0 Window angepasst 2025-12-18 13:02:32 +01:00
jlink 1ab1071246 HoverIndicator off 2025-12-17 15:29:58 +01:00
Jonathan e5b2b8b8ab Merge pull request 'Connect farming and fighting by making them codependent' (#44) from feature/farm_fight_loop into develop
Reviewed-on: #44
2025-12-16 20:44:26 +01:00
Jonathan 2fa8aa9fbc Merge pull request 'Vesna resets to bed after death' (#47) from Vesna_resets_to_bed_after_dead into develop
Reviewed-on: #47
Reviewed-by: Jonathan <cblech@ymail.com>
2025-12-16 19:37:29 +01:00
Jonathan 6deb6e29fd Merge pull request 'Made attack selection only select alive enemies' (#45) from bug/attack_dead_enemy into develop
Reviewed-on: #45
Reviewed-by: kziolkowski <katharina.ziolkowski@gmail.com>
2025-12-16 19:30:33 +01:00
Jonathan edc133749f Merge pull request 'Randomized who starts the fight' (#41) from randomise_fight_start into develop
Reviewed-on: #41
Reviewed-by: kziolkowski <katharina.ziolkowski@gmail.com>
2025-12-16 19:28:37 +01:00
jonathan 5f75bde317 💄 Made heal button show how many beats are left 2025-12-16 19:24:20 +01:00
jonathan 7310bfbf6e Added flying beet to the ui when used 2025-12-16 19:09:03 +01:00
jonathan fef8380a57 When beetroot is in inventory the player can heal 2025-12-16 19:09:03 +01:00
jonathan f42c2c86b1 Defeated enemygroups now drop a beet_seed 2025-12-16 19:09:03 +01:00
jlink 2ed9dbbc52 Vesna resets to bed after death 2025-12-16 15:34:52 +01:00
jonathan 6375383373 🐛Made attack selection only select alive enemies 2025-12-11 18:49:51 +01:00
jlink 09f55d3aa7 BlobFighter TargetSelection ColliderShape2D Transform angepasst 2025-12-10 15:29:56 +01:00
jonathan a736adaafb Randomized who starts the fight 2025-12-09 15:07:50 +01:00
79 changed files with 16107 additions and 137 deletions
+3
View File
@@ -8,4 +8,7 @@
<Folder Include="prefabs\UI\Inventory\" /> <Folder Include="prefabs\UI\Inventory\" />
<Folder Include="scripts\CSharp\Low Code\Randomizer\" /> <Folder Include="scripts\CSharp\Low Code\Randomizer\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>
</Project> </Project>
@@ -4,19 +4,22 @@ importer="scene"
importer_version=1 importer_version=1
type="PackedScene" type="PackedScene"
uid="uid://b3kyrsoobmkhp" uid="uid://b3kyrsoobmkhp"
valid=false path="res://.godot/imported/best_house_blender.blend-ac89c74aef2f275bdf4b4baadee17c0c.scn"
[deps] [deps]
source_file="res://art/mockups/3d/best_house_blender.blend" source_file="res://art/mockups/3d/best_house_blender.blend"
dest_files=["res://.godot/imported/best_house_blender.blend-ac89c74aef2f275bdf4b4baadee17c0c.scn"]
[params] [params]
nodes/root_type="" nodes/root_type=""
nodes/root_name="" nodes/root_name=""
nodes/root_script=null
nodes/apply_root_scale=true nodes/apply_root_scale=true
nodes/root_scale=1.0 nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false nodes/import_as_skeleton_bones=false
nodes/use_name_suffixes=true
nodes/use_node_type_suffixes=true nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true meshes/ensure_tangents=true
meshes/generate_lods=true meshes/generate_lods=true
@@ -31,6 +34,9 @@ animation/trimming=false
animation/remove_immutable_tracks=true animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false animation/import_rest_as_RESET=false
import_script/path="" import_script/path=""
materials/extract=0
materials/extract_format=0
materials/extract_path=""
_subresources={} _subresources={}
blender/nodes/visible=0 blender/nodes/visible=0
blender/nodes/active_collection_only=false blender/nodes/active_collection_only=false
@@ -50,3 +56,4 @@ blender/materials/export_materials=1
blender/animation/limit_playback=true blender/animation/limit_playback=true
blender/animation/always_sample=true blender/animation/always_sample=true
blender/animation/group_tracks=true blender/animation/group_tracks=true
gltf/naming_version=0
+45
View File
@@ -26,6 +26,15 @@
&"nicknames": ["vesna"], &"nicknames": ["vesna"],
&"offset": Vector2(-300, 0), &"offset": Vector2(-300, 0),
&"portraits": { &"portraits": {
"angry": {
"export_overrides": {
"image": "\"res://art/characters/Vesna/angry.png\""
},
"mirror": false,
"offset": Vector2(150, 0),
"scale": 0.65,
"scene": ""
},
"front": { "front": {
"export_overrides": { "export_overrides": {
"image": "\"res://art/animation/Vesna2D/Vesna Anims Sequences/F01-Idle/0001.png\"" "image": "\"res://art/animation/Vesna2D/Vesna Anims Sequences/F01-Idle/0001.png\""
@@ -52,6 +61,42 @@
"offset": Vector2(0, 0), "offset": Vector2(0, 0),
"scale": 1.0, "scale": 1.0,
"scene": "" "scene": ""
},
"sad": {
"export_overrides": {
"image": "\"res://art/characters/Vesna/sad.png\""
},
"mirror": false,
"offset": Vector2(150, 0),
"scale": 0.65,
"scene": ""
},
"smile": {
"export_overrides": {
"image": "\"res://art/characters/Vesna/smile.png\""
},
"mirror": false,
"offset": Vector2(150, 0),
"scale": 0.65,
"scene": ""
},
"surprise": {
"export_overrides": {
"image": "\"res://art/characters/Vesna/surprise.png\""
},
"mirror": false,
"offset": Vector2(150, 0),
"scale": 0.65,
"scene": ""
},
"surprised": {
"export_overrides": {
"image": "\"res://art/characters/Vesna/surprised.png\""
},
"mirror": false,
"offset": Vector2(150, 0),
"scale": 0.65,
"scene": ""
} }
}, },
&"scale": 1.0 &"scale": 1.0
+15
View File
@@ -0,0 +1,15 @@
[gd_scene load_steps=4 format=3 uid="uid://hdfejdnmp8sl"]
[ext_resource type="Script" uid="uid://umop2b1m1qm8" path="res://scripts/CSharp/GameEntity/Management/EntityManager.cs" id="1_2bwns"]
[ext_resource type="Script" uid="uid://bogqp274y1pgr" path="res://scripts/CSharp/GameEntity/Management/EntityNodeCreator.cs" id="2_8m173"]
[ext_resource type="PackedScene" uid="uid://sbf12hin4kes" path="res://prefabs/Interactables/trash_object.tscn" id="3_v3vdc"]
[node name="EntityManager" type="Node" node_paths=PackedStringArray("_nodeCreator")]
script = ExtResource("1_2bwns")
_nodeCreator = NodePath("EntityCreator")
[node name="EntityCreator" type="Node" parent="."]
script = ExtResource("2_8m173")
_entityPrefabs = Dictionary[String, PackedScene]({
"TrashEntity": ExtResource("3_v3vdc")
})
+22 -2
View File
@@ -1,10 +1,30 @@
[gd_scene load_steps=2 format=3 uid="uid://l1hdihubffeg"] [gd_scene load_steps=3 format=3 uid="uid://l1hdihubffeg"]
[ext_resource type="Script" uid="uid://b5i41b6502xam" path="res://scripts/CSharp/Common/Fight/FighterDamageIndicatorFlyingNumber.cs" id="1_m0ub6"] [ext_resource type="Script" uid="uid://b5i41b6502xam" path="res://scripts/CSharp/Common/Fight/FighterDamageIndicatorFlyingNumber.cs" id="1_m0ub6"]
[ext_resource type="Texture2D" uid="uid://do0y56t1moi2" path="res://art/mockups/erdbeeren.png" id="2_ctnqp"]
[node name="DamageFlyingNuber" type="Node2D" node_paths=PackedStringArray("_label")] [node name="DamageFlyingNuber" type="Node2D" node_paths=PackedStringArray("_label", "_sprite")]
script = ExtResource("1_m0ub6") script = ExtResource("1_m0ub6")
_label = NodePath("Label") _label = NodePath("Label")
_sprite = NodePath("TextureRect")
[node name="TextureRect" type="TextureRect" parent="."]
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -61.0
offset_top = -61.0
offset_right = 61.0
offset_bottom = 61.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 4
size_flags_vertical = 4
texture = ExtResource("2_ctnqp")
expand_mode = 1
stretch_mode = 5
[node name="Label" type="Label" parent="."] [node name="Label" type="Label" parent="."]
custom_minimum_size = Vector2(200, 100) custom_minimum_size = Vector2(200, 100)
+5 -1
View File
@@ -1,6 +1,10 @@
[gd_scene load_steps=2 format=3 uid="uid://n5cj71bxxjkk"] [gd_scene load_steps=4 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"]
[ext_resource type="Resource" uid="uid://0mnsr4anoaiq" path="res://resources/items/beet.tres" id="3_008v8"]
[node name="FightWorldAutoload" type="Node2D"] [node name="FightWorldAutoload" type="Node2D"]
script = ExtResource("1_tnyce") script = ExtResource("1_tnyce")
_itemToDropByEnemyGroup = ExtResource("2_lxs0o")
itemBeetrootToEatForHealth = ExtResource("3_008v8")
@@ -14,5 +14,9 @@ position = Vector2(23, -96)
scale = Vector2(0.547474, 0.547474) scale = Vector2(0.547474, 0.547474)
texture = SubResource("AtlasTexture_ane0o") texture = SubResource("AtlasTexture_ane0o")
[node name="CollisionShape2D" parent="TargetSelection/Click" index="0"]
position = Vector2(25.215, -195)
scale = Vector2(0.72370636, 1)
[node name="Sprite2D" parent="TargetSelection/HoverIndicator" index="0"] [node name="Sprite2D" parent="TargetSelection/HoverIndicator" index="0"]
position = Vector2(1, -126) position = Vector2(0.84, -126)
+18 -3
View File
@@ -25,7 +25,7 @@ buses/default_bus_layout="uid://b6dwkmkyb0axk"
[autoload] [autoload]
SceneTransition="*res://scenes/SceneTransition.tscn" SceneTransition="*res://prefabs/UI/SceneTransition.tscn"
Dialogic="*res://addons/dialogic/Core/DialogicGameHandler.gd" Dialogic="*res://addons/dialogic/Core/DialogicGameHandler.gd"
InventoryManager="*res://scripts/CSharp/Common/Inventory/InventoryManager.cs" InventoryManager="*res://scripts/CSharp/Common/Inventory/InventoryManager.cs"
InputService="*res://scripts/CSharp/Common/Services/InputService.cs" InputService="*res://scripts/CSharp/Common/Services/InputService.cs"
@@ -35,6 +35,7 @@ FightWorldAutoload="*res://prefabs/fight/fight_world_autoload.tscn"
SaveGameManager="*res://scripts/CSharp/Common/Savegame/SaveGameManager.cs" SaveGameManager="*res://scripts/CSharp/Common/Savegame/SaveGameManager.cs"
SettingsSaveController="*res://scripts/CSharp/Common/Savegame/SettingsSaveController.cs" SettingsSaveController="*res://scripts/CSharp/Common/Savegame/SettingsSaveController.cs"
DayAndNight="*res://prefabs/day_and_night/day_and_night.tscn" DayAndNight="*res://prefabs/day_and_night/day_and_night.tscn"
EntityManager="*res://prefabs/entity_system/entity_manager.tscn"
[dialogic] [dialogic]
@@ -186,8 +187,8 @@ directories/tres_directory={
[display] [display]
window/size/viewport_width=1980 window/size/viewport_width=1920
window/size/viewport_height=1020 window/size/viewport_height=1080
window/stretch/mode="viewport" window/stretch/mode="viewport"
window/stretch/aspect="keep_height" window/stretch/aspect="keep_height"
@@ -221,6 +222,10 @@ folder_colors={
"res://shader/": "pink" "res://shader/": "pink"
} }
[filesystem]
import/blender/enabled=false
[global_group] [global_group]
Saveable="" Saveable=""
@@ -307,6 +312,16 @@ NextDayCheat={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null) "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
] ]
} }
DebugEntities={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":66,"key_label":0,"unicode":98,"location":0,"echo":false,"script":null)
]
}
SaveGame={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194336,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
[internationalization] [internationalization]
+23 -1
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=118 format=3 uid="uid://gigb28qk8t12"] [gd_scene load_steps=119 format=3 uid="uid://gigb28qk8t12"]
[ext_resource type="PackedScene" uid="uid://c25udixd5m6l0" path="res://prefabs/characters/Vesna.tscn" id="1_7wfwe"] [ext_resource type="PackedScene" uid="uid://c25udixd5m6l0" path="res://prefabs/characters/Vesna.tscn" id="1_7wfwe"]
[ext_resource type="Texture2D" uid="uid://8sr11ex30n0m" path="res://art/mockups/Kenney_Backgrounds/Samples/uncolored_hills.png" id="2_7b2ri"] [ext_resource type="Texture2D" uid="uid://8sr11ex30n0m" path="res://art/mockups/Kenney_Backgrounds/Samples/uncolored_hills.png" id="2_7b2ri"]
@@ -37,6 +37,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="Resource" uid="uid://0mnsr4anoaiq" path="res://resources/items/beet.tres" id="36_q1g8e"]
[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"]
@@ -1043,6 +1044,24 @@ shape = SubResource("CircleShape2D_tm0yg")
[node name="Icon" parent="YSorted/SeedPickup" index="4"] [node name="Icon" parent="YSorted/SeedPickup" index="4"]
scale = Vector2(1, 1) scale = Vector2(1, 1)
[node name="BeetPickup" parent="YSorted" instance=ExtResource("25_hukxv")]
position = Vector2(5787, 2269)
_finiteSupply = 3
metadata/SaveID = "e1bbe13f-0622-42b8-97f3-87a8af369dc0"
[node name="SpawnWithItem" parent="YSorted/BeetPickup" index="0"]
_blueprint = ExtResource("36_q1g8e")
[node name="PickupInteractionArea" parent="YSorted/BeetPickup" index="3" node_paths=PackedStringArray("_spritesToOutline")]
_spritesToOutline = [NodePath("../../SeedPickup/Icon")]
metadata/SaveID = "ad152c51-3631-42c1-9aa4-4df896b35d8c"
[node name="CollisionShape3D" parent="YSorted/BeetPickup/PickupInteractionArea/Area2D" index="0"]
shape = SubResource("CircleShape2D_tm0yg")
[node name="Icon" parent="YSorted/BeetPickup" index="4"]
scale = Vector2(1, 1)
[node name="SeedPickup2" parent="YSorted" instance=ExtResource("25_hukxv")] [node name="SeedPickup2" parent="YSorted" instance=ExtResource("25_hukxv")]
position = Vector2(10705, 2257) position = Vector2(10705, 2257)
_finiteSupply = 3 _finiteSupply = 3
@@ -2507,6 +2526,7 @@ script = ExtResource("80_w1kgo")
[connection signal="SuccessfulPickUp" from="YSorted/CanGenericPickup" to="YSorted/Vesna" method="HandlePickUp"] [connection signal="SuccessfulPickUp" from="YSorted/CanGenericPickup" to="YSorted/Vesna" method="HandlePickUp"]
[connection signal="SuccessfulPickUp" from="YSorted/RakeGenericPickup" to="YSorted/Vesna" method="HandlePickUp"] [connection signal="SuccessfulPickUp" from="YSorted/RakeGenericPickup" to="YSorted/Vesna" method="HandlePickUp"]
[connection signal="SuccessfulPickUp" from="YSorted/SeedPickup" to="YSorted/Vesna" method="HandlePickUp"] [connection signal="SuccessfulPickUp" from="YSorted/SeedPickup" to="YSorted/Vesna" method="HandlePickUp"]
[connection signal="SuccessfulPickUp" from="YSorted/BeetPickup" to="YSorted/Vesna" method="HandlePickUp"]
[connection signal="SuccessfulPickUp" from="YSorted/SeedPickup2" to="YSorted/Vesna" method="HandlePickUp"] [connection signal="SuccessfulPickUp" from="YSorted/SeedPickup2" to="YSorted/Vesna" method="HandlePickUp"]
[connection signal="InteractedTool" from="YSorted/Farm visuals/Static/EnterHouseInteraction" to="." method="LoadSceneAtIndex"] [connection signal="InteractedTool" from="YSorted/Farm visuals/Static/EnterHouseInteraction" to="." method="LoadSceneAtIndex"]
[connection signal="InteractedTool" from="YSorted/Blocker/InteractionArea" to="." method="LoadSceneAtIndex"] [connection signal="InteractedTool" from="YSorted/Blocker/InteractionArea" to="." method="LoadSceneAtIndex"]
@@ -2531,6 +2551,8 @@ script = ExtResource("80_w1kgo")
[editable path="YSorted/RakeGenericPickup/PickupInteractionArea"] [editable path="YSorted/RakeGenericPickup/PickupInteractionArea"]
[editable path="YSorted/SeedPickup"] [editable path="YSorted/SeedPickup"]
[editable path="YSorted/SeedPickup/PickupInteractionArea"] [editable path="YSorted/SeedPickup/PickupInteractionArea"]
[editable path="YSorted/BeetPickup"]
[editable path="YSorted/BeetPickup/PickupInteractionArea"]
[editable path="YSorted/SeedPickup2"] [editable path="YSorted/SeedPickup2"]
[editable path="YSorted/SeedPickup2/PickupInteractionArea"] [editable path="YSorted/SeedPickup2/PickupInteractionArea"]
[editable path="YSorted/Blocker/InteractionArea"] [editable path="YSorted/Blocker/InteractionArea"]
+26 -3
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=14 format=3 uid="uid://cjshlwk8ajpnp"] [gd_scene load_steps=20 format=3 uid="uid://cjshlwk8ajpnp"]
[ext_resource type="Script" uid="uid://cnhpnn8o0gybd" path="res://scripts/CSharp/Common/Fight/FightHappeningSceneSetup.cs" id="1_fiutj"] [ext_resource type="Script" uid="uid://cnhpnn8o0gybd" path="res://scripts/CSharp/Common/Fight/FightHappeningSceneSetup.cs" id="1_fiutj"]
[ext_resource type="Script" uid="uid://c76mhhqyk4lgh" path="res://scripts/CSharp/Common/Fight/FightHappening.cs" id="1_gsk03"] [ext_resource type="Script" uid="uid://c76mhhqyk4lgh" path="res://scripts/CSharp/Common/Fight/FightHappening.cs" id="1_gsk03"]
@@ -6,6 +6,7 @@
[ext_resource type="Script" uid="uid://dwsqst8fhhqlc" path="res://scripts/CSharp/Common/Fight/AllFightersVisual.cs" id="2_lu4y4"] [ext_resource type="Script" uid="uid://dwsqst8fhhqlc" path="res://scripts/CSharp/Common/Fight/AllFightersVisual.cs" id="2_lu4y4"]
[ext_resource type="PackedScene" uid="uid://bcld43daavmrn" path="res://prefabs/fight/fight_scene_switcher.tscn" id="2_phrlx"] [ext_resource type="PackedScene" uid="uid://bcld43daavmrn" path="res://prefabs/fight/fight_scene_switcher.tscn" id="2_phrlx"]
[ext_resource type="PackedScene" uid="uid://7jsxokx67gpq" path="res://prefabs/fight/fighterVisuals/vesna_fighter_visual.tscn" id="4_qo0gi"] [ext_resource type="PackedScene" uid="uid://7jsxokx67gpq" path="res://prefabs/fight/fighterVisuals/vesna_fighter_visual.tscn" id="4_qo0gi"]
[ext_resource type="Script" uid="uid://cdrjvgm82pxoj" path="res://scripts/CSharp/Common/Fight/FightHappeningAnimationContext.cs" id="4_v5rv6"]
[ext_resource type="PackedScene" uid="uid://0vm3jb1hnkkb" path="res://prefabs/fight/fighterVisuals/blob_fighter_visual.tscn" id="4_vp8s0"] [ext_resource type="PackedScene" uid="uid://0vm3jb1hnkkb" path="res://prefabs/fight/fighterVisuals/blob_fighter_visual.tscn" id="4_vp8s0"]
[ext_resource type="Script" uid="uid://buiwuf7pjfq8" path="res://scripts/CSharp/Common/Fight/FightHappeningStateReaction.cs" id="4_ydj1i"] [ext_resource type="Script" uid="uid://buiwuf7pjfq8" path="res://scripts/CSharp/Common/Fight/FightHappeningStateReaction.cs" id="4_ydj1i"]
[ext_resource type="PackedScene" uid="uid://bydwj3pbvqrhb" path="res://prefabs/minigame/minigame.tscn" id="8_2b3cf"] [ext_resource type="PackedScene" uid="uid://bydwj3pbvqrhb" path="res://prefabs/minigame/minigame.tscn" id="8_2b3cf"]
@@ -13,20 +14,30 @@
[ext_resource type="Script" uid="uid://bwm0nhvt1083k" path="res://scripts/CSharp/Common/Fight/FightMinigameHandler.cs" id="8_falfe"] [ext_resource type="Script" uid="uid://bwm0nhvt1083k" path="res://scripts/CSharp/Common/Fight/FightMinigameHandler.cs" id="8_falfe"]
[ext_resource type="Script" uid="uid://d2ugtb3dalrg3" path="res://scripts/CSharp/Common/Fight/FightHappeningStateDebugger.cs" id="8_tv7cl"] [ext_resource type="Script" uid="uid://d2ugtb3dalrg3" path="res://scripts/CSharp/Common/Fight/FightHappeningStateDebugger.cs" id="8_tv7cl"]
[ext_resource type="Script" uid="uid://2f7rqk50gtdg" path="res://scripts/CSharp/Common/Fight/SwitchSceneOnFightEnd.cs" id="10_qqd8u"] [ext_resource type="Script" uid="uid://2f7rqk50gtdg" path="res://scripts/CSharp/Common/Fight/SwitchSceneOnFightEnd.cs" id="10_qqd8u"]
[ext_resource type="Script" uid="uid://6nniwfxye8ss" path="res://scripts/CSharp/Common/Fight/UsedItemIndicatorVisual.cs" id="14_b4ll5"]
[ext_resource type="Script" uid="uid://71mdwp2m4rta" path="res://scripts/CSharp/Common/Fight/UI/HealButtonVisual.cs" id="14_oy2wu"]
[ext_resource type="Resource" uid="uid://0mnsr4anoaiq" path="res://resources/items/beet.tres" id="15_k4fcr"]
[ext_resource type="PackedScene" uid="uid://l1hdihubffeg" path="res://prefabs/fight/damage_flying_nuber.tscn" id="15_oy2wu"]
[ext_resource type="Texture2D" uid="uid://djewfwrdt4iv3" path="res://art/ui/UI/icons/icon-fruit-beetroot.png" id="16_k4fcr"]
[node name="BabushkaSceneFightHappening" type="Node2D"] [node name="BabushkaSceneFightHappening" type="Node2D"]
[node name="FightHappening" type="Node" parent="."] [node name="FightHappening" type="Node" parent="."]
script = ExtResource("1_gsk03") script = ExtResource("1_gsk03")
[node name="ActionAnimationController" type="Node" parent="." node_paths=PackedStringArray("_allFightersVisual")] [node name="ActionAnimationController" type="Node" parent="." node_paths=PackedStringArray("_allFightersVisual", "_animationContext")]
script = ExtResource("2_7kjgs") script = ExtResource("2_7kjgs")
_allFightersVisual = NodePath("../FightVisuals") _allFightersVisual = NodePath("../FightVisuals")
_animationContext = NodePath("AnimationContext")
[node name="StateReactionActionAnimation" type="Node" parent="ActionAnimationController"] [node name="StateReactionActionAnimation" type="Node" parent="ActionAnimationController"]
script = ExtResource("4_ydj1i") script = ExtResource("4_ydj1i")
_fightState = 10 _fightState = 10
[node name="AnimationContext" type="Node" parent="ActionAnimationController" node_paths=PackedStringArray("useHealItemIndicator")]
script = ExtResource("4_v5rv6")
useHealItemIndicator = NodePath("../../UseItemIndicator")
[node name="Camera2D" type="Camera2D" parent="."] [node name="Camera2D" type="Camera2D" parent="."]
[node name="FightSetup" type="Node2D" parent="."] [node name="FightSetup" type="Node2D" parent="."]
@@ -146,7 +157,12 @@ theme_override_constants/margin_bottom = 10
[node name="Talk Button" type="Button" parent="ActionSelect/BottomPanel/VBoxContainer/MarginContainer/HBoxContainer/MarginContainer3"] [node name="Talk Button" type="Button" parent="ActionSelect/BottomPanel/VBoxContainer/MarginContainer/HBoxContainer/MarginContainer3"]
layout_mode = 2 layout_mode = 2
theme_override_font_sizes/font_size = 41 theme_override_font_sizes/font_size = 41
text = "Talk" text = "x19 - Heal"
icon = ExtResource("16_k4fcr")
alignment = 0
expand_icon = true
script = ExtResource("14_oy2wu")
_healItemBlueprint = ExtResource("15_k4fcr")
[node name="MarginContainer4" type="MarginContainer" parent="ActionSelect/BottomPanel/VBoxContainer/MarginContainer/HBoxContainer"] [node name="MarginContainer4" type="MarginContainer" parent="ActionSelect/BottomPanel/VBoxContainer/MarginContainer/HBoxContainer"]
layout_mode = 2 layout_mode = 2
@@ -207,6 +223,12 @@ offset_right = 794.0
offset_bottom = -472.0 offset_bottom = -472.0
text = "Hello world" text = "Hello world"
[node name="UseItemIndicator" type="Node2D" parent="."]
position = Vector2(214, 319)
script = ExtResource("14_b4ll5")
_flyingIndicatorPrefab = ExtResource("15_oy2wu")
_itemTexture = ExtResource("16_k4fcr")
[connection signal="SignalTransitionState" from="FightHappening" to="ActionAnimationController/StateReactionActionAnimation" method="FightHappeningStateTransitioned"] [connection signal="SignalTransitionState" from="FightHappening" to="ActionAnimationController/StateReactionActionAnimation" method="FightHappeningStateTransitioned"]
[connection signal="SignalTransitionState" from="FightHappening" to="FightVisuals" method="FightHappeningStateChange"] [connection signal="SignalTransitionState" from="FightHappening" to="FightVisuals" method="FightHappeningStateChange"]
[connection signal="SignalTransitionState" from="FightHappening" to="ActionSelect/StateReactionInputActionSelect" method="FightHappeningStateTransitioned"] [connection signal="SignalTransitionState" from="FightHappening" to="ActionSelect/StateReactionInputActionSelect" method="FightHappeningStateTransitioned"]
@@ -221,4 +243,5 @@ text = "Hello world"
[connection signal="pressed" from="ActionSelect/BottomPanel/VBoxContainer/MarginContainer/HBoxContainer/MarginContainer4/Flee Button" to="ActionSelect" method="SelectAction" binds= [4]] [connection signal="pressed" from="ActionSelect/BottomPanel/VBoxContainer/MarginContainer/HBoxContainer/MarginContainer4/Flee Button" to="ActionSelect" method="SelectAction" binds= [4]]
[connection signal="OnStateEntered" from="ActionSelect/StateReactionInputActionSelect" to="ActionSelect" method="show"] [connection signal="OnStateEntered" from="ActionSelect/StateReactionInputActionSelect" to="ActionSelect" method="show"]
[connection signal="OnStateEntered" from="ActionSelect/StateReactionInputActionSelect" to="ActionSelect" method="StateEntered"] [connection signal="OnStateEntered" from="ActionSelect/StateReactionInputActionSelect" to="ActionSelect" method="StateEntered"]
[connection signal="OnStateEntered" from="ActionSelect/StateReactionInputActionSelect" to="ActionSelect/BottomPanel/VBoxContainer/MarginContainer/HBoxContainer/MarginContainer3/Talk Button" method="UpdateText"]
[connection signal="OnStateExited" from="ActionSelect/StateReactionInputActionSelect" to="ActionSelect" method="hide"] [connection signal="OnStateExited" from="ActionSelect/StateReactionInputActionSelect" to="ActionSelect" method="hide"]
@@ -40,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")
@@ -2175,6 +2176,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"]
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+445
View File
@@ -0,0 +1,445 @@
[gd_scene load_steps=9 format=3 uid="uid://b4uito2bnud2a"]
[ext_resource type="Script" uid="uid://cssdu8viimwm6" path="res://scripts/CSharp/Common/SceneTransition.cs" id="1_f5860"]
[ext_resource type="Texture2D" uid="uid://c7atj6ohlmir3" path="res://art/ui/StartScreen/titlescreen.png" id="1_kesja"]
[ext_resource type="Texture2D" uid="uid://du612t3xytly3" path="res://art/ui/StartScreen/babushkalog_white.png" id="2_f5860"]
[ext_resource type="Texture2D" uid="uid://cfrhmcyhs2i53" path="res://art/ui/UI/WhiteWashBackground.png" id="3_dvwtm"]
[ext_resource type="Texture2D" uid="uid://deitc84w2byyh" path="res://art/ui/nametag.png" id="4_a8kc7"]
[ext_resource type="FontFile" uid="uid://bgmdn7uo215q2" path="res://art/fonts/RuslanDisplay-Regular.ttf" id="5_gsl3s"]
[ext_resource type="Texture2D" uid="uid://blbplxfx41f8t" path="res://art/logos/Cozy Raven Logo breit.svg" id="6_l0rmr"]
[ext_resource type="Texture2D" uid="uid://cwbv2i8ntq15d" path="res://art/logos/FS_Logo_2zeilig_rot.png" id="7_03xwf"]
[node name="BabushkaSceneCredits" type="Node2D"]
script = ExtResource("1_f5860")
_sceneNamesToLoad = PackedStringArray("res://scenes/scene_bootstrap.tscn")
[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(1030, 483)
scale = Vector2(0.535648, 0.535648)
texture = ExtResource("1_kesja")
[node name="BabushkaText" type="Sprite2D" parent="."]
position = Vector2(1387, 129)
scale = Vector2(0.349074, 0.349074)
texture = ExtResource("2_f5860")
[node name="WhiteWash" type="Sprite2D" parent="."]
modulate = Color(1, 1, 1, 0.0509804)
position = Vector2(1019, 930)
scale = Vector2(13.1172, 4.47852)
texture = ExtResource("3_dvwtm")
[node name="Node2D10" type="Node2D" parent="."]
position = Vector2(-18, 4)
scale = Vector2(0.93, 0.93)
[node name="Node2D2" type="Node2D" parent="Node2D10"]
position = Vector2(39, -100)
scale = Vector2(0.5, 0.5)
[node name="Nametag2" type="Sprite2D" parent="Node2D10/Node2D2"]
position = Vector2(596.045, 303)
scale = Vector2(0.636364, 0.636364)
texture = ExtResource("4_a8kc7")
[node name="Label2" type="Label" parent="Node2D10/Node2D2"]
offset_left = 296.0
offset_top = 250.0
offset_right = 898.0
offset_bottom = 377.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 56
text = "Producer"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Nametag" type="Sprite2D" parent="Node2D10/Node2D2"]
position = Vector2(595, 408)
texture = ExtResource("4_a8kc7")
[node name="Label" type="Label" parent="Node2D10/Node2D2"]
offset_left = 124.0
offset_top = 359.0
offset_right = 1072.0
offset_bottom = 486.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 80
text = "Kathi"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Node2D" type="Node2D" parent="Node2D10"]
position = Vector2(39, 15)
scale = Vector2(0.5, 0.5)
[node name="Nametag2" type="Sprite2D" parent="Node2D10/Node2D"]
position = Vector2(596.045, 303)
scale = Vector2(0.636364, 0.636364)
texture = ExtResource("4_a8kc7")
[node name="Label2" type="Label" parent="Node2D10/Node2D"]
offset_left = 295.0
offset_top = 250.0
offset_right = 897.0
offset_bottom = 377.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 56
text = "Programming"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Nametag" type="Sprite2D" parent="Node2D10/Node2D"]
position = Vector2(595, 408)
texture = ExtResource("4_a8kc7")
[node name="Label" type="Label" parent="Node2D10/Node2D"]
offset_left = 124.0
offset_top = 359.0
offset_right = 1072.0
offset_bottom = 486.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 80
text = "Jonathan"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Node2D3" type="Node2D" parent="Node2D10"]
position = Vector2(35, 130)
scale = Vector2(0.5, 0.5)
[node name="Nametag2" type="Sprite2D" parent="Node2D10/Node2D3"]
position = Vector2(596.045, 303)
scale = Vector2(0.636364, 0.636364)
texture = ExtResource("4_a8kc7")
[node name="Label2" type="Label" parent="Node2D10/Node2D3"]
offset_left = 295.0
offset_top = 250.0
offset_right = 897.0
offset_bottom = 377.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 56
text = "Sound Design"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Nametag" type="Sprite2D" parent="Node2D10/Node2D3"]
position = Vector2(595, 408)
texture = ExtResource("4_a8kc7")
[node name="Label" type="Label" parent="Node2D10/Node2D3"]
offset_left = 124.0
offset_top = 359.0
offset_right = 1072.0
offset_bottom = 486.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 80
text = "Laura"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Node2D4" type="Node2D" parent="Node2D10"]
position = Vector2(35, 244)
scale = Vector2(0.5, 0.5)
[node name="Nametag2" type="Sprite2D" parent="Node2D10/Node2D4"]
position = Vector2(596.045, 303)
scale = Vector2(0.636364, 0.636364)
texture = ExtResource("4_a8kc7")
[node name="Label2" type="Label" parent="Node2D10/Node2D4"]
offset_left = 295.0
offset_top = 250.0
offset_right = 897.0
offset_bottom = 377.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 56
text = "Project Manager"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Nametag" type="Sprite2D" parent="Node2D10/Node2D4"]
position = Vector2(595, 408)
texture = ExtResource("4_a8kc7")
[node name="Label" type="Label" parent="Node2D10/Node2D4"]
offset_left = 124.0
offset_top = 359.0
offset_right = 1072.0
offset_bottom = 486.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 80
text = "Anna"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Node2D5" type="Node2D" parent="Node2D10"]
position = Vector2(35, 356)
scale = Vector2(0.5, 0.5)
[node name="Nametag2" type="Sprite2D" parent="Node2D10/Node2D5"]
position = Vector2(596.045, 303)
scale = Vector2(0.636364, 0.636364)
texture = ExtResource("4_a8kc7")
[node name="Label2" type="Label" parent="Node2D10/Node2D5"]
offset_left = 295.0
offset_top = 250.0
offset_right = 897.0
offset_bottom = 377.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 56
text = "Art"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Nametag" type="Sprite2D" parent="Node2D10/Node2D5"]
position = Vector2(595, 408)
texture = ExtResource("4_a8kc7")
[node name="Label" type="Label" parent="Node2D10/Node2D5"]
offset_left = 124.0
offset_top = 359.0
offset_right = 1072.0
offset_bottom = 486.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 80
text = "Alphawolfin"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Node2D6" type="Node2D" parent="Node2D10"]
position = Vector2(35, 581)
scale = Vector2(0.5, 0.5)
[node name="Nametag2" type="Sprite2D" parent="Node2D10/Node2D6"]
position = Vector2(596.045, 303)
scale = Vector2(0.636364, 0.636364)
texture = ExtResource("4_a8kc7")
[node name="Label2" type="Label" parent="Node2D10/Node2D6"]
offset_left = 295.0
offset_top = 250.0
offset_right = 897.0
offset_bottom = 377.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 56
text = "Game Design"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Nametag" type="Sprite2D" parent="Node2D10/Node2D6"]
position = Vector2(595, 408)
texture = ExtResource("4_a8kc7")
[node name="Label" type="Label" parent="Node2D10/Node2D6"]
offset_left = 124.0
offset_top = 359.0
offset_right = 1072.0
offset_bottom = 486.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 80
text = "Max"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Node2D7" type="Node2D" parent="Node2D10"]
position = Vector2(35, 695)
scale = Vector2(0.5, 0.5)
[node name="Nametag2" type="Sprite2D" parent="Node2D10/Node2D7"]
position = Vector2(596.045, 303)
scale = Vector2(0.636364, 0.636364)
texture = ExtResource("4_a8kc7")
[node name="Label2" type="Label" parent="Node2D10/Node2D7"]
offset_left = 295.0
offset_top = 250.0
offset_right = 897.0
offset_bottom = 377.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 56
text = "Writer"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Nametag" type="Sprite2D" parent="Node2D10/Node2D7"]
position = Vector2(595, 408)
texture = ExtResource("4_a8kc7")
[node name="Label" type="Label" parent="Node2D10/Node2D7"]
offset_left = 124.0
offset_top = 359.0
offset_right = 1072.0
offset_bottom = 486.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 80
text = "Sanel"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Node2D8" type="Node2D" parent="Node2D10"]
position = Vector2(35, 469)
scale = Vector2(0.5, 0.5)
[node name="Nametag2" type="Sprite2D" parent="Node2D10/Node2D8"]
position = Vector2(596.045, 303)
scale = Vector2(0.636364, 0.636364)
texture = ExtResource("4_a8kc7")
[node name="Label2" type="Label" parent="Node2D10/Node2D8"]
offset_left = 295.0
offset_top = 250.0
offset_right = 897.0
offset_bottom = 377.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 56
text = "Animation"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Nametag" type="Sprite2D" parent="Node2D10/Node2D8"]
position = Vector2(595, 408)
texture = ExtResource("4_a8kc7")
[node name="Label" type="Label" parent="Node2D10/Node2D8"]
offset_left = 124.0
offset_top = 359.0
offset_right = 1072.0
offset_bottom = 486.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 80
text = "Felix"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Node2D9" type="Node2D" parent="Node2D10"]
position = Vector2(35, 807)
scale = Vector2(0.5, 0.5)
[node name="Nametag2" type="Sprite2D" parent="Node2D10/Node2D9"]
position = Vector2(596.045, 303)
scale = Vector2(0.636364, 0.636364)
texture = ExtResource("4_a8kc7")
[node name="Label2" type="Label" parent="Node2D10/Node2D9"]
offset_left = 295.0
offset_top = 250.0
offset_right = 897.0
offset_bottom = 377.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 56
text = "Music"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Nametag3" type="Sprite2D" parent="Node2D10/Node2D9"]
position = Vector2(3726.91, 187.387)
scale = Vector2(0.636364, 0.636364)
texture = ExtResource("4_a8kc7")
[node name="Label3" type="Label" parent="Node2D10/Node2D9"]
offset_left = 3425.86
offset_top = 134.387
offset_right = 4027.86
offset_bottom = 261.387
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 56
text = "Gefördert durch"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Nametag" type="Sprite2D" parent="Node2D10/Node2D9"]
position = Vector2(595, 408)
texture = ExtResource("4_a8kc7")
[node name="Label" type="Label" parent="Node2D10/Node2D9"]
offset_left = 124.0
offset_top = 359.0
offset_right = 1072.0
offset_bottom = 486.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 80
text = "Felix"
horizontal_alignment = 1
vertical_alignment = 1
[node name="CozyRavenLogoBreit" type="Sprite2D" parent="."]
position = Vector2(1044.13, 876.875)
scale = Vector2(0.150709, 0.150709)
texture = ExtResource("6_l0rmr")
[node name="fums Logo" type="Sprite2D" parent="."]
position = Vector2(1751, 917)
scale = Vector2(0.496692, 0.496693)
texture = ExtResource("7_03xwf")
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="Button" type="Button" parent="CanvasLayer"]
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -75.0
offset_bottom = 71.0
grow_horizontal = 0
alignment = 2
[connection signal="pressed" from="CanvasLayer/Button" to="." method="LoadScene"]
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+172
View File
@@ -0,0 +1,172 @@
[gd_scene load_steps=19 format=3 uid="uid://botol7aqw81n7"]
[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="Script" uid="uid://cldtt4atgymm5" path="res://scripts/CSharp/Common/Quest/QuestTrigger.cs" id="8_j25a2"]
[ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="8_phqdf"]
[ext_resource type="Resource" uid="uid://csj15gnlx1jmx" path="res://resources/quests/demo/8_goto_bed.tres" id="9_heyef"]
[ext_resource type="Texture2D" path="res://art/indoor/vesna_indoor_bed.png" id="10_hryl5"]
[ext_resource type="Script" uid="uid://puw74w6lmcvl" path="res://scripts/CSharp/Common/Fight/NightStarter.cs" id="10_j25a2"]
[ext_resource type="Texture2D" path="res://art/indoor/vesna_indoor_door.png" id="11_axs81"]
[ext_resource type="Script" uid="uid://jg4jryfus3bw" path="res://scripts/CSharp/Common/DayAndNight/DayAndNightHelper.cs" id="11_heyef"]
[ext_resource type="Texture2D" uid="uid://cop1vjvhwlsec" path="res://art/indoor/room export/Room_01_shelf.png" id="13_11fdt"]
[ext_resource type="Texture2D" uid="uid://bleimj6jr1jka" path="res://art/general/rectangle.png" id="14_axs81"]
[ext_resource type="PackedScene" uid="uid://c25udixd5m6l0" path="res://prefabs/characters/Vesna.tscn" id="18_3gevq"]
[ext_resource type="Script" uid="uid://bqomwxclsbhd3" path="res://scripts/CSharp/Common/Camera/CameraController.cs" id="23_408bg"]
[ext_resource type="PackedScene" uid="uid://cgjc4wurbgimy" path="res://prefabs/UI/Inventory/Inventory.tscn" id="24_xwo8y"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_l0jrn"]
resource_local_to_scene = true
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
[node name="VesnasRoom" type="Node2D"]
y_sort_enabled = true
script = ExtResource("1_c6eln")
_sceneNamesToLoad = PackedStringArray("res://scenes/scene_indoor_common_room.tscn", "res://scenes/scene_fight_world_room.tscn")
[node name="Colliders" type="Node2D" parent="."]
position = Vector2(1297, 5292)
scale = Vector2(4, 4)
[node name="SideColliderLeft" type="StaticBody2D" parent="Colliders"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Colliders/SideColliderLeft"]
position = Vector2(-2892, -1168)
shape = SubResource("RectangleShape2D_l0jrn")
[node name="SideColliderRight" type="StaticBody2D" parent="Colliders"]
position = Vector2(4858, 0)
[node name="CollisionShape2D" type="CollisionShape2D" parent="Colliders/SideColliderRight"]
position = Vector2(-2892, -1168)
shape = SubResource("RectangleShape2D_l0jrn")
[node name="TopCollider" type="StaticBody2D" parent="Colliders"]
position = Vector2(2448.75, -595)
[node name="CollisionShape2D" type="CollisionShape2D" parent="Colliders/TopCollider"]
position = Vector2(-2892, -1168)
shape = SubResource("RectangleShape2D_l0jrn")
[node name="BottomCollider" type="StaticBody2D" parent="Colliders"]
position = Vector2(2495.5, 757.75)
[node name="CollisionShape2D" type="CollisionShape2D" parent="Colliders/BottomCollider"]
position = Vector2(-2892, -1168)
shape = SubResource("RectangleShape2D_l0jrn")
[node name="BedCollider" type="StaticBody2D" parent="Colliders"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Colliders/BedCollider"]
position = Vector2(-828.625, -1230.38)
shape = SubResource("RectangleShape2D_2spkc")
[node name="BackWall" type="Node" parent="."]
[node name="Room01Walls2" type="Sprite2D" parent="BackWall"]
modulate = Color(0.16470589, 0, 0.49803922, 1)
z_index = -100
position = Vector2(4992, -487)
scale = Vector2(2, 2)
texture = ExtResource("2_j25a2")
offset = Vector2(-2768, 264)
[node name="Room01Shelf" type="Sprite2D" parent="BackWall"]
modulate = Color(0.16470589, 0, 0.49803922, 1)
z_index = -50
position = Vector2(-1978, -678)
texture = ExtResource("13_11fdt")
region_enabled = true
region_rect = Rect2(1846, 471, 348, 490)
[node name="Vesna" parent="." instance=ExtResource("18_3gevq")]
position = Vector2(-471, 185)
[node name="Camera2D" type="Camera2D" parent="." node_paths=PackedStringArray("_followNode")]
position = Vector2(-1534, -26)
offset = Vector2(0, -200)
zoom = Vector2(0.5, 0.5)
limit_left = -2600
limit_top = -1400
limit_right = 1500
limit_bottom = 1400
editor_draw_limits = true
script = ExtResource("23_408bg")
_followNode = NodePath("../Vesna/CharacterBody2D")
[node name="CanvasLayer" parent="." instance=ExtResource("24_xwo8y")]
[node name="BedInteraction" parent="." node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("8_phqdf")]
position = Vector2(-1415, 489)
_spritesToOutline = [NodePath("Bedsprite")]
_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")
toStatus = 2
[node name="Bedsprite" type="Sprite2D" parent="BedInteraction"]
modulate = Color(0.16470589, 0, 0.49803922, 1)
z_index = -99
position = Vector2(4925, -967)
scale = Vector2(2, 2)
texture = ExtResource("10_hryl5")
offset = Vector2(-2768, 264)
region_rect = Rect2(36.702454, 566.3165, 492.73346, 422.25665)
[node name="DoorInteraction" parent="." node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("8_phqdf")]
position = Vector2(777, 201)
_spritesToOutline = [NodePath("Doorsprite")]
_id = 0
[node name="CollisionShape3D" parent="DoorInteraction/Area2D" index="0"]
shape = SubResource("CircleShape2D_2spkc")
[node name="Doorsprite" type="Sprite2D" parent="DoorInteraction"]
modulate = Color(0.16470589, 0, 0.49803922, 1)
z_index = -99
position = Vector2(5559, -961)
scale = Vector2(2, 2)
texture = ExtResource("11_axs81")
offset = Vector2(-2768, 264)
region_rect = Rect2(1517.5891, 258.72107, 356.62732, 741.81134)
[node name="NightStarter" type="Node" parent="."]
script = ExtResource("10_j25a2")
_sceneIndexToLoad = 1
[node name="CountDayUp" type="Node" parent="NightStarter"]
script = ExtResource("11_heyef")
[node name="PointLight2D" type="PointLight2D" parent="."]
position = Vector2(-630, -568)
scale = Vector2(2.5, 1.3)
color = Color(1, 0.73333335, 0.69803923, 1)
energy = 1.86
texture = ExtResource("14_axs81")
[connection signal="Interacted" from="BedInteraction" to="BedInteraction/QuestCompleter" method="Trigger"]
[connection signal="Interacted" from="BedInteraction" to="NightStarter" method="StartNight"]
[connection signal="Interacted" from="BedInteraction" to="NightStarter/CountDayUp" method="IncreaseDayCount"]
[connection signal="Interacted" from="DoorInteraction" to="." method="LoadScene"]
[connection signal="LoadScene" from="NightStarter" to="." method="LoadSceneAtIndex"]
[editable path="Vesna"]
[editable path="BedInteraction"]
[editable path="DoorInteraction"]
File diff suppressed because it is too large Load Diff
@@ -186,7 +186,7 @@ public partial class PlantBehaviour2D : Node2D
private void SetActiveHarvestablePlant(bool active) private void SetActiveHarvestablePlant(bool active)
{ {
_harvestablePlant.IsActive = active; //_harvestablePlant.IsActive = active;
_harvestablePlant.UpdateVisuals(); _harvestablePlant.UpdateVisuals();
} }
@@ -11,11 +11,11 @@ public partial class ActionAnimationController : Node
#endregion #endregion
[Export] private AllFightersVisual _allFightersVisual = null!; [Export] private AllFightersVisual _allFightersVisual = null!;
[Export] private FightHappeningAnimationContext _animationContext = null!;
public void StateEnter() public void StateEnter()
{ {
_ = HappeningData.actionStaging!.AnimateAction(_allFightersVisual); _ = HappeningData.actionStaging!.AnimateAction(_allFightersVisual,_animationContext);
} }
public void StateExit() public void StateExit()
@@ -12,6 +12,7 @@ public class TargetSelectActionDetail : FighterAction.FighterActionDetail
// settings // settings
public required bool selectEnemy; public required bool selectEnemy;
public required bool selectAlly; public required bool selectAlly;
public required bool aliveOnly;
public VisualRange visualRange = VisualRange.Single; public VisualRange visualRange = VisualRange.Single;
// result // result
@@ -13,7 +13,8 @@ public class AllyAttackAction : FighterAction
public TargetSelectActionDetail targetSelect = new() public TargetSelectActionDetail targetSelect = new()
{ {
selectEnemy = true, selectEnemy = true,
selectAlly = false selectAlly = false,
aliveOnly = true
}; };
public MinigameActionDetail minigameDetail = new(); public MinigameActionDetail minigameDetail = new();
@@ -47,10 +48,11 @@ public class AllyAttackAction : FighterAction
public override void ExecuteAction() public override void ExecuteAction()
{ {
var totalDamage = minigameDetail.damageHits!.Sum(dh => dh); var totalDamage = minigameDetail.damageHits!.Sum(dh => dh);
targetSelect.GetTarget().AddHealth(-totalDamage); targetSelect.GetTarget().ChangeHealth(-totalDamage);
} }
public override async Task AnimateAction(AllFightersVisual allFightersVisual) public override async Task AnimateAction(AllFightersVisual allFightersVisual,
FightHappeningAnimationContext animationContext)
{ {
var currentFighter = HappeningData.fighterTurn.Current; var currentFighter = HappeningData.fighterTurn.Current;
var targetFighter = targetSelect.GetTarget(); var targetFighter = targetSelect.GetTarget();
@@ -63,7 +65,7 @@ public class AllyAttackAction : FighterAction
foreach (var hit in minigameDetail.damageHits!) foreach (var hit in minigameDetail.damageHits!)
{ {
targetFighterVisual.SpawnDamageIndicatorNumber(hit); targetFighterVisual.SpawnDamageIndicatorNumber($"-{hit}");
} }
await currentFighterVisual.AnimatePosToBase(); await currentFighterVisual.AnimatePosToBase();
@@ -18,10 +18,11 @@ public class BlobAttackAction(int damage = 3) : FighterAction
public override void ExecuteAction() public override void ExecuteAction()
{ {
FightWorld.Instance.allyFighters.vesnaFighter.AddHealth(-damage); FightWorld.Instance.allyFighters.vesnaFighter.ChangeHealth(-damage);
} }
public override async Task AnimateAction(AllFightersVisual allFightersVisual) public override async Task AnimateAction(AllFightersVisual allFightersVisual,
FightHappeningAnimationContext animationContext)
{ {
var currentFighter = HappeningData.fighterTurn.Current; var currentFighter = HappeningData.fighterTurn.Current;
var targetFighter = FightWorld.Instance.allyFighters.vesnaFighter; var targetFighter = FightWorld.Instance.allyFighters.vesnaFighter;
@@ -31,7 +32,7 @@ public class BlobAttackAction(int damage = 3) : FighterAction
await currentFighterVisual.AnimatePosToTarget(targetFighterVisual); await currentFighterVisual.AnimatePosToTarget(targetFighterVisual);
_ = targetFighterVisual.AnimateHit(); _ = targetFighterVisual.AnimateHit();
targetFighterVisual.SpawnDamageIndicatorNumber(damage); targetFighterVisual.SpawnDamageIndicatorNumber($"-{damage}");
await currentFighterVisual.AnimatePosToBase(); await currentFighterVisual.AnimatePosToBase();
} }
} }
@@ -0,0 +1,48 @@
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Babushka.scripts.CSharp.Common.Inventory;
using Babushka.scripts.CSharp.Common.Util;
namespace Babushka.scripts.CSharp.Common.Fight.Actions;
public class EatBeetrootAction : FighterAction
{
public override Variant<float, Func<bool>> GetAnimationEnd() => 1;
public override bool NextDetail() => false;
private const int HealAmount = 20;
public override bool ShouldAbort()
{
Debug.Assert(FightWorld.Instance.itemBeetrootToEatForHealth != null,
"Item to eat for health has not been set in the FightWorld autoload");
return !InventoryManager.Instance.playerInventory!.HasItems(new ItemInstance
{ blueprint = FightWorld.Instance.itemBeetrootToEatForHealth });
}
public override async Task AnimateAction(AllFightersVisual allFightersVisual,
FightHappeningAnimationContext animationContext)
{
var fighter = HappeningData.fighterTurn.Current;
var fighterVisual = allFightersVisual.GetVisualForFighter(fighter);
fighterVisual.SpawnDamageIndicatorNumber($"+{HealAmount}");
animationContext.useHealItemIndicator.SpawnIndicator();
await fighterVisual.AnimateHeal();
}
public override void ExecuteAction()
{
var fighter = HappeningData.fighterTurn.Current;
var result = InventoryManager.Instance.playerInventory!.TryRemoveAllItems(
new ItemInstance { blueprint = FightWorld.Instance.itemBeetrootToEatForHealth! });
if (result != InventoryActionResult.Success)
throw new Exception("No Beetroot in inventory. This case should have been handled earlier");
fighter.ChangeHealth(HealAmount);
}
public override AllyActionButton BindToActionButton() => AllyActionButton.Talk; // Temporarily bound to talk button
}
@@ -0,0 +1 @@
uid://b2463q1waqvdu
@@ -117,11 +117,13 @@ public partial class AllFightersVisual : Node
if (targetDetail.selectEnemy) if (targetDetail.selectEnemy)
_fighterVisuals _fighterVisuals
.Where(kv => kv.Key.IsInFormation(HappeningData.enemyFighterFormation)) .Where(kv => kv.Key.IsInFormation(HappeningData.enemyFighterFormation))
.Where(kv => !targetDetail.aliveOnly || kv.Key.IsAlive())// if aliveOnly: take where IsAlive
.ForEach(kv => kv.Value.SetTargetSelectionActive(true)); .ForEach(kv => kv.Value.SetTargetSelectionActive(true));
if (targetDetail.selectAlly) if (targetDetail.selectAlly)
_fighterVisuals _fighterVisuals
.Where(kv => kv.Key.IsInFormation(HappeningData.allyFighterFormation)) .Where(kv => kv.Key.IsInFormation(HappeningData.allyFighterFormation))
.Where(kv => !targetDetail.aliveOnly || kv.Key.IsAlive())// if aliveOnly: take where IsAlive
.ForEach(kv => kv.Value.SetTargetSelectionActive(true)); .ForEach(kv => kv.Value.SetTargetSelectionActive(true));
} }
+2 -1
View File
@@ -10,7 +10,8 @@ public class AllyFighters
maxHealth = 60, maxHealth = 60,
availableActions = availableActions =
[ [
new AllyAttackAction() new AllyAttackAction(),
new EatBeetrootAction()
] ]
}; };
public FightWorld.Fighter chuhaFighter = new() public FightWorld.Fighter chuhaFighter = new()
+11 -6
View File
@@ -222,9 +222,9 @@ public partial class FightHappening : Node
case FightState.ActionCheckDetails: case FightState.ActionCheckDetails:
RequireNotNull(HappeningData.actionStaging); RequireNotNull(HappeningData.actionStaging);
if (ActionAbort()) if (ShouldActionAbort())
ChangeState(FightState.InputActionSelect); ChangeState(FightState.InputActionSelect);
else if (ActionNeededDetail()) else if (DoesActionNeededDetail())
ChangeState(FightState.InputActionDetail); ChangeState(FightState.InputActionDetail);
else else
ChangeState(FightState.ActionExecute); ChangeState(FightState.ActionExecute);
@@ -307,6 +307,11 @@ public partial class FightHappening : Node
HappeningData.enemyFighterFormation.SetFighterAtPosition(emptySlotIndex, fighter); HappeningData.enemyFighterFormation.SetFighterAtPosition(emptySlotIndex, fighter);
HappeningData.fighterTurn.AddAsLast(fighter); HappeningData.fighterTurn.AddAsLast(fighter);
} }
if (GD.RandRange(0, 2) != 0) // 2/3 chance for vesna to start
{
HappeningData.fighterTurn.SpinBack();
}
} }
private void ExecuteNextFighter() private void ExecuteNextFighter()
@@ -328,13 +333,13 @@ public partial class FightHappening : Node
return HappeningData.actionStaging.GetAnimationEnd(); return HappeningData.actionStaging.GetAnimationEnd();
} }
private bool ActionAbort() private bool ShouldActionAbort()
{ {
Debug.Assert(HappeningData.actionStaging != null); Debug.Assert(HappeningData.actionStaging != null);
return HappeningData.actionStaging.MarkedForAbort(); return HappeningData.actionStaging.ShouldAbort();
} }
private bool ActionNeededDetail() private bool DoesActionNeededDetail()
{ {
Debug.Assert(HappeningData.actionStaging != null); Debug.Assert(HappeningData.actionStaging != null);
return HappeningData.actionStaging.NextDetail(); return HappeningData.actionStaging.NextDetail();
@@ -344,7 +349,7 @@ public partial class FightHappening : Node
private void ReviveVesna() private void ReviveVesna()
{ {
var vesnaFighter = FightWorld.Instance.allyFighters.vesnaFighter; var vesnaFighter = FightWorld.Instance.allyFighters.vesnaFighter;
vesnaFighter.health = vesnaFighter.maxHealth; vesnaFighter.Health = vesnaFighter.maxHealth;
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");
} }
@@ -0,0 +1,8 @@
using Godot;
namespace Babushka.scripts.CSharp.Common.Fight;
public partial class FightHappeningAnimationContext : Node
{
[Export] public UsedItemIndicatorVisual useHealItemIndicator = null!;
}
@@ -0,0 +1 @@
uid://cdrjvgm82pxoj
@@ -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);
}
else
{
SpawnEnemies(group, parent);
}
}
}
private void SpawnEnemies(FightWorld.FighterGroup group, Node2D parent)
{
var roamingEnemyGroup = _roamingEnemyGroupPrefab.Instantiate<RoamingEnemyGroup>(); var roamingEnemyGroup = _roamingEnemyGroupPrefab.Instantiate<RoamingEnemyGroup>();
roamingEnemyGroup.Initialize(group, _fightSceneSwitcher); roamingEnemyGroup.Initialize(group, _fightSceneSwitcher);
parent.AddChild(roamingEnemyGroup); 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);
} }
} }
+10 -9
View File
@@ -11,14 +11,15 @@ public static class FightUtils
return self.Where(e => e.IsAlive()); return self.Where(e => e.IsAlive());
} }
public static IEnumerable<FightWorld.Fighter> WhereIsNotInFormation(this IEnumerable<FightWorld.Fighter> self, FighterFormation formation) public static IEnumerable<FightWorld.Fighter> WhereIsNotInFormation(this IEnumerable<FightWorld.Fighter> self,
FighterFormation formation)
{ {
return self.Where(e => !e.IsInFormation(formation)); return self.Where(e => !e.IsInFormation(formation));
} }
public static bool IsAlive(this FightWorld.Fighter self) public static bool IsAlive(this FightWorld.Fighter self)
{ {
return self.GetHealth() > 0; return self.Health > 0;
} }
public static bool IsDead(this FightWorld.Fighter self) public static bool IsDead(this FightWorld.Fighter self)
@@ -26,14 +27,14 @@ public static class FightUtils
return !self.IsAlive(); return !self.IsAlive();
} }
public static int GetHealth(this FightWorld.Fighter self) /// <summary>
/// Changes the health of a fighter
/// </summary>
/// <param name="self">The fighter itself</param>
/// <param name="amount">The amount of health to add. Make negative to remove health</param>
public static void ChangeHealth(this FightWorld.Fighter self, int amount)
{ {
return Math.Max(self.health ?? self.maxHealth, 0); self.Health += amount;
}
public static void AddHealth(this FightWorld.Fighter self, int addHealth)
{
self.health = self.GetHealth() + addHealth;
} }
public static bool IsInFormation(this FightWorld.Fighter self, FighterFormation formation) public static bool IsInFormation(this FightWorld.Fighter self, FighterFormation formation)
+24 -4
View File
@@ -1,5 +1,7 @@
using System;
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 +21,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 +30,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
@@ -56,9 +60,17 @@ public partial class FightWorld : Node
public required int maxHealth; public required int maxHealth;
public required List<FighterAction> availableActions; public required List<FighterAction> availableActions;
public const int MaxActionPoints = 1; public const int MaxActionPoints = 1;
public int? health = null; // null => initialize to full health on spawn
public int actionPointsLeft; public int actionPointsLeft;
private int? _healthBacking = null;
public int Health
{
get => _healthBacking ?? maxHealth;
set => _healthBacking = Math.Clamp(value, 0, maxHealth);
}
public FighterAction AutoSelectAction() public FighterAction AutoSelectAction()
{ {
return availableActions.Random() ?? new FighterAction.Skip(); return availableActions.Random() ?? new FighterAction.Skip();
@@ -81,6 +93,10 @@ 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;
[Export] public ItemResource? itemBeetrootToEatForHealth;
public void ResetFightWorld() public void ResetFightWorld()
{ {
Generate(); Generate();
@@ -89,10 +105,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()
{ {
@@ -162,6 +178,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++)
@@ -189,7 +210,6 @@ public partial class FightWorld : Node
var enemy = new Fighter var enemy = new Fighter
{ {
type = type, type = type,
health = null,
maxHealth = GD.RandRange(8, 20), maxHealth = GD.RandRange(8, 20),
availableActions = availableActions =
[ [
+4 -12
View File
@@ -30,8 +30,6 @@ public abstract class FighterAction
public abstract bool DetailComplete(); public abstract bool DetailComplete();
} }
private bool _abort = false;
#region Shortcuts #region Shortcuts
protected static FightWorld.FightHappeningData HappeningData => protected static FightWorld.FightHappeningData HappeningData =>
@@ -61,19 +59,13 @@ public abstract class FighterAction
/// Animates the action. /// Animates the action.
/// </summary> /// </summary>
/// <param name="allFightersVisual"></param> /// <param name="allFightersVisual"></param>
public virtual async Task AnimateAction(AllFightersVisual allFightersVisual) /// <param name="animationContext"></param>
public virtual async Task AnimateAction(AllFightersVisual allFightersVisual,
FightHappeningAnimationContext animationContext)
{ {
} }
public void MarkAbort() public virtual bool ShouldAbort() => false;
{
_abort = true;
}
public bool MarkedForAbort()
{
return _abort;
}
/// <summary> /// <summary>
/// Returns the FighterActionDetail, that is currently handled. /// Returns the FighterActionDetail, that is currently handled.
@@ -4,13 +4,13 @@ namespace Babushka.scripts.CSharp.Common.Fight;
public partial class FighterDamageIndicatorVisual : Node2D public partial class FighterDamageIndicatorVisual : Node2D
{ {
[Export] private PackedScene _flyingNumberPrefab; [Export] private PackedScene _flyingNumberPrefab = null!;
public void SpawnFlyingNumber(int number) public void SpawnFlyingNumber(string text)
{ {
var flyingNumberInstance = _flyingNumberPrefab.Instantiate<FighterDamageIndicatorFlyingNumber>(); var flyingNumberInstance = _flyingNumberPrefab.Instantiate<FlyingIndicator>();
AddChild(flyingNumberInstance); AddChild(flyingNumberInstance);
flyingNumberInstance.Initialize(number); flyingNumberInstance.Initialize(text);
} }
} }
@@ -99,6 +99,23 @@ public class FighterTurn : IEnumerable<FightWorld.Fighter>
return false; return false;
} }
/// <summary>
/// Sets the current one back
/// This is an expensive operation, because the entire data structure needs to be circled
/// </summary>
public void SpinBack()
{
if (_currentNode == null) return;
var node = _currentNode;
while (node.next != _currentNode)
{
node = node.next;
}
_currentNode = node;
}
public IEnumerator<FightWorld.Fighter> GetEnumerator() public IEnumerator<FightWorld.Fighter> GetEnumerator()
{ {
if (_currentNode == null) return Enumerable.Empty<FightWorld.Fighter>().GetEnumerator(); if (_currentNode == null) return Enumerable.Empty<FightWorld.Fighter>().GetEnumerator();
+19 -12
View File
@@ -42,7 +42,12 @@ public partial class FighterVisual : Node2D
_boundFighter.IsInFormation(HappeningData.enemyFighterFormation) ? -1 : 1, _boundFighter.IsInFormation(HappeningData.enemyFighterFormation) ? -1 : 1,
_boundFighter.IsDead() ? .3f : 1); _boundFighter.IsDead() ? .3f : 1);
healthBarVisual.UpdateHealth(_boundFighter.GetHealth(), _boundFighter.maxHealth); UpdateHealthBarVisuals();
}
private void UpdateHealthBarVisuals()
{
healthBarVisual.UpdateHealth(_boundFighter.Health, _boundFighter.maxHealth);
} }
public void SetTargetSelectionActive(bool value) public void SetTargetSelectionActive(bool value)
@@ -78,6 +83,7 @@ public partial class FighterVisual : Node2D
public async Task AnimateHit() public async Task AnimateHit()
{ {
UpdateHealthBarVisuals();
var tween = GetTree().CreateTween(); var tween = GetTree().CreateTween();
tween.TweenProperty(_squashParent, "scale", new Vector2(1.4f, 0.6f), 0.15); tween.TweenProperty(_squashParent, "scale", new Vector2(1.4f, 0.6f), 0.15);
tween.TweenProperty(_squashParent, "scale", new Vector2(1, 1), 0.4) tween.TweenProperty(_squashParent, "scale", new Vector2(1, 1), 0.4)
@@ -85,17 +91,18 @@ public partial class FighterVisual : Node2D
await ToSignal(tween, "finished"); await ToSignal(tween, "finished");
} }
// Keep for reference for new Heal animation public async Task AnimateHeal()
//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);
//}
public void SpawnDamageIndicatorNumber(int number)
{ {
_fighterDamageIndicatorVisual.SpawnFlyingNumber(number); UpdateHealthBarVisuals();
var tween = GetTree().CreateTween();
tween.TweenProperty(_squashParent, "scale", new Vector2(0.6f, 1.4f), 0.15);
tween.TweenProperty(_squashParent, "scale", new Vector2(1, 1), 0.4)
.SetTrans(Tween.TransitionType.Cubic).SetEase(Tween.EaseType.Out);
await ToSignal(tween, "finished");
}
public void SpawnDamageIndicatorNumber(string text)
{
_fighterDamageIndicatorVisual.SpawnFlyingNumber(text);
} }
} }
@@ -3,13 +3,19 @@ using Godot;
namespace Babushka.scripts.CSharp.Common.Fight; namespace Babushka.scripts.CSharp.Common.Fight;
public partial class FighterDamageIndicatorFlyingNumber : Node2D public partial class FlyingIndicator : Node2D
{ {
[Export] private Label _label; [Export] private Label _label = null!;
[Export] private TextureRect _sprite = null!;
public void Initialize(int number)
public void Initialize(string? text = null, Texture2D? icon = null)
{ {
_label.Text = number.ToString(); _label.Visible = text != null;
_sprite.Visible = icon != null;
if (text != null) _label.Text = text;
if (icon != null) _sprite.Texture = icon;
var tween = CreateTween(); var tween = CreateTween();
var xMovement = GD.RandRange(-150, 150); var xMovement = GD.RandRange(-150, 150);
@@ -9,9 +9,15 @@ public partial class SwitchSceneOnFightEnd : Node
public void OnFightStateEnter(FightHappening.FightState to) public void OnFightStateEnter(FightHappening.FightState to)
{ {
if (to is FightHappening.FightState.PlayerWin if (to is FightHappening.FightState.PlayerWin )
or FightHappening.FightState.EnemyWin)
_ = SwitchSceneAfterTime(2.0f); _ = SwitchSceneAfterTime(2.0f);
if (to is FightHappening.FightState.EnemyWin)
{
_fightSceneSwitcher.ExitFight();
_fightSceneSwitcher.ExitFightWorld();
}
} }
private async Task SwitchSceneAfterTime(float seconds) private async Task SwitchSceneAfterTime(float seconds)
@@ -0,0 +1,15 @@
using Babushka.scripts.CSharp.Common.Inventory;
using Godot;
namespace Babushka.scripts.CSharp.Common.Fight.UI;
public partial class HealButtonVisual : Button
{
[Export] private ItemResource _healItemBlueprint = null!;
public void UpdateText()
{
var healItemsLeft = InventoryManager.Instance.playerInventory!.TotalItemsOfBlueprint(_healItemBlueprint);
Text = $"x{healItemsLeft} - Heal";
}
}
@@ -0,0 +1 @@
uid://71mdwp2m4rta
@@ -0,0 +1,17 @@
using Godot;
namespace Babushka.scripts.CSharp.Common.Fight;
public partial class UsedItemIndicatorVisual : Node2D
{
[Export] private PackedScene _flyingIndicatorPrefab = null!;
[Export] private Texture2D _itemTexture = null!;
public void SpawnIndicator()
{
var flyingNumberInstance = _flyingIndicatorPrefab.Instantiate<FlyingIndicator>();
AddChild(flyingNumberInstance);
flyingNumberInstance.Initialize(icon: _itemTexture);
}
}
@@ -0,0 +1 @@
uid://6nniwfxye8ss
@@ -101,7 +101,8 @@ public partial class InventoryInstance : Node, ISaveable
return InventoryActionResult.DestinationFull; return InventoryActionResult.DestinationFull;
} }
var itemInstance = _slots[slotIndex].itemInstance ?? new ItemInstance { blueprint = newItem.blueprint, amount = 0 }; var itemInstance = _slots[slotIndex].itemInstance ??
new ItemInstance { blueprint = newItem.blueprint, amount = 0 };
var maxStack = itemInstance!.blueprint.maxStack; var maxStack = itemInstance!.blueprint.maxStack;
var freeOnStack = maxStack - itemInstance.amount; var freeOnStack = maxStack - itemInstance.amount;
var moveAmount = Math.Min(freeOnStack, newItem.amount); var moveAmount = Math.Min(freeOnStack, newItem.amount);
@@ -145,6 +146,38 @@ public partial class InventoryInstance : Node, ISaveable
return RemoveItem(inventorySlot, out _); return RemoveItem(inventorySlot, out _);
} }
public InventoryActionResult TryRemoveAllItems(ItemInstance items)
{
var hasItemsCount = TotalItemsOfBlueprint(items.blueprint);
if (hasItemsCount < items.amount)
return InventoryActionResult.SourceDoesNotExist;
var amountToRemove = items.amount;
foreach (var s in _slots)
{
if (s.IsEmpty() || s.itemInstance!.blueprint != items.blueprint)
continue;
var slotItem = s.itemInstance!;
if (slotItem.amount <= amountToRemove)
{
amountToRemove -= slotItem.amount;
s.itemInstance = null;
}
else
{
slotItem.amount -= amountToRemove;
amountToRemove = 0;
}
if (amountToRemove == 0)
break;
}
EmitSignal(SignalName.InventoryContentsChanged);
return InventoryActionResult.Success;
}
public InventoryActionResult AddItemToSlot(ItemInstance itemInstance, int destinationSlot) public InventoryActionResult AddItemToSlot(ItemInstance itemInstance, int destinationSlot)
{ {
if (destinationSlot < 0 || destinationSlot >= _slots.Count) if (destinationSlot < 0 || destinationSlot >= _slots.Count)
@@ -230,5 +263,6 @@ public partial class InventoryInstance : Node, ISaveable
slot.itemInstance = null; slot.itemInstance = null;
} }
} }
#endregion #endregion
} }
@@ -1,12 +1,15 @@
using Babushka.scripts.CSharp.GameEntity.LoadSave;
using Godot; using Godot;
using Newtonsoft.Json.Linq;
namespace Babushka.scripts.CSharp.Common.Inventory; namespace Babushka.scripts.CSharp.Common.Inventory;
// Do not instantiate this resource // Do not instantiate this resource
// But it has to be a resource because Godot // But it has to be a resource because Godot
[GlobalClass] [GlobalClass]
public partial class ItemInstance: Resource public partial class ItemInstance : Resource, IJsonSerializable
{ {
[Export] public ItemResource blueprint; [Export] public required ItemResource blueprint;
[Export] public int amount = 1; [Export] public int amount = 1;
public ItemInstance Clone() public ItemInstance Clone()
@@ -17,4 +20,18 @@ public partial class ItemInstance: Resource
amount = amount amount = amount
}; };
} }
public void LoadFromJson(JObject json)
{
var blueprintPath = json.GetStringValue("blueprint");
blueprint = GD.Load<ItemResource>(blueprintPath);
amount = json.GetIntValue("amount");
}
public JObject SaveToJson()
{
return new(
new JProperty("blueprint", blueprint.ResourcePath),
new JProperty("amount", amount));
}
} }
@@ -1,20 +1,16 @@
using Babushka.scripts.CSharp.Common.Savegame; using Babushka.scripts.CSharp.Common.Savegame;
using Babushka.scripts.CSharp.GameEntity.Entities;
using Babushka.scripts.CSharp.GameEntity.LoadSave;
using Godot; using Godot;
using Godot.Collections; using Godot.Collections;
using Newtonsoft.Json.Linq;
namespace Babushka.scripts.CSharp.Common.Inventory; namespace Babushka.scripts.CSharp.Common.Inventory;
public partial class ItemOnGround2D : Node, ISaveable public partial class ItemOnGround2D : Node2D
{ {
private ItemInstance _itemInstance; private ItemInstance _itemInstance;
[Export] public bool IsActive = true;
[Export] private bool _infiniteSupply = false;
[Export] private int _finiteSupply = 1;
[Export] private bool _saveToDisk = true;
private int pickUpCounter = 0;
[Signal] public delegate void SuccessfulPickUpEventHandler(); [Signal] public delegate void SuccessfulPickUpEventHandler();
@@ -34,16 +30,12 @@ public partial class ItemOnGround2D : Node, ISaveable
public override void _Ready() public override void _Ready()
{ {
LoadFromSaveData();
UpdateVisuals(); UpdateVisuals();
_pickupErrorLabel.Text = ""; _pickupErrorLabel.Text = "";
} }
public void TryPickUp() public void TryPickUp()
{ {
if (!IsActive)
return;
var result = InventoryManager.Instance.CollectItem(itemInstance.Clone()); var result = InventoryManager.Instance.CollectItem(itemInstance.Clone());
EmitSignal(SignalName.SuccessfulPickUp); EmitSignal(SignalName.SuccessfulPickUp);
if (result == InventoryActionResult.Success) if (result == InventoryActionResult.Success)
@@ -58,16 +50,7 @@ public partial class ItemOnGround2D : Node, ISaveable
private void Pickup() private void Pickup()
{ {
if (!_infiniteSupply) // remove from entity manager
{
pickUpCounter++;
if (pickUpCounter >= _finiteSupply)
{
QueueFree();
}
UpdateSaveData();
}
} }
private void FailToPickup() private void FailToPickup()
@@ -80,9 +63,6 @@ public partial class ItemOnGround2D : Node, ISaveable
public void UpdateVisuals() public void UpdateVisuals()
{ {
if (!IsActive)
return;
_iconSprite.Texture = itemInstance?.blueprint?.icon; _iconSprite.Texture = itemInstance?.blueprint?.icon;
if (_iconSprite.Texture == null) if (_iconSprite.Texture == null)
{ {
@@ -94,7 +74,22 @@ public partial class ItemOnGround2D : Node, ISaveable
} }
} }
// todo: What do we do with instances that are created at runtime? /*
protected override void LoadEntity(JObject json)
{
base.LoadEntity(json);
_itemInstance.LoadFromJson(json.GetObject("item"));
}
protected override void SaveEntity(JObject json)
{
base.SaveEntity(json);
json["item"] = _itemInstance.SaveToJson();
}
*/
// old save
/*
public void UpdateSaveData() public void UpdateSaveData()
{ {
if (!_saveToDisk) if (!_saveToDisk)
@@ -157,5 +152,5 @@ public partial class ItemOnGround2D : Node, ISaveable
} }
} }
} }
} }*/
} }
@@ -1,4 +1,6 @@
using Godot; using Babushka.scripts.CSharp.GameEntity.LoadSave;
using Godot;
using Newtonsoft.Json.Linq;
namespace Babushka.scripts.CSharp.Common.Inventory; namespace Babushka.scripts.CSharp.Common.Inventory;
@@ -0,0 +1,27 @@
using System;
using Babushka.scripts.CSharp.GameEntity.LoadSave;
using Newtonsoft.Json.Linq;
namespace Babushka.scripts.CSharp.GameEntity.Entities;
public class Entity
{
public long id;
public virtual string EntityType => "";
public Entity()
{
id = new Random().NextInt64();
}
public virtual void SaveEntity(JObject json)
{
json["id"] = id;
json["type"] = EntityType;
}
public virtual void LoadEntity(JObject json)
{
id = json.GetLongValue("id");
}
}
@@ -0,0 +1 @@
uid://hnmpt23ovfgl
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Transactions;
using Newtonsoft.Json.Linq;
namespace Babushka.scripts.CSharp.GameEntity.Entities;
public class LoadedScenesEntity : Entity
{
private HashSet<string> _loadedScenes = new();
public override string EntityType => OWN_TYPE_NAME;
public const string OWN_TYPE_NAME = "LoadedScenesEntity";
public void AddScene(string sceneName) => _loadedScenes.Add(sceneName);
public bool WasSceneLoaded(string sceneName) => _loadedScenes.Contains(sceneName);
public override void SaveEntity(JObject json)
{
base.SaveEntity(json);
json["scenes"] = new JArray(_loadedScenes);
}
public override void LoadEntity(JObject json)
{
base.LoadEntity(json);
JArray array = (JArray?) json["scenes"] ?? throw new Exception("No scenes found in LoadedScenesEntity.");
_loadedScenes = array.ToObject<HashSet<string>>()!;
}
}
@@ -0,0 +1 @@
uid://rabb1y637cm5
@@ -0,0 +1,32 @@
using Babushka.scripts.CSharp.GameEntity.LoadSave;
using Godot;
using Newtonsoft.Json.Linq;
namespace Babushka.scripts.CSharp.GameEntity.Entities;
public abstract class PositionalEntity : Entity
{
public Vector2 position;
public string sceneName = "none";
public override void SaveEntity(JObject json)
{
base.SaveEntity(json);
json["posx"] = position.X;
json["posy"] = position.Y;
json["scene"] = sceneName;
}
public override void LoadEntity(JObject json)
{
base.LoadEntity(json);
position = new Vector2(
json.GetFloatValue("posx"),
json.GetFloatValue("posy"));
sceneName = json.GetStringValue("scene");
}
// Deals with Instantiation of the node
public abstract void InstantiateEntityNode(Node2D parent);
}
@@ -0,0 +1 @@
uid://bs38dulqv7sop
@@ -0,0 +1,23 @@
using Babushka.scripts.CSharp.GameEntity.Management;
using Godot;
namespace Babushka.scripts.CSharp.GameEntity.Entities;
public class TrashEntity : PositionalEntity
{
public override string EntityType => OWN_TYPE_NAME;
public const string OWN_TYPE_NAME = "TrashEntity";
private EntityNodeCreator _creator;
public TrashEntity()
{
}
public override void InstantiateEntityNode(Node2D parent)
{
if(_creator == null) _creator = EntityManager.Instance.NodeCreator;
var entityNode = _creator.InstantiateNode(EntityType);
parent.AddChild(entityNode);
entityNode.GlobalPosition = position;
}
}
@@ -0,0 +1 @@
uid://c31k34epunk5t
@@ -0,0 +1,16 @@
using Babushka.scripts.CSharp.GameEntity.Entities;
using Godot;
namespace Babushka.scripts.CSharp.GameEntity.EntityNodes;
public partial class TrashEntityNode : Node2D
{
private TrashEntity _trashEntity;
public void Initialize(TrashEntity trashEntity)
{
_trashEntity = trashEntity;
}
}
@@ -0,0 +1 @@
uid://d3n8kwva4pxx5
@@ -0,0 +1,26 @@
using Babushka.scripts.CSharp.GameEntity.Entities;
using Babushka.scripts.CSharp.GameEntity.Management;
using Godot;
namespace Babushka.scripts.CSharp.GameEntity.EntityPlacer;
public partial class TrashEntityPlacer : Node2D
{
private string _trashEntityType = TrashEntity.OWN_TYPE_NAME;
public override void _Ready()
{
string sceneName = EntityManager.Instance.CurrentEntitySceneContainer!.sceneName;
var loadedScenesEntity = EntityManager.Instance.GetUniqueEntity<LoadedScenesEntity>();
if (!loadedScenesEntity.WasSceneLoaded(sceneName))
{
TrashEntity entity = new TrashEntity();
entity.sceneName = sceneName;
entity.position = GlobalPosition;
EntityManager.Instance.AddEntity(entity);
}
QueueFree();
}
}
@@ -0,0 +1 @@
uid://bilg7e33usxuv
@@ -0,0 +1,44 @@
using Newtonsoft.Json.Linq;
namespace Babushka.scripts.CSharp.GameEntity.LoadSave;
public static class EntityLoadSaveUtil
{
private static void AssertTokenType(this JObject json, string key, JTokenType type)
{
var token = json[key];
if (token == null) throw new MalformedJsonException(json, key, "does not exist");
//if (!token.HasValues) throw new MalformedJsonException(json, key, "has no value");
if (token.Type != type) throw new MalformedJsonException(json, key, $"is not of type {type}");
}
public static long GetLongValue(this JObject json, string key)
{
AssertTokenType(json, key, JTokenType.Integer);
return json.Value<long>(key);
}
public static int GetIntValue(this JObject json, string key)
{
AssertTokenType(json, key, JTokenType.Integer);
return json.Value<int>(key);
}
public static float GetFloatValue(this JObject json, string key)
{
AssertTokenType(json, key, JTokenType.Float);
return json.Value<float>(key);
}
public static JObject GetObject(this JObject json, string key)
{
AssertTokenType(json, key, JTokenType.Object);
return json.Value<JObject>(key)!;
}
public static string GetStringValue(this JObject json, string key)
{
AssertTokenType(json, key, JTokenType.String);
return json.Value<string>(key)!;
}
}
@@ -0,0 +1 @@
uid://ccu6p418viliu
@@ -0,0 +1,9 @@
using Newtonsoft.Json.Linq;
namespace Babushka.scripts.CSharp.GameEntity.LoadSave;
public interface IJsonSerializable
{
public void LoadFromJson(JObject json);
public JObject SaveToJson();
}
@@ -0,0 +1 @@
uid://cuma3347l55mb
@@ -0,0 +1,12 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
namespace Babushka.scripts.CSharp.GameEntity.LoadSave;
public class MalformedJsonException(JObject actualJson, string key, string problem) : Exception
{
public override string Message => $"JsonObject was malformed: {key} {problem}";
public override IDictionary Data => new Dictionary<string, JObject> { { "json", actualJson } };
}
@@ -0,0 +1 @@
uid://d1o066hh84ow
@@ -0,0 +1,157 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Babushka.scripts.CSharp.GameEntity.Entities;
using Godot;
using Newtonsoft.Json.Linq;
using Entity = Babushka.scripts.CSharp.GameEntity.Entities.Entity;
using PositionalEntity = Babushka.scripts.CSharp.GameEntity.Entities.PositionalEntity;
namespace Babushka.scripts.CSharp.GameEntity.Management;
/// <summary>
/// Manages the lifecycle and interactions of all entities within the game, including their creation, retrieval,
/// and organization. The EntityManager serves as a centralized hub for managing both standard and positional entities.
/// </summary>
public partial class EntityManager : Node
{
public static EntityManager Instance;
[Export] private EntityNodeCreator _nodeCreator = null!;
[Export] private string saveDirectory = "user://save_data/";
private EntitySceneContainer? _currentEntitySceneContainer;
private readonly List<Entity> _allEntities = new();
public IEnumerable<Entity> AllEntities => _allEntities;
public IEnumerable<PositionalEntity> AllPositionalEntities => _allEntities.OfType<PositionalEntity>();
public EntitySceneContainer? CurrentEntitySceneContainer => _currentEntitySceneContainer;
public EntityNodeCreator NodeCreator => _nodeCreator;
public override void _EnterTree()
{
Instance = this;
Load();
}
public override void _Input(InputEvent @event)
{
// for debugging purposes
if (@event.IsActionPressed("DebugEntities"))
{
GD.Print("Entities:");
foreach (var entity in AllEntities)
{
GD.Print(entity.EntityType + " " + entity.id);
}
}
if(@event.IsActionPressed("SaveGame")) Save();
}
public void Save()
{
JArray array = new JArray();
foreach (var entity in AllEntities)
{
JObject saveData = new JObject();
entity.SaveEntity(saveData);
array.Add(saveData);
}
using var SaveFile = FileAccess.Open(saveDirectory + "save.json", FileAccess.ModeFlags.Write);
SaveFile.StoreString(array.ToString());
}
public void Load()
{
using var saveFile = FileAccess.Open(saveDirectory + "save.json", FileAccess.ModeFlags.Read);
if (saveFile == null) return;
JArray array = JArray.Parse(saveFile.GetAsText());
foreach (var token in array)
{
var jobj = (JObject)token;
if (jobj == null) continue;
if (jobj.TryGetValue("type", out var entityType))
{
string entityTypeString = (string) entityType!;
Entity entity = InitializeEntity(entityTypeString);
entity.LoadEntity(jobj);
AddEntity(entity);
}
}
}
private Entity InitializeEntity(string type)
{
Entity entity = type switch
{
TrashEntity.OWN_TYPE_NAME => new TrashEntity(),
LoadedScenesEntity.OWN_TYPE_NAME => new LoadedScenesEntity(),
_ => throw new Exception($"Trying to load unknown entity type: {type}")
};
return entity;
}
#region ENTITY MANAGEMENT
/// <summary>
/// Adds an entity to the list of managed entities. If the entity is a positional entity
/// and its scene matches the current scene container, it is also instantiated in the scene.
/// </summary>
/// <param name="entity">The entity to be added to the manager.</param>
public void AddEntity(Entity entity)
{
if (!_allEntities.Contains(entity))
_allEntities.Add(entity);
if(entity is PositionalEntity positionalEntity && positionalEntity.sceneName == _currentEntitySceneContainer?.sceneName)
InstantiatePositionalEntityNode(positionalEntity);
}
private void InstantiatePositionalEntityNode(PositionalEntity entity)
{
if(_currentEntitySceneContainer == null) return;
entity.InstantiateEntityNode(_currentEntitySceneContainer);
}
/// <summary>
/// Retrieves the first entity of the specified type from the list of managed entities.
/// If no such entity exists, creates a new instance of the specified type, adds it to the manager, and returns it.
/// </summary>
/// <typeparam name="T">The type of entity to retrieve or create. Must inherit from the Entity class and have a parameterless constructor.</typeparam>
/// <returns>The first entity of the specified type or a newly created entity of that type if none were found.</returns>
public T GetUniqueEntity<T>() where T : Entity, new()
{
var result = AllEntities.OfType<T>().FirstOrDefault();
if (result == null)
{
var newEntity = new T();
AddEntity(newEntity);
result = newEntity;
}
return result;
}
#endregion
#region SCENE CONTAINER ACCESS
public void SetSceneContainer(EntitySceneContainer sceneContainer)
{
_currentEntitySceneContainer = sceneContainer;
}
public void UnsetSceneContainer()
{
_currentEntitySceneContainer = null;
}
#endregion
}
@@ -0,0 +1 @@
uid://umop2b1m1qm8
@@ -0,0 +1,14 @@
using PositionalEntity = Babushka.scripts.CSharp.GameEntity.Entities.PositionalEntity;
namespace Babushka.scripts.CSharp.GameEntity.Management;
public static class EntityManagerUtil
{
public static void AddIfNeeded(this EntitySceneContainer? self, PositionalEntity entity)
{
if(self == null) return;
if(self.sceneName != entity.sceneName) return;
self.AddEntity(entity);
}
}
@@ -0,0 +1 @@
uid://dc3283h7sx4cl
@@ -0,0 +1,25 @@
using System;
using Godot;
using Godot.Collections;
namespace Babushka.scripts.CSharp.GameEntity.Management;
public partial class EntityNodeCreator : Node
{
[Export] private Dictionary<string, PackedScene> _entityPrefabs;
public Node2D InstantiateNode(string type)
{
if (string.IsNullOrEmpty(type))
{
throw new NullReferenceException("The type provided for Node instantiation cannot be null or empty.");
}
if (!_entityPrefabs.ContainsKey(type))
{
throw new Exception($"The type provided for Node instantiation ({type}) is not specified in the EntityNodeCreator dictionary.");
}
return _entityPrefabs[type].Instantiate<Node2D>();
}
}
@@ -0,0 +1 @@
uid://bogqp274y1pgr
@@ -0,0 +1,48 @@
using System.Linq;
using Babushka.scripts.CSharp.GameEntity.Entities;
using Godot;
using PositionalEntity = Babushka.scripts.CSharp.GameEntity.Entities.PositionalEntity;
namespace Babushka.scripts.CSharp.GameEntity.Management;
public partial class EntitySceneContainer : Node2D
{
[Export] public string sceneName = "none";
public override void _EnterTree()
{
EntityManager.Instance.SetSceneContainer(this);
}
public override void _ExitTree()
{
EntityManager.Instance.Save();
EntityManager.Instance.UnsetSceneContainer();
}
public override void _Ready()
{
AddAllEntities();
CallDeferred(nameof(RegisterWithScenesEntity));
}
private void RegisterWithScenesEntity()
{
var loadedScenesEntity = EntityManager.Instance.GetUniqueEntity<LoadedScenesEntity>();
loadedScenesEntity.AddScene(sceneName);
}
public void AddAllEntities()
{
foreach (var positionalEntity in EntityManager.Instance.AllPositionalEntities.Where(x => x.sceneName == sceneName))
{
AddEntity(positionalEntity);
}
}
public void AddEntity(PositionalEntity entity)
{
entity.InstantiateEntityNode(this);
}
}
@@ -0,0 +1 @@
uid://ca1pg6k3gn47y
+9
View File
@@ -12,6 +12,9 @@ uniform float brightness_add : hint_range(-1.0, 1.0) = 0.0;
// Contrast multiplier in RGB space. 1.0 means no change. // Contrast multiplier in RGB space. 1.0 means no change.
uniform float contrast_mult : hint_range(0.0, 2.0) = 1.0; uniform float contrast_mult : hint_range(0.0, 2.0) = 1.0;
//Cached Color value to reapply modulate
varying vec4 modulate;
// Converts an RGB color to HSV. // Converts an RGB color to HSV.
vec3 rgb2hsv(vec3 c) { vec3 rgb2hsv(vec3 c) {
float cMax = max(max(c.r, c.g), c.b); float cMax = max(max(c.r, c.g), c.b);
@@ -65,6 +68,10 @@ vec3 hsv2rgb(vec3 c) {
return rgb + vec3(m); return rgb + vec3(m);
} }
void vertex(){
modulate = COLOR;
}
void fragment() { void fragment() {
// Get the original texture color. // Get the original texture color.
vec4 tex_color = texture(TEXTURE, UV); vec4 tex_color = texture(TEXTURE, UV);
@@ -89,4 +96,6 @@ void fragment() {
// Output the final color while preserving the original alpha. // Output the final color while preserving the original alpha.
COLOR = vec4(col, tex_color.a); COLOR = vec4(col, tex_color.a);
//reapply vertex color value to keep modulate changes
COLOR = COLOR * modulate;
} }
+6
View File
@@ -2,8 +2,14 @@ shader_type canvas_item;
uniform vec2 tiling_scale = vec2(5.0, 5.0); uniform vec2 tiling_scale = vec2(5.0, 5.0);
uniform sampler2D noise : repeat_enable; uniform sampler2D noise : repeat_enable;
varying vec4 modulate;
void vertex() {
modulate = COLOR;
}
void fragment() { void fragment() {
vec2 uv = vec2(UV.x * tiling_scale.x, UV.y * tiling_scale.y); // Change 10.0 to control tiling scale vec2 uv = vec2(UV.x * tiling_scale.x, UV.y * tiling_scale.y); // Change 10.0 to control tiling scale
COLOR = texture(TEXTURE, fract(uv)); COLOR = texture(TEXTURE, fract(uv));
COLOR = COLOR * modulate;
} }
+8
View File
@@ -26,6 +26,9 @@ uniform float heightOffset : hint_range(0.0, 1.0);
// With the offset value, you can if you want different moves for each asset. Just put a random value (1, 2, 3) in the editor. Don't forget to mark the material as unique if you use this // With the offset value, you can if you want different moves for each asset. Just put a random value (1, 2, 3) in the editor. Don't forget to mark the material as unique if you use this
uniform float offset = 0; uniform float offset = 0;
// caching color settings to reapply modulate value
varying vec4 modulate;
float getWind(vec2 vertex, vec2 uv, float time){ float getWind(vec2 vertex, vec2 uv, float time){
float diff = pow(maxStrength - minStrength, 2.0); float diff = pow(maxStrength - minStrength, 2.0);
float strength = clamp(minStrength + diff + sin(time / interval) * diff, minStrength, maxStrength) * strengthScale; float strength = clamp(minStrength + diff + sin(time / interval) * diff, minStrength, maxStrength) * strengthScale;
@@ -47,8 +50,13 @@ float noise(vec2 x) {
} }
void vertex() { void vertex() {
modulate = COLOR;
vec4 pos = MODEL_MATRIX * vec4(0.0, 0.0, 0.0, 1.0); vec4 pos = MODEL_MATRIX * vec4(0.0, 0.0, 0.0, 1.0);
//float time = TIME * speed + sin(VERTEX.x * noise(VERTEX.xy) * offset); //float time = TIME * speed + sin(VERTEX.x * noise(VERTEX.xy) * offset);
float time = TIME * speed + sin(pos.x * offset) * cos( pos.x * offset) ; float time = TIME * speed + sin(pos.x * offset) * cos( pos.x * offset) ;
VERTEX.x += getWind(VERTEX.xy, UV, time); VERTEX.x += getWind(VERTEX.xy, UV, time);
} }
void fragment() {
COLOR = modulate * COLOR;
}