fixes saving of party monsters, adds display of monster stats in battle ui

This commit is contained in:
Luca 2024-09-29 11:10:46 +02:00
parent 5748d34b34
commit b09eee0805
9 changed files with 201 additions and 61 deletions

View file

@ -7,8 +7,21 @@ func _ready() -> void:
self.visible = false
for i in range(4):
var button = move_button.instantiate()
$MarginContainer/HBoxContainer/BattleMovesMenu.add_child(button)
%BattleMovesMenu.add_child(button)
func update() -> void:
var player = Utils.get_player()
var player_fighter = SaveManager.current_save.party[0] as MonsterData
%PartyFighterLevel.text = "Lv. %s" % str(player_fighter.level)
%PartyFighterName.text = player_fighter.nickname if not player_fighter.nickname.is_empty() else player_fighter.name
%PartyFighterHealthbar.max_value = player_fighter.health
%PartyFighterHealthbar.value = player_fighter.current_health
%EnemyMonsterLevel.text = "Lv. %s" % player.enemy.level
%EnemyMonsterName.text = player.enemy.name
%EnemyMonsterHealthbar.max_value = player.enemy.health
%EnemyMonsterHealthbar.value = player.enemy.current_health
func _on_battle_button_pressed() -> void:
print("attack here")

View file

