Compare commits

...

14 Commits

Author SHA1 Message Date
jonathan b76f639120 Added flying beet to the ui when used 2025-12-16 18:56:18 +01:00
jonathan b523591e84 When beetroot is in inventory the player can heal 2025-12-11 17:13:28 +01:00
jonathan 4be0092cfb Defeated enemygroups now drop a beet_seed 2025-12-11 15:09:28 +01:00
Jonathan 0434667c22 Merge pull request 'feature/bugfixes_And_Polish' (#39) from feature/bugfixes_And_Polish into develop
Reviewed-on: #39
Reviewed-by: Jonathan <cblech@ymail.com>
2025-12-09 15:20:36 +01:00
kziolkowski e51e0a24d2 🐛 fixed dialogic bugs and moved trash items out of the way 2025-12-06 21:46:54 +01:00
kziolkowski 7bb523f9e7 🐛 harvested plants don't come back on scene reload 2025-12-06 20:47:56 +01:00
kziolkowski a3651d6268 deleted unused code 2025-12-06 20:40:47 +01:00
kziolkowski 0892a13e66 🐛 fixed beet harvesting 2025-12-06 20:36:22 +01:00
kziolkowski 61caa6eea6 Merge branch 'refs/heads/develop' into feature/bugfixes_And_Polish 2025-12-06 19:59:31 +01:00
kziolkowski 2ec693eed2 Merge pull request 'Added visual feedback when hitting a region in the minigame' (#37) from minigame_hit_feedback into develop
Reviewed-on: #37
Reviewed-by: kziolkowski <katharina.ziolkowski@gmail.com>
2025-12-06 19:54:11 +01:00
kziolkowski b7d1f9d8d5 Merge branch 'develop' into minigame_hit_feedback 2025-12-06 19:54:05 +01:00
kziolkowski 12bf632932 Merge pull request 'Added randomnes into attack minigame' (#36) from minigame_variation into develop
Reviewed-on: #36
Reviewed-by: kziolkowski <katharina.ziolkowski@gmail.com>
2025-12-06 19:53:49 +01:00
kziolkowski 996470f5e6 🐛 fixed beets double spawning bug 2025-12-04 23:45:35 +01:00
jonathan aa4f1c55b5 Added visual feedback when hitting a region in the minigame 2025-12-04 21:18:47 +01:00
40 changed files with 446 additions and 2443 deletions
@@ -3,19 +3,20 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://ccrnmx6bd842k"
path="res://.godot/imported/farm fäulnis blobs.png-afe542d3466e5ab2e79933f2f163e667.ctex"
path.s3tc="res://.godot/imported/farm fäulnis blobs.png-afe542d3466e5ab2e79933f2f163e667.s3tc.ctex"
metadata={
"vram_texture": false
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://art/characters/farm fäulnis blobs.png"
dest_files=["res://.godot/imported/farm fäulnis blobs.png-afe542d3466e5ab2e79933f2f163e667.ctex"]
dest_files=["res://.godot/imported/farm fäulnis blobs.png-afe542d3466e5ab2e79933f2f163e667.s3tc.ctex"]
[params]
compress/mode=0
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
@@ -23,7 +24,7 @@ compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
@@ -37,4 +38,4 @@ process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
detect_3d/compress_to=0
+1
View File
@@ -12,3 +12,4 @@ ifquest res://resources/quests/demo/2_collect_ducks.tres, 1:
Yeli: Have you collected all the ducks yet?
[end_timeline]
Yeli doesn't seem to have anything to say...
[end_timeline]
+6 -3
View File
@@ -53,7 +53,7 @@
[sub_resource type="CircleShape2D" id="CircleShape2D_at1n1"]
resource_local_to_scene = true
radius = 500.0
radius = 300.0
[sub_resource type="SpriteFrames" id="SpriteFrames_f6hss"]
animations = [{
@@ -205,6 +205,7 @@ z_index = 1
y_sort_enabled = true
script = ExtResource("1_hn8at")
_sprite = NodePath("TalkingControl/AnimatedSprite")
_retriggerSameTimeline = true
[node name="InteractionArea" parent="." node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("42_ahrat")]
position = Vector2(0, -450)
@@ -244,9 +245,11 @@ stream = SubResource("AudioStreamRandomizer_ngji7")
bus = &"SFX"
script = ExtResource("50_a7v1a")
[connection signal="FinishedTalking" from="." to="InteractionArea" method="SetActiveInverse"]
[connection signal="Talking" from="." to="Dialogic starter" method="open"]
[connection signal="Interacted" from="InteractionArea" to="." method="ToggleTalking"]
[connection signal="Interacted" from="InteractionArea" to="." method="StartTalking"]
[connection signal="Interacted" from="InteractionArea" to="InteractionArea" method="ToggleActive"]
[connection signal="timelineEnded" from="Dialogic starter" to="." method="StopTalking"]
[connection signal="timelineEnded" from="Dialogic starter" to="InteractionArea" method="ToggleActive"]
[connection signal="timelineEnded" from="DialogicToggle" to="." method="ToggleTalking"]
[connection signal="timelineStarted" from="DialogicToggle" to="SFX/AudioStreamPlayer" method="PlayOneShot"]
+1
View File
@@ -215,6 +215,7 @@ Payload = 3
[connection signal="Interacted" from="GrowingInteractionArea" to="." method="Grow"]
[connection signal="SuccessfulPickUp" from="ReadyPlantInventoryItem" to="." method="queue_free"]
[connection signal="Interacted" from="ReadyPlantInventoryItem/PickupInteractionArea" to="." method="Harvest"]
[editable path="GrowingInteractionArea"]
[editable path="ReadyPlantInventoryItem"]
-3
View File
@@ -48,9 +48,6 @@ shape = SubResource("CircleShape2D_hiixr")
[node name="SpawnWithItem" parent="ReadyPlantInventoryItem" index="0"]
_blueprint = ExtResource("3_agmuy")
[node name="PickupInteractionArea" parent="ReadyPlantInventoryItem" index="3"]
_active = false
[node name="CollisionShape3D" parent="ReadyPlantInventoryItem/PickupInteractionArea/Area2D" index="0"]
shape = SubResource("CircleShape2D_ae08q")
+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="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")
_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="."]
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="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"]
script = ExtResource("1_tnyce")
_itemToDropByEnemyGroup = ExtResource("2_lxs0o")
itemBeetrootToEatForHealth = ExtResource("3_008v8")
+24 -2
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="Texture2D" uid="uid://8sr11ex30n0m" path="res://art/mockups/Kenney_Backgrounds/Samples/uncolored_hills.png" id="2_7b2ri"]
@@ -38,6 +38,7 @@
[ext_resource type="Resource" uid="uid://d1uuxp1lp4aro" path="res://resources/items/tomato_seed.tres" id="35_64mdn"]
[ext_resource type="Texture2D" uid="uid://65e44yde224q" path="res://art/farm/Babushka_house_01.png" id="36_e5b7x"]
[ext_resource type="Resource" uid="uid://duq7tshxv6uhp" path="res://resources/items/beet_seed.tres" id="36_fv1t2"]
[ext_resource type="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://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"]
@@ -1030,7 +1031,6 @@ y_sort_enabled = true
[node name="Yeli" parent="YSorted" instance=ExtResource("24_wtdui")]
position = Vector2(6403, 3362)
_timelinesToPlay = PackedStringArray("yeli_quest_select")
_retriggerSameTimeline = true
[node name="Vesna" parent="YSorted" instance=ExtResource("1_7wfwe")]
z_index = 1
@@ -1118,6 +1118,24 @@ shape = SubResource("CircleShape2D_tm0yg")
[node name="Icon" parent="YSorted/SeedPickup" index="4"]
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")]
position = Vector2(10705, 2257)
_finiteSupply = 3
@@ -2375,6 +2393,7 @@ position = Vector2(-5016, 3361)
visible = false
z_index = 1
y_sort_enabled = true
position = Vector2(-204, -5186)
[node name="trashObject" parent="YSorted/trash" instance=ExtResource("53_ycj14")]
z_index = 0
@@ -2582,6 +2601,7 @@ script = ExtResource("80_w1kgo")
[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/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="InteractedTool" from="YSorted/Farm visuals/Static/EnterHouseInteraction" to="." method="LoadSceneAtIndex"]
[connection signal="InteractedTool" from="YSorted/Blocker/InteractionArea" to="." method="LoadSceneAtIndex"]
@@ -2606,6 +2626,8 @@ script = ExtResource("80_w1kgo")
[editable path="YSorted/RakeGenericPickup/PickupInteractionArea"]
[editable path="YSorted/SeedPickup"]
[editable path="YSorted/SeedPickup/PickupInteractionArea"]
[editable path="YSorted/BeetPickup"]
[editable path="YSorted/BeetPickup/PickupInteractionArea"]
[editable path="YSorted/SeedPickup2"]
[editable path="YSorted/SeedPickup2/PickupInteractionArea"]
[editable path="YSorted/Blocker/InteractionArea"]
File diff suppressed because it is too large Load Diff
+18 -3
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=14 format=3 uid="uid://cjshlwk8ajpnp"]
[gd_scene load_steps=18 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://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="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="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="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"]
@@ -13,20 +14,28 @@
[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://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="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="FightHappening" type="Node" parent="."]
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")
_allFightersVisual = NodePath("../FightVisuals")
_animationContext = NodePath("AnimationContext")
[node name="StateReactionActionAnimation" type="Node" parent="ActionAnimationController"]
script = ExtResource("4_ydj1i")
_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="FightSetup" type="Node2D" parent="."]
@@ -146,7 +155,7 @@ theme_override_constants/margin_bottom = 10
[node name="Talk Button" type="Button" parent="ActionSelect/BottomPanel/VBoxContainer/MarginContainer/HBoxContainer/MarginContainer3"]
layout_mode = 2
theme_override_font_sizes/font_size = 41
text = "Talk"
text = "Heal"
[node name="MarginContainer4" type="MarginContainer" parent="ActionSelect/BottomPanel/VBoxContainer/MarginContainer/HBoxContainer"]
layout_mode = 2
@@ -206,6 +215,12 @@ offset_right = 794.0
offset_bottom = -472.0
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="FightVisuals" method="FightHappeningStateChange"]
[connection signal="SignalTransitionState" from="FightHappening" to="ActionSelect/StateReactionInputActionSelect" method="FightHappeningStateTransitioned"]
+11 -13
View File
@@ -25,7 +25,6 @@
[ext_resource type="Shader" uid="uid://xnky830dtfsn" path="res://shader/repeat_texture.gdshader" id="23_2ouqg"]
[ext_resource type="PackedScene" uid="uid://c25udixd5m6l0" path="res://prefabs/characters/Vesna.tscn" id="24_ffcio"]
[ext_resource type="Resource" uid="uid://dlcmqfjvgphqu" path="res://resources/items/rake.tres" id="25_3h260"]
[ext_resource type="Resource" uid="uid://cndd64batns31" path="res://resources/items/wateringcan.tres" id="26_1bhpp"]
[ext_resource type="Shader" uid="uid://braevmqauoek7" path="res://shader/swaying_plant.gdshader" id="27_txtka"]
[ext_resource type="Texture2D" uid="uid://dgavbfci8x178" path="res://art/nature/grass/grass-1.png" id="28_ejigw"]
[ext_resource type="Texture2D" uid="uid://h2b5aufaaw7w" path="res://art/nature/grass/grass-2.png" id="29_pjemw"]
@@ -41,6 +40,7 @@
[ext_resource type="Script" uid="uid://dbu8afaiohpdh" path="res://scripts/CSharp/Common/Fight/FightRoomSceneSetup.cs" id="40_cvg1r"]
[ext_resource type="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://dpbbroif2tnil" path="res://prefabs/interactions/generic_item_on_ground_2d.tscn" id="41_x3yi1"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ruj2u"]
shader = ExtResource("16_0fard")
@@ -64,9 +64,9 @@ colors = PackedColorArray(0.348791, 0.400092, 0.435264, 1, 0.219333, 0.251087, 0
[sub_resource type="FastNoiseLite" id="FastNoiseLite_d5x6a"]
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_d53cn"]
seamless = true
color_ramp = SubResource("Gradient_663j1")
noise = SubResource("FastNoiseLite_d5x6a")
color_ramp = SubResource("Gradient_663j1")
seamless = true
[sub_resource type="ShaderMaterial" id="ShaderMaterial_k0jkw"]
shader = ExtResource("23_2ouqg")
@@ -84,9 +84,9 @@ fractal_gain = 0.795
domain_warp_enabled = true
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_pjpt5"]
seamless = true
color_ramp = SubResource("Gradient_eryax")
noise = SubResource("FastNoiseLite_wgikv")
color_ramp = SubResource("Gradient_eryax")
seamless = true
[sub_resource type="ShaderMaterial" id="ShaderMaterial_yvxfs"]
shader = ExtResource("27_txtka")
@@ -765,7 +765,6 @@ y_sort_enabled = true
[node name="Vesna" parent="YSorted" instance=ExtResource("24_ffcio")]
position = Vector2(8202, 1950)
_hoe = ExtResource("25_3h260")
_wateringCan = ExtResource("26_1bhpp")
[node name="CharacterBody2D" parent="YSorted/Vesna" index="0"]
y_sort_enabled = true
@@ -776,11 +775,9 @@ y_sort_enabled = true
[node name="Animated Sprites" parent="YSorted/Vesna/CharacterBody2D/visuals" index="0"]
y_sort_enabled = true
animation = &"diagonal item"
frame = 0
frame_progress = 0.0
[node name="WateringCanUI" parent="YSorted/Vesna/CharacterBody2D" index="2" node_paths=PackedStringArray("_stages")]
_stages = [null, null, null, null, null, null]
[node name="ForestVisuals" type="Node2D" parent="YSorted"]
y_sort_enabled = true
position = Vector2(-60, -250)
@@ -864,10 +861,10 @@ region_rect = Rect2(1699, 76, 280, 230)
[node name="bush4" type="Sprite2D" parent="YSorted/ForestVisuals/Static/greenery/left side"]
modulate = Color(0.8428, 0.8771, 0.98, 1)
material = SubResource("ShaderMaterial_yvxfs")
position = Vector2(16878, 2099)
position = Vector2(16884, 1943)
scale = Vector2(2, 2)
texture = ExtResource("19_edja8")
offset = Vector2(0, -172)
offset = Vector2(-3, -94)
region_enabled = true
region_rect = Rect2(0, 604, 248, 228)
@@ -1232,10 +1229,10 @@ region_rect = Rect2(130, 0, 201, 278)
modulate = Color(0.8428, 0.8771, 0.98, 1)
y_sort_enabled = true
material = SubResource("ShaderMaterial_yvxfs")
position = Vector2(3348, 2074)
position = Vector2(3346.379, 1926.0276)
scale = Vector2(-2.40318, 3.59175)
texture = ExtResource("19_edja8")
offset = Vector2(0, -172)
offset = Vector2(-0.67456055, -130.80212)
region_enabled = true
region_rect = Rect2(130, 0, 201, 278)
@@ -2156,6 +2153,7 @@ _sceneRoot = NodePath("..")
script = ExtResource("40_cvg1r")
_enemyGroupSpawns = [NodePath("../YSorted/EnemyGroupSpawns/Spawn1"), NodePath("../YSorted/EnemyGroupSpawns/Spawn2"), NodePath("../YSorted/EnemyGroupSpawns/Spawn3"), NodePath("../YSorted/EnemyGroupSpawns/Spawn4")]
_roamingEnemyGroupPrefab = ExtResource("41_cvg1r")
_itemOnGroundPrefab = ExtResource("41_x3yi1")
_fightSceneSwitcher = NodePath("../FightSceneSwitcher")
[editable path="YSorted/Vesna"]
@@ -223,6 +223,7 @@ _sceneNamesToLoad = PackedStringArray("res://scenes/Babushka_scene_indoor_vesnas
[node name="Foreground" type="Node" parent="."]
[node name="Table" type="Sprite2D" parent="Foreground"]
z_index = 2
y_sort_enabled = true
position = Vector2(-1888, 1112)
texture = ExtResource("2_ubg3a")
@@ -231,6 +232,7 @@ region_enabled = true
region_rect = Rect2(1012, 1743, 1470, 417)
[node name="Chair" type="Sprite2D" parent="Foreground"]
z_index = 3
y_sort_enabled = true
position = Vector2(-3032, 2096)
texture = ExtResource("3_gpagp")
+8
View File
@@ -1760,6 +1760,7 @@ metadata/SaveID = "7a8210bf-479d-4b4c-9758-98d23e59d5d7"
[node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")]
_state = 2
_field = NodePath("../..")
_daysWatered = 6
[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField" index="7"]
visible = false
@@ -1780,6 +1781,7 @@ metadata/SaveID = "a1d8a0a2-c51c-4410-83c3-0edb31cbf2de"
[node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField2/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")]
_state = 2
_field = NodePath("../..")
_daysWatered = 6
[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField2" index="7"]
visible = false
@@ -1800,6 +1802,7 @@ metadata/SaveID = "79a65532-cb2b-4268-8eb0-8c41a3935cbb"
[node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField3/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")]
_state = 2
_field = NodePath("../..")
_daysWatered = 5
[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField3" index="7"]
visible = false
@@ -1821,6 +1824,7 @@ metadata/SaveID = "13fa64a3-01dc-4fd8-822e-0839c0da3163"
[node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField4/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")]
_state = 2
_field = NodePath("../..")
_daysWatered = 7
[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField4" index="7"]
visible = false
@@ -1842,6 +1846,7 @@ metadata/SaveID = "414ecdb9-f3c4-4fb9-81bd-6ca575784f78"
[node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField5/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")]
_state = 2
_field = NodePath("../..")
_daysWatered = 6
[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField5" index="7"]
visible = false
@@ -1863,6 +1868,7 @@ metadata/SaveID = "b235febb-b231-4f8c-94e9-1f9d9f115b08"
[node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField6/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")]
_state = 1
_field = NodePath("../..")
_daysWatered = 5
[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField6" index="7"]
visible = false
@@ -1884,6 +1890,7 @@ metadata/SaveID = "9ccdba91-812a-4c13-9ee0-12472e174fc9"
[node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField7/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")]
_state = 2
_field = NodePath("../..")
_daysWatered = 6
[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField7" index="7"]
visible = false
@@ -1905,6 +1912,7 @@ metadata/SaveID = "da44e54a-0b76-4888-ad8b-782a9d146fa3"
[node name="Beet2" parent="YSorted/Farm visuals/FieldParent/BaseField8/FieldBehaviour/PlantPlaceholder" index="0" node_paths=PackedStringArray("_field") instance=ExtResource("41_vyqmy")]
_state = 2
_field = NodePath("../..")
_daysWatered = 6
[node name="FieldActivator" parent="YSorted/Farm visuals/FieldParent/BaseField8" index="7"]
visible = false
@@ -205,6 +205,12 @@ public partial class FieldBehaviour2D : Sprite2D, ISaveable
}
}
public void HarvestPlant()
{
_currentPlant = null;
UpdateFieldState(FieldState.Empty, true);
}
#region SAVE AND LOAD
/// <summary>
@@ -244,6 +250,9 @@ public partial class FieldBehaviour2D : Sprite2D, ISaveable
Dictionary<string, Variant> save = SavegameService.GetSaveData(id);
// if we already have a plant, don't instantiate another one
int plantCount = PlantingPlaceholder.GetChildCount();
if (save.Count > 0)
{
// get plant first because it's also relevant for the field state
@@ -253,12 +262,16 @@ public partial class FieldBehaviour2D : Sprite2D, ISaveable
if (plantDataDict.TryGetValue("prefab_path", out Variant prefabPathVar))
{
InstantiatePlant(prefabPathVar.AsString());
if(plantCount == 0)
InstantiatePlant(prefabPathVar.AsString());
else
_currentPlant = PlantingPlaceholder.GetChild(0) as PlantBehaviour2D;
}
else
{
return;
}
if (plantDataDict.TryGetValue("plant_start_day", out Variant plantStartDay) && _currentPlant != null)
{
_currentPlant.DayPlanted = plantStartDay.AsInt32();
@@ -27,6 +27,7 @@ public partial class PlantBehaviour2D : Node2D
[ExportGroup("PlantConfig")]
[Export] private string _prefabPath;
[Export] private VariableNode _lifecycle;
[Export] private int _daysWatered;
private string _magicWordDialogicEventName = "MagicWord";
private Sprite2D? _currentPlantSprite = null;
@@ -34,7 +35,6 @@ public partial class PlantBehaviour2D : Node2D
private bool _calledOnReady = false;
private int _dayPlanted;
private int _currentDay;
private int _daysWatered;
public PlantState State
{
@@ -160,14 +160,14 @@ public partial class PlantBehaviour2D : Node2D
_currentPlantSprite.Visible = false;
_currentPlantSprite = GetRandomSprite(_readyPlants);
_currentPlantSprite.Visible = true;
ActivatePickupAfterDelay(true);
SetActiveHarvestablePlant(true);
break;
case PlantState.Ready:
_state = PlantState.None;
if(_currentPlantSprite != null)
_currentPlantSprite.Visible = false;
_currentPlantSprite = null;
ActivatePickupAfterDelay(false);
SetActiveHarvestablePlant(false);
break;
default:
break;
@@ -184,12 +184,6 @@ public partial class PlantBehaviour2D : Node2D
return sprites[rand.Next(sprites.Length)];
}
public async void ActivatePickupAfterDelay(bool activate)
{
await ToSignal(GetTree().CreateTimer(1.0f), "timeout");
SetActiveHarvestablePlant(activate);
}
private void SetActiveHarvestablePlant(bool active)
{
_harvestablePlant.IsActive = active;
@@ -206,4 +200,9 @@ public partial class PlantBehaviour2D : Node2D
_magicWordSaid = true;
Grow();
}
public void Harvest()
{
Field.HarvestPlant();
}
}
@@ -11,11 +11,11 @@ public partial class ActionAnimationController : Node
#endregion
[Export] private AllFightersVisual _allFightersVisual = null!;
[Export] private FightHappeningAnimationContext _animationContext = null!;
public void StateEnter()
{
_ = HappeningData.actionStaging!.AnimateAction(_allFightersVisual);
_ = HappeningData.actionStaging!.AnimateAction(_allFightersVisual,_animationContext);
}
public void StateExit()
@@ -47,10 +47,11 @@ public class AllyAttackAction : FighterAction
public override void ExecuteAction()
{
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 targetFighter = targetSelect.GetTarget();
@@ -63,7 +64,7 @@ public class AllyAttackAction : FighterAction
foreach (var hit in minigameDetail.damageHits!)
{
targetFighterVisual.SpawnDamageIndicatorNumber(hit);
targetFighterVisual.SpawnDamageIndicatorNumber($"-{hit}");
}
await currentFighterVisual.AnimatePosToBase();
@@ -18,10 +18,11 @@ public class BlobAttackAction(int damage = 3) : FighterAction
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 targetFighter = FightWorld.Instance.allyFighters.vesnaFighter;
@@ -31,7 +32,7 @@ public class BlobAttackAction(int damage = 3) : FighterAction
await currentFighterVisual.AnimatePosToTarget(targetFighterVisual);
_ = targetFighterVisual.AnimateHit();
targetFighterVisual.SpawnDamageIndicatorNumber(damage);
targetFighterVisual.SpawnDamageIndicatorNumber($"-{damage}");
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
+2 -1
View File
@@ -10,7 +10,8 @@ public class AllyFighters
maxHealth = 60,
availableActions =
[
new AllyAttackAction()
new AllyAttackAction(),
new EatBeetrootAction()
]
};
public FightWorld.Fighter chuhaFighter = new()
@@ -222,9 +222,9 @@ public partial class FightHappening : Node
case FightState.ActionCheckDetails:
RequireNotNull(HappeningData.actionStaging);
if (ActionAbort())
if (ShouldActionAbort())
ChangeState(FightState.InputActionSelect);
else if (ActionNeededDetail())
else if (DoesActionNeededDetail())
ChangeState(FightState.InputActionDetail);
else
ChangeState(FightState.ActionExecute);
@@ -328,13 +328,13 @@ public partial class FightHappening : Node
return HappeningData.actionStaging.GetAnimationEnd();
}
private bool ActionAbort()
private bool ShouldActionAbort()
{
Debug.Assert(HappeningData.actionStaging != null);
return HappeningData.actionStaging.MarkedForAbort();
return HappeningData.actionStaging.ShouldAbort();
}
private bool ActionNeededDetail()
private bool DoesActionNeededDetail()
{
Debug.Assert(HappeningData.actionStaging != null);
return HappeningData.actionStaging.NextDetail();
@@ -344,7 +344,7 @@ public partial class FightHappening : Node
private void ReviveVesna()
{
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");
}
@@ -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.Linq;
using Babushka.scripts.CSharp.Common.Util;
using Babushka.scripts.CSharp.Common.Inventory;
using Godot;
namespace Babushka.scripts.CSharp.Common.Fight;
public partial class FightRoomSceneSetup : Node
{
[Export(PropertyHint.ArrayType)] private Node2D[] _enemyGroupSpawns;
[Export] private PackedScene _roamingEnemyGroupPrefab;
[Export] private FightSceneSwitcher _fightSceneSwitcher;
[Export(PropertyHint.ArrayType)] private Node2D[] _enemyGroupSpawns = null!;
[Export] private PackedScene _roamingEnemyGroupPrefab = null!;
[Export] private PackedScene _itemOnGroundPrefab = null!;
[Export] private FightSceneSwitcher _fightSceneSwitcher = null!;
public override void _Ready()
@@ -19,11 +20,30 @@ public partial class FightRoomSceneSetup : Node
foreach (var (parent, group) in _enemyGroupSpawns.Zip(room.enemyGroups))
{
if (group.AreAllDead())
continue;
var roamingEnemyGroup = _roamingEnemyGroupPrefab.Instantiate<RoamingEnemyGroup>();
roamingEnemyGroup.Initialize(group, _fightSceneSwitcher);
parent.AddChild(roamingEnemyGroup);
{
SpawnLoot(group, parent);
}
else
{
SpawnEnemies(group, parent);
}
}
}
private void SpawnEnemies(FightWorld.FighterGroup group, Node2D parent)
{
var roamingEnemyGroup = _roamingEnemyGroupPrefab.Instantiate<RoamingEnemyGroup>();
roamingEnemyGroup.Initialize(group, _fightSceneSwitcher);
parent.AddChild(roamingEnemyGroup);
}
private void SpawnLoot(FightWorld.FighterGroup group, Node2D parent)
{
if (group.lootToDrop == null)
return;
var onGroundInstance = _itemOnGroundPrefab.Instantiate<ItemOnGround2D>();
onGroundInstance.itemInstance = group.lootToDrop;
parent.AddChild(onGroundInstance);
}
}
+10 -9
View File
@@ -11,14 +11,15 @@ public static class FightUtils
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));
}
public static bool IsAlive(this FightWorld.Fighter self)
{
return self.GetHealth() > 0;
return self.Health > 0;
}
public static bool IsDead(this FightWorld.Fighter self)
@@ -26,14 +27,14 @@ public static class FightUtils
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);
}
public static void AddHealth(this FightWorld.Fighter self, int addHealth)
{
self.health = self.GetHealth() + addHealth;
self.Health += amount;
}
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 Babushka.scripts.CSharp.Common.Fight.Actions;
using Babushka.scripts.CSharp.Common.Inventory;
using Babushka.scripts.CSharp.Common.Util;
using Godot;
@@ -19,6 +21,7 @@ public partial class FightWorld : Node
None,
EndOfNight
}
public required Dictionary<int, Room> paths;
public required List<FighterGroup> enemyGroups;
public Special specialRoom = Special.None;
@@ -27,6 +30,7 @@ public partial class FightWorld : Node
public class FighterGroup
{
public required List<Fighter> fighters;
public ItemInstance? lootToDrop = null;
}
public class FightHappeningData
@@ -56,9 +60,17 @@ public partial class FightWorld : Node
public required int maxHealth;
public required List<FighterAction> availableActions;
public const int MaxActionPoints = 1;
public int? health = null; // null => initialize to full health on spawn
public int actionPointsLeft;
private int? _healthBacking = null;
public int Health
{
get => _healthBacking ?? maxHealth;
set => _healthBacking = Math.Clamp(value, 0, maxHealth);
}
public FighterAction AutoSelectAction()
{
return availableActions.Random() ?? new FighterAction.Skip();
@@ -81,6 +93,10 @@ public partial class FightWorld : Node
public FightHappeningData? fightHappeningData = null;
public AllyFighters allyFighters = new();
// settings
[Export] private ItemResource? _itemToDropByEnemyGroup;
[Export] public ItemResource? itemBeetrootToEatForHealth;
public void ResetFightWorld()
{
Generate();
@@ -89,10 +105,10 @@ public partial class FightWorld : Node
public void Generate()
{
world = new Generator().GenerateWorld();
world = new Generator(this).GenerateWorld();
}
private class Generator
private class Generator(FightWorld fightWorld)
{
public World GenerateWorld()
{
@@ -162,6 +178,11 @@ public partial class FightWorld : Node
fighters = []
};
if (fightWorld._itemToDropByEnemyGroup != null)
{
enemyGroup.lootToDrop = new ItemInstance { blueprint = fightWorld._itemToDropByEnemyGroup };
}
var enemyCount = GD.RandRange(2, 3);
for (var i = 0; i < enemyCount; i++)
@@ -189,7 +210,6 @@ public partial class FightWorld : Node
var enemy = new Fighter
{
type = type,
health = null,
maxHealth = GD.RandRange(8, 20),
availableActions =
[
+4 -12
View File
@@ -30,8 +30,6 @@ public abstract class FighterAction
public abstract bool DetailComplete();
}
private bool _abort = false;
#region Shortcuts
protected static FightWorld.FightHappeningData HappeningData =>
@@ -61,19 +59,13 @@ public abstract class FighterAction
/// Animates the action.
/// </summary>
/// <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()
{
_abort = true;
}
public bool MarkedForAbort()
{
return _abort;
}
public virtual bool ShouldAbort() => false;
/// <summary>
/// Returns the FighterActionDetail, that is currently handled.
@@ -4,13 +4,13 @@ namespace Babushka.scripts.CSharp.Common.Fight;
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);
flyingNumberInstance.Initialize(number);
flyingNumberInstance.Initialize(text);
}
}
+19 -12
View File
@@ -42,7 +42,12 @@ public partial class FighterVisual : Node2D
_boundFighter.IsInFormation(HappeningData.enemyFighterFormation) ? -1 : 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)
@@ -78,6 +83,7 @@ public partial class FighterVisual : Node2D
public async Task AnimateHit()
{
UpdateHealthBarVisuals();
var tween = GetTree().CreateTween();
tween.TweenProperty(_squashParent, "scale", new Vector2(1.4f, 0.6f), 0.15);
tween.TweenProperty(_squashParent, "scale", new Vector2(1, 1), 0.4)
@@ -85,17 +91,18 @@ public partial class FighterVisual : Node2D
await ToSignal(tween, "finished");
}
// Keep for reference for new Heal animation
//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)
public async Task AnimateHeal()
{
_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;
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 xMovement = GD.RandRange(-150, 150);
@@ -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;
}
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 freeOnStack = maxStack - itemInstance.amount;
var moveAmount = Math.Min(freeOnStack, newItem.amount);
@@ -133,7 +134,7 @@ public partial class InventoryInstance : Node, ISaveable
itemInstance.amount -= 1;
if(itemInstance.amount == 0)
if (itemInstance.amount == 0)
_slots[inventorySlot].itemInstance = null;
EmitSignal(SignalName.InventoryContentsChanged);
@@ -145,6 +146,38 @@ public partial class InventoryInstance : Node, ISaveable
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)
{
if (destinationSlot < 0 || destinationSlot >= _slots.Count)
@@ -175,7 +208,7 @@ public partial class InventoryInstance : Node, ISaveable
return items.All(HasItems);
}
#region SAVE AND LOAD
#region SAVE AND LOAD
public void UpdateSaveData()
{
@@ -189,7 +222,7 @@ public partial class InventoryInstance : Node, ISaveable
string[] value = new string[2];
value[0] = _slots[i].itemInstance.blueprint.ResourcePath;
value[1] = _slots[i].itemInstance.amount.ToString();
payloadData.Add(key,value);
payloadData.Add(key, value);
}
}
@@ -210,7 +243,7 @@ public partial class InventoryInstance : Node, ISaveable
{
string[] savePayload = inventoryItemData.AsStringArray();
ItemResource resource = ResourceLoader.Load<ItemResource>(savePayload[0]);
int _amount = int.Parse(savePayload[1]);
int _amount = int.Parse(savePayload[1]);
ItemInstance instance = new ItemInstance { blueprint = resource, amount = _amount };
AddItem(instance);
@@ -230,5 +263,6 @@ public partial class InventoryInstance : Node, ISaveable
slot.itemInstance = null;
}
}
#endregion
}
@@ -6,7 +6,7 @@ namespace Babushka.scripts.CSharp.Common.Inventory;
[GlobalClass]
public partial class ItemInstance: Resource
{
[Export] public ItemResource blueprint;
[Export] public required ItemResource blueprint;
[Export] public int amount = 1;
public ItemInstance Clone()
@@ -108,6 +108,8 @@ public partial class MinigameController : Node2D
[Signal] public delegate void ArmMovedEventHandler(float newPos);
[Signal] public delegate void RegionHitEventHandler(int regionIndex);
public override void _EnterTree()
{
HideMinigame();
@@ -125,6 +127,7 @@ public partial class MinigameController : Node2D
ShowMinigame();
Setup(builder);
await _minigameComplete!.Task;
await ToSignal(GetTree().CreateTimer(.3), "timeout");
var returnValue = _hits!.Select(h => builder.regions[h].value).ToList();
Reset();
HideMinigame();
@@ -145,6 +148,7 @@ public partial class MinigameController : Node2D
}
_hits.Add(i);
EmitSignalRegionHit(i);
_armSpeed = -_armSpeed;
@@ -174,16 +178,18 @@ public partial class MinigameController : Node2D
// spawn regions
var regionSum = 0f;
foreach (var region in builder.regions)
foreach (var (region, i) in builder.regions.Select((region, i) => (region, i)))
{
var regionVisual = _regionVisualPrefab.Instantiate<RegionVisual>();
_regionsParent.AddChild(regionVisual);
RegionHit += regionVisual.HitAnimation;
var normalisedAngleStart = regionSum / totalRegionProportion;
var normalisedAngleEnd = (regionSum + region.proportion) / totalRegionProportion;
var normalAngles = new Vector2(normalisedAngleStart, normalisedAngleEnd);
regionVisual.Setup(normalAngles, _baseRegionColor.RandomHue(), region.text, region.theme);
regionVisual.Setup(normalAngles, region.text, region.theme, i);
regionSum += region.proportion;
@@ -207,6 +213,13 @@ public partial class MinigameController : Node2D
{
_minigameComplete = null;
_hits = null;
_regionsParent.GetChildren().ForEach(c => c.QueueFree());
_regionsParent.GetChildren().ForEach(c =>
{
if (c is RegionVisual rv)
{
RegionHit -= rv.HitAnimation;
}
c.QueueFree();
});
}
}
+22 -7
View File
@@ -1,27 +1,42 @@
using Godot;
using System;
using Babushka.scripts.CSharp.Common.Minigame;
using Godot;
using Godot.Collections;
namespace Babushka.scripts.CSharp.Common.Minigame;
public partial class RegionVisual : Node
{
[Export] private Sprite2D _sliceSprite;
[Export] private Label _textLabel;
[Export] private Node2D _labelPivot;
[Export] private Sprite2D _sliceSprite = null!;
[Export] private Label _textLabel = null!;
[Export] private Node2D _labelPivot = null!;
[Export(PropertyHint.DictionaryType)] private Dictionary<MinigameController.RegionTheme, Color> _fillColors = new();
public void Setup(Vector2 normalAngles, Color color, string regionText, MinigameController.RegionTheme regionTheme)
private int _index;
public void Setup(Vector2 normalAngles, string regionText, MinigameController.RegionTheme regionTheme, int index)
{
var mat = (_sliceSprite.Material as ShaderMaterial)!;
mat.SetShaderParameter("angles", normalAngles);
mat.SetShaderParameter("fillColor", GetFillColor(regionTheme));
var averageAngleRadians = (normalAngles.X + normalAngles.Y) * float.Pi; // '/ 2' from the average and '* 2' from the radians cancel out
// '/ 2' from the average and '* 2' from the radians cancel out
var averageAngleRadians = (normalAngles.X + normalAngles.Y) * float.Pi;
_labelPivot.Rotation = averageAngleRadians;
_textLabel.Rotation = -averageAngleRadians;
_textLabel.Text = regionText;
_index = index;
}
public void HitAnimation(int regionIndex)
{
if(regionIndex != _index) return;
var tween = GetTree().CreateTween();
tween.TweenProperty(_sliceSprite, "scale", new Vector2(1.5f, 1.5f), 0.1f);
tween.TweenProperty(_sliceSprite, "scale", new Vector2(1f, 1f), 0.2f);
}
private Color GetFillColor(MinigameController.RegionTheme theme)
+16 -24
View File
@@ -1,3 +1,4 @@
using Babushka.scripts.CSharp.Common.Services;
using Godot;
namespace Babushka.scripts.CSharp.Common.NPC;
@@ -8,37 +9,28 @@ public partial class TalkingCharacter : Node2D
[Export] private string[] _timelinesToPlay;
[Export] private bool _retriggerSameTimeline = false;
private bool _isTalking = true;
private int _timelineIndex = 0;
[Signal] public delegate void TalkingEventHandler(string timelineName);
[Signal] public delegate void FinishedTalkingEventHandler(bool hasTimeLinesToPlay);
public override void _Ready()
public void StartTalking()
{
ToggleTalking();
}
public void ToggleTalking()
{
if (_isTalking || _timelineIndex >= _timelinesToPlay.Length)
{
if (_sprite != null)
_sprite.Animation = "idle";
_isTalking = false;
}
else
{
if (_sprite != null)
_sprite.Animation = "talk";
_isTalking = true;
EmitSignal(SignalName.Talking, _timelinesToPlay[_timelineIndex]);
if (!_retriggerSameTimeline)
_timelineIndex++;
}
if (_sprite != null)
_sprite.Animation = "talk";
EmitSignal(SignalName.Talking, _timelinesToPlay[_timelineIndex]);
if (!_retriggerSameTimeline)
_timelineIndex++;
InputService.Instance.InputEnabled = false;
if (_sprite != null)
_sprite.Play();
}
EmitSignal(SignalName.FinishedTalking, _timelineIndex >= _timelinesToPlay.Length);
public void StopTalking()
{
if (_sprite != null)
_sprite.Animation = "idle";
InputService.Instance.InputEnabled = true;
if (_sprite != null)
_sprite.Play();
}
}
+13
View File
@@ -1,5 +1,18 @@
extends Node
class_name DialogicStarter
signal timelineStarted
signal timelineEnded
func _ready() -> void:
Dialogic.timeline_ended.connect(_on_timeline_ended)
Dialogic.timeline_started.connect(_start_dialog)
func open(timeline: String):
Dialogic.start(timeline)
func _start_dialog() -> void:
timelineStarted.emit()
func _on_timeline_ended() -> void:
timelineEnded.emit()