@ -74,7 +74,113 @@ grow_vertical = 2
mouse_filter = 2
script = ExtResource("1_jyqir")
[node name="MarginContainer" type="MarginContainer" parent="."]
[node name="TopMarginContainer" type="MarginContainer" parent="."]
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
grow_horizontal = 2
theme_override_constants/margin_left = 30
theme_override_constants/margin_top = 50
theme_override_constants/margin_right = 30
[node name="EnemyContainer" type="HBoxContainer" parent="TopMarginContainer"]
layout_mode = 2
size_flags_vertical = 8
theme_override_constants/separation = 16
alignment = 2
[node name="PartyAliveStatus" type="VBoxContainer" parent="TopMarginContainer/EnemyContainer"]
layout_mode = 2
[node name="PartyAliveStatus1" type="TextureRect" parent="TopMarginContainer/EnemyContainer/PartyAliveStatus"]
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
size_flags_horizontal = 0
texture = ExtResource("2_keyyt")
expand_mode = 2
[node name="PartyAliveStatus2" type="TextureRect" parent="TopMarginContainer/EnemyContainer/PartyAliveStatus"]
self_modulate = Color(1, 1, 1, 0.392157)
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
size_flags_horizontal = 0
texture = ExtResource("2_keyyt")
expand_mode = 2
[node name="PartyAliveStatus3" type="TextureRect" parent="TopMarginContainer/EnemyContainer/PartyAliveStatus"]
self_modulate = Color(1, 1, 1, 0.392157)
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
size_flags_horizontal = 0
texture = ExtResource("2_keyyt")
expand_mode = 2
[node name="PartyAliveStatus4" type="TextureRect" parent="TopMarginContainer/EnemyContainer/PartyAliveStatus"]
self_modulate = Color(1, 1, 1, 0.392157)
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
size_flags_horizontal = 0
texture = ExtResource("2_keyyt")
expand_mode = 2
[node name="PartyAliveStatus5" type="TextureRect" parent="TopMarginContainer/EnemyContainer/PartyAliveStatus"]
self_modulate = Color(1, 1, 1, 0.392157)
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
size_flags_horizontal = 0
texture = ExtResource("2_keyyt")
expand_mode = 2
[node name="PartyAliveStatus6" type="TextureRect" parent="TopMarginContainer/EnemyContainer/PartyAliveStatus"]
self_modulate = Color(1, 1, 1, 0.392157)
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
size_flags_horizontal = 0
texture = ExtResource("2_keyyt")
expand_mode = 2
[node name="PartyFighterInfo" type="VBoxContainer" parent="TopMarginContainer/EnemyContainer"]
layout_mode = 2
size_flags_vertical = 0
theme_override_constants/separation = 10
[node name="LevelAndGender" type="HBoxContainer" parent="TopMarginContainer/EnemyContainer/PartyFighterInfo"]
layout_mode = 2
[node name="Level" type="PanelContainer" parent="TopMarginContainer/EnemyContainer/PartyFighterInfo/LevelAndGender"]
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_6o8cs")
[node name="EnemyMonsterLevel" type="Label" parent="TopMarginContainer/EnemyContainer/PartyFighterInfo/LevelAndGender/Level"]
unique_name_in_owner = true
layout_mode = 2
text = "Lv. 99"
label_settings = SubResource("LabelSettings_38ujs")
[node name="EnemyMonsterGender" type="TextureRect" parent="TopMarginContainer/EnemyContainer/PartyFighterInfo/LevelAndGender"]
unique_name_in_owner = true
self_modulate = Color(0.450091, 0.470517, 0.93375, 1)
custom_minimum_size = Vector2(12, 12)
layout_mode = 2
texture = ExtResource("3_fa6tk")
expand_mode = 2
stretch_mode = 4
[node name="EnemyMonsterName" type="Label" parent="TopMarginContainer/EnemyContainer/PartyFighterInfo"]
unique_name_in_owner = true
layout_mode = 2
text = "Monstername"
label_settings = SubResource("LabelSettings_kcdfy")
[node name="EnemyMonsterHealthbar" type="ProgressBar" parent="TopMarginContainer/EnemyContainer/PartyFighterInfo"]
unique_name_in_owner = true
layout_mode = 2
theme_override_styles/background = SubResource("StyleBoxFlat_auqmk")
theme_override_styles/fill = SubResource("StyleBoxFlat_84eln")
value = 50.0
show_percentage = false
[node name="BottomMarginContainer" type="MarginContainer" parent="."]
layout_mode = 1
anchors_preset = 12
anchor_top = 1.0
@ -87,25 +193,25 @@ theme_override_constants/margin_left = 30
theme_override_constants/margin_right = 30
theme_override_constants/margin_bottom = 50
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer"]
[node name="HBoxContainer" type="HBoxContainer" parent="BottomMarginContainer"]
layout_mode = 2
[node name="Left" type="HBoxContainer" parent="MarginContainer/HBoxContainer"]
[node name="PartyFighterContainer" type="HBoxContainer" parent="BottomMarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_vertical = 8
theme_override_constants/separation = 16
[node name="PartyAliveStatus" type="VBoxContainer" parent="MarginContainer/HBoxContainer/Left"]
[node name="PartyAliveStatus" type="VBoxContainer" parent="BottomMarginContainer/HBoxContainer/PartyFighterContainer"]
layout_mode = 2
[node name="Monster1" type="TextureRect" parent="MarginContainer/HBoxContainer/Left/PartyAliveStatus"]
[node name="PartyAliveStatus1" type="TextureRect" parent="BottomMarginContainer/HBoxContainer/PartyFighterContainer/PartyAliveStatus"]
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
size_flags_horizontal = 0
texture = ExtResource("2_keyyt")
expand_mode = 2
[node name="Monster2" type="TextureRect" parent="MarginContainer/HBoxContainer/Left/PartyAliveStatus"]
[node name="PartyAliveStatus2" type="TextureRect" parent="BottomMarginContainer/HBoxContainer/PartyFighterContainer/PartyAliveStatus"]
self_modulate = Color(1, 1, 1, 0.392157)
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
@ -113,7 +219,7 @@ size_flags_horizontal = 0
texture = ExtResource("2_keyyt")
expand_mode = 2
[node name="Monster3" type="TextureRect" parent="MarginContainer/HBoxContainer/Left/PartyAliveStatus"]
[node name="PartyAliveStatus3" type="TextureRect" parent="BottomMarginContainer/HBoxContainer/PartyFighterContainer/PartyAliveStatus"]
self_modulate = Color(1, 1, 1, 0.392157)
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
@ -121,7 +227,7 @@ size_flags_horizontal = 0
texture = ExtResource("2_keyyt")
expand_mode = 2
[node name="Monster4" type="TextureRect" parent="MarginContainer/HBoxContainer/Left/PartyAliveStatus"]
[node name="PartyAliveStatus4" type="TextureRect" parent="BottomMarginContainer/HBoxContainer/PartyFighterContainer/PartyAliveStatus"]
self_modulate = Color(1, 1, 1, 0.392157)
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
@ -129,7 +235,7 @@ size_flags_horizontal = 0
texture = ExtResource("2_keyyt")
expand_mode = 2
[node name="Monster5" type="TextureRect" parent="MarginContainer/HBoxContainer/Left/PartyAliveStatus"]
[node name="PartyAliveStatus5" type="TextureRect" parent="BottomMarginContainer/HBoxContainer/PartyFighterContainer/PartyAliveStatus"]
self_modulate = Color(1, 1, 1, 0.392157)
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
@ -137,7 +243,7 @@ size_flags_horizontal = 0
texture = ExtResource("2_keyyt")
expand_mode = 2
[node name="Monster6" type="TextureRect" parent="MarginContainer/HBoxContainer/Left/PartyAliveStatus"]
[node name="PartyAliveStatus6" type="TextureRect" parent="BottomMarginContainer/HBoxContainer/PartyFighterContainer/PartyAliveStatus"]
self_modulate = Color(1, 1, 1, 0.392157)
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
@ -145,24 +251,26 @@ size_flags_horizontal = 0
texture = ExtResource("2_keyyt")
expand_mode = 2
[node name="PartyFighterInfo" type="VBoxContainer" parent="MarginContainer/HBoxContainer/Left"]
[node name="PartyFighterInfo" type="VBoxContainer" parent="BottomMarginContainer/HBoxContainer/PartyFighterContainer"]
layout_mode = 2
size_flags_vertical = 0
theme_override_constants/separation = 10
[node name="LevelAndGender" type="HBoxContainer" parent="MarginContainer/HBoxContainer/Left/PartyFighterInfo"]
[node name="LevelAndGender" type="HBoxContainer" parent="BottomMarginContainer/HBoxContainer/PartyFighterContainer/PartyFighterInfo"]
layout_mode = 2
[node name="Level" type="PanelContainer" parent="MarginContainer/HBoxContainer/Left/PartyFighterInfo/LevelAndGender"]
[node name="Level" type="PanelContainer" parent="BottomMarginContainer/HBoxContainer/PartyFighterContainer/PartyFighterInfo/LevelAndGender"]
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_6o8cs")
[node name="Label" type="Label" parent="MarginContainer/HBoxContainer/Left/PartyFighterInfo/LevelAndGender/Level"]
[node name="PartyFighterLevel" type="Label" parent="BottomMarginContainer/HBoxContainer/PartyFighterContainer/PartyFighterInfo/LevelAndGender/Level"]
unique_name_in_owner = true
layout_mode = 2
text = "Lv. 99"
label_settings = SubResource("LabelSettings_38ujs")
[node name="Gender" type="TextureRect" parent="MarginContainer/HBoxContainer/Left/PartyFighterInfo/LevelAndGender"]
[node name="PartyFighterGender" type="TextureRect" parent="BottomMarginContainer/HBoxContainer/PartyFighterContainer/PartyFighterInfo/LevelAndGender"]
unique_name_in_owner = true
self_modulate = Color(0.450091, 0.470517, 0.93375, 1)
custom_minimum_size = Vector2(12, 12)
layout_mode = 2
@ -170,29 +278,31 @@ texture = ExtResource("3_fa6tk")
expand_mode = 2
stretch_mode = 4
[node name="MonsterName" type="Label" parent="MarginContainer/HBoxContainer/Left/PartyFighterInfo"]
[node name="PartyFighterName" type="Label" parent="BottomMarginContainer/HBoxContainer/PartyFighterContainer/PartyFighterInfo"]
unique_name_in_owner = true
layout_mode = 2
text = "Monstername"
label_settings = SubResource("LabelSettings_kcdfy")
[node name="ProgressBar" type="ProgressBar" parent="MarginContainer/HBoxContainer/Left/PartyFighterInfo"]
[node name="PartyFighterHealthbar" type="ProgressBar" parent="BottomMarginContainer/HBoxContainer/PartyFighterContainer/PartyFighterInfo"]
unique_name_in_owner = true
layout_mode = 2
theme_override_styles/background = SubResource("StyleBoxFlat_auqmk")
theme_override_styles/fill = SubResource("StyleBoxFlat_84eln")
value = 50.0
show_percentage = false
[node name="Spacer" type="Control" parent="MarginContainer/HBoxContainer"]
[node name="Spacer" type="Control" parent="BottomMarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.5
[node name="MainBattleMenu" type="VBoxContainer" parent="MarginContainer/HBoxContainer"]
[node name="MainBattleMenu" type="VBoxContainer" parent="BottomMarginContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
[node name="BattleButton" type="Button" parent="MarginContainer/HBoxContainer/MainBattleMenu"]
[node name="BattleButton" type="Button" parent="BottomMarginContainer/HBoxContainer/MainBattleMenu"]
layout_mode = 2
theme_override_constants/h_separation = 18
theme_override_constants/icon_max_width = 20
@ -212,7 +322,7 @@ text = "Battle"
icon = ExtResource("4_saqy8")
alignment = 0
[node name="PartyButton" type="Button" parent="MarginContainer/HBoxContainer/MainBattleMenu"]
[node name="PartyButton" type="Button" parent="BottomMarginContainer/HBoxContainer/MainBattleMenu"]
layout_mode = 2
theme_override_constants/h_separation = 18
theme_override_constants/icon_max_width = 20
@ -232,7 +342,7 @@ text = "Party"
icon = ExtResource("5_pnobx")
alignment = 0
[node name="ItemsButton" type="Button" parent="MarginContainer/HBoxContainer/MainBattleMenu"]
[node name="ItemsButton" type="Button" parent="BottomMarginContainer/HBoxContainer/MainBattleMenu"]
layout_mode = 2
theme_override_constants/h_separation = 18
theme_override_constants/icon_max_width = 20
@ -252,7 +362,7 @@ text = "Items"
icon = ExtResource("6_ikm1n")
alignment = 0
[node name="RunButton" type="Button" parent="MarginContainer/HBoxContainer/MainBattleMenu"]
[node name="RunButton" type="Button" parent="BottomMarginContainer/HBoxContainer/MainBattleMenu"]
layout_mode = 2
theme_override_constants/h_separation = 18
theme_override_constants/icon_max_width = 20
@ -272,10 +382,10 @@ text = "Run"
icon = ExtResource("7_tihhr")
alignment = 0
[node name="BattleMovesMenu" type="VBoxContainer" parent="MarginContainer/HBoxContainer"]
[node name="BattleMovesMenu" type="VBoxContainer" parent="BottomMarginContainer/HBoxContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
size_flags_horizontal = 3
[connection signal="pressed" from="MarginContainer/HBoxContainer/MainBattleMenu/BattleButton" to="." method="_on_battle_button_pressed"]
[connection signal="pressed" from="BottomMarginContainer/HBoxContainer/MainBattleMenu/BattleButton" to="." method="_on_battle_button_pressed"]

View file

@ -8,8 +8,6 @@ var damping_factor: float = 0.08
func _process(delta: float) -> void:
simulate_joystick_motion(JOY_AXIS_RIGHT_X, delta_position.x * delta * speed, 0)
print(delta_position)
#delta_position *= 0.92
delta_position *= (1 - damping_factor)
func _gui_input(event: InputEvent) -> void:

View file

@ -32,6 +32,7 @@ func show_ingame_controls(p_visible = true) -> void:
func show_battle_ui(p_visible = true) -> void:
battle_ui.visible = p_visible
battle_ui.update()
func _on_ingame_controls_menu_button_clicked() -> void:
ingame_menu.visible = true