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

@ -10,6 +10,7 @@ var spawn_point: Vector3 = Vector3(0, 0, 0)
@onready var frequency: float = 1.0 @onready var frequency: float = 1.0
@onready var amplitude: float = 0.5 @onready var amplitude: float = 0.5
var in_battle: bool = false var in_battle: bool = false
var idle: bool = false
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
@ -28,7 +29,11 @@ func _physics_process(delta: float) -> void:
var x_movement = sin(time * frequency) * amplitude var x_movement = sin(time * frequency) * amplitude
var y_movement = sin(time * 25) * 4.0 var y_movement = sin(time * 25) * 4.0
var z_movement = cos(time * frequency) * amplitude var z_movement = cos(time * frequency) * amplitude
velocity = Vector3(x_movement, y_movement, z_movement)
if not idle:
velocity = Vector3(x_movement, y_movement, z_movement)
else:
velocity = Vector3(0, y_movement, 0)
# if move_and_slide reports collisions # if move_and_slide reports collisions
if move_and_slide(): if move_and_slide():
@ -39,15 +44,4 @@ func _physics_process(delta: float) -> void:
if collider.name == "Player": if collider.name == "Player":
velocity = Vector3.ZERO velocity = Vector3.ZERO
in_battle = true in_battle = true
collider.start_battle(self)
# calculate players new position
# from the camera 3 units backwards
var camera = collider.find_child("Camera3D")
# local z axis of the camera
var local_z = camera.global_transform.basis.z
var new_player_position = camera.global_transform.origin + local_z * 3
collider.start_battle(self, new_player_position)
#rotate_toward(rotation.z, collider.rotation.z, 1.0)

View file

@ -2,9 +2,13 @@ extends CharacterBody3D
@onready var animated_mesh = $GobotSkin @onready var animated_mesh = $GobotSkin
var in_battle: bool = false var in_battle: bool = false
var enemy: MonsterData = null
const SPEED = 5.0 const SPEED = 5.0
const JUMP_VELOCITY = 4.5 const JUMP_VELOCITY = 4.5
func _ready() -> void:
Utils.set_player(self)
func on_save_game(saved_data : Array[SavedData]): func on_save_game(saved_data : Array[SavedData]):
var data = SavedData.new() var data = SavedData.new()
data.position = global_position data.position = global_position
@ -18,6 +22,9 @@ func on_before_load_game():
func on_load_game(saved_data: SavedData): func on_load_game(saved_data: SavedData):
global_position = saved_data.position global_position = saved_data.position
# Update the global reference to the player
Utils.set_player(self)
func _physics_process(delta: float) -> void: func _physics_process(delta: float) -> void:
if in_battle == true: if in_battle == true:
return return
@ -76,29 +83,37 @@ func _physics_process(delta: float) -> void:
# the player is positioned (mostly somewhere else than the current position) # the player is positioned (mostly somewhere else than the current position)
# ui changes # ui changes
# music changes # music changes
func start_battle(enemy: Node3D, player_position: Vector3) -> void: func start_battle(p_enemy: Node3D) -> void:
position = Vector3(player_position.x, position.y, player_position.z) enemy = p_enemy.data
var camera: Camera3D = $CameraRoot/SpringArm3D/Camera3D
# local z axis of the camera
var local_z = camera.global_transform.basis.z
var new_player_position = camera.global_transform.origin + local_z * 3
var monster_position = camera.global_transform.origin + local_z * 2
position = Vector3(new_player_position.x, position.y, new_player_position.z)
in_battle = true in_battle = true
velocity = Vector3.ZERO velocity = Vector3.ZERO
animated_mesh.idle() animated_mesh.idle()
UI.show_battle_ui(true) UI.show_battle_ui(true)
UI.show_ingame_controls(false) UI.show_ingame_controls(false)
# Spawn player monster
var monster_data : MonsterData = SaveManager.current_save.party[0]
var monster = Monster.new()
monster.data = monster_data
monster.idle = true
print("%s (%s), Lv. %s, %s XP" % [monster.data.name, monster.data.nickname, monster.data.level, monster.data.xp])
monster.position = Vector3(monster_position.x, position.y + 1, monster_position.z)
add_child(monster)
camera.look_at(monster.position, Vector3.UP, false)
# How to attack and finish the battle?
await get_tree().create_timer(2.0).timeout
await get_tree().create_timer(5.0).timeout
print("Battle over") print("Battle over")
remove_child(monster)
monster.queue_free()
in_battle = false in_battle = false
func save() -> Dictionary:
var save_dict = {
"player_transform": {
"pos_x": global_position.x,
"pos_y": global_position.y,
"pos_z": global_position.z,
"rot_x": global_rotation.x,
"rot_y": global_rotation.y,
"rot_z": global_rotation.z
}
}
return save_dict

View file

@ -37,7 +37,7 @@ func start_new_game() -> void:
# Give the player a monster # Give the player a monster
var monster = MonsterData.new() var monster = MonsterData.new()
monster.set_data("debuggy") monster.set_values("debuggy", { "current_health": 12 }, 5)
SaveManager.current_save.party.push_back(monster) SaveManager.current_save.party.push_back(monster)
# Update the UI once # Update the UI once

View file

@ -1,5 +1,7 @@
extends Node extends Node
var player: Node3D = null
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
@ -14,3 +16,9 @@ func load_base_monster_data(p_unique_id) -> MonsterData:
else: else:
printerr("Monster.gd: No monster with the ID %s found" % p_unique_id) printerr("Monster.gd: No monster with the ID %s found" % p_unique_id)
return null return null
func set_player(p_player) -> void:
player = p_player
func get_player() -> Node3D:
return player

View file

@ -25,13 +25,13 @@ signal on_level_up
@export var defense: int = 1 @export var defense: int = 1
@export var tempo: int = 1 @export var tempo: int = 1
@export var level: int = 1 @export var level: int = 1
@export var xp: int = 1 @export var xp: int = 0
@export var nickname: String = "" @export var nickname: String = ""
@export var xp_for_levelup: int = 1 @export var xp_for_levelup: int = 1
# The ID is the filename of the monster from res://entities/monsters/<filename>.tres # The ID is the filename of the monster from res://entities/monsters/<filename>.tres
func set_data(p_unique_id = "", current_values: Dictionary = {}, p_level: int = 1) -> void: func set_values(p_unique_id = "", current_values: Dictionary = {}, p_level: int = 1) -> void:
if p_unique_id.is_empty(): if p_unique_id.is_empty():
printerr("Monster.gd: No ID given") printerr("Monster.gd: No ID given")
return return
@ -61,7 +61,8 @@ func set_data(p_unique_id = "", current_values: Dictionary = {}, p_level: int =
return return
# else, set custom values here # else, set custom values here
# TODO for key in current_values:
self[key] = current_values[key]
## This sets the monster to the specified level ## This sets the monster to the specified level
func set_level(p_level: int) -> void: func set_level(p_level: int) -> void:

View file

@ -7,8 +7,21 @@ func _ready() -> void:
self.visible = false self.visible = false
for i in range(4): for i in range(4):
var button = move_button.instantiate() 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: func _on_battle_button_pressed() -> void:
print("attack here") print("attack here")

View file

@ -74,7 +74,113 @@ grow_vertical = 2
mouse_filter = 2 mouse_filter = 2
script = ExtResource("1_jyqir") 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 layout_mode = 1
anchors_preset = 12 anchors_preset = 12
anchor_top = 1.0 anchor_top = 1.0
@ -87,25 +193,25 @@ theme_override_constants/margin_left = 30
theme_override_constants/margin_right = 30 theme_override_constants/margin_right = 30
theme_override_constants/margin_bottom = 50 theme_override_constants/margin_bottom = 50
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer"] [node name="HBoxContainer" type="HBoxContainer" parent="BottomMarginContainer"]
layout_mode = 2 layout_mode = 2
[node name="Left" type="HBoxContainer" parent="MarginContainer/HBoxContainer"] [node name="PartyFighterContainer" type="HBoxContainer" parent="BottomMarginContainer/HBoxContainer"]
layout_mode = 2 layout_mode = 2
size_flags_vertical = 8 size_flags_vertical = 8
theme_override_constants/separation = 16 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 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) custom_minimum_size = Vector2(32, 32)
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 0 size_flags_horizontal = 0
texture = ExtResource("2_keyyt") texture = ExtResource("2_keyyt")
expand_mode = 2 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) self_modulate = Color(1, 1, 1, 0.392157)
custom_minimum_size = Vector2(32, 32) custom_minimum_size = Vector2(32, 32)
layout_mode = 2 layout_mode = 2
@ -113,7 +219,7 @@ size_flags_horizontal = 0
texture = ExtResource("2_keyyt") texture = ExtResource("2_keyyt")
expand_mode = 2 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) self_modulate = Color(1, 1, 1, 0.392157)
custom_minimum_size = Vector2(32, 32) custom_minimum_size = Vector2(32, 32)
layout_mode = 2 layout_mode = 2
@ -121,7 +227,7 @@ size_flags_horizontal = 0
texture = ExtResource("2_keyyt") texture = ExtResource("2_keyyt")
expand_mode = 2 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) self_modulate = Color(1, 1, 1, 0.392157)
custom_minimum_size = Vector2(32, 32) custom_minimum_size = Vector2(32, 32)
layout_mode = 2 layout_mode = 2
@ -129,7 +235,7 @@ size_flags_horizontal = 0
texture = ExtResource("2_keyyt") texture = ExtResource("2_keyyt")
expand_mode = 2 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) self_modulate = Color(1, 1, 1, 0.392157)
custom_minimum_size = Vector2(32, 32) custom_minimum_size = Vector2(32, 32)
layout_mode = 2 layout_mode = 2
@ -137,7 +243,7 @@ size_flags_horizontal = 0
texture = ExtResource("2_keyyt") texture = ExtResource("2_keyyt")
expand_mode = 2 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) self_modulate = Color(1, 1, 1, 0.392157)
custom_minimum_size = Vector2(32, 32) custom_minimum_size = Vector2(32, 32)
layout_mode = 2 layout_mode = 2
@ -145,24 +251,26 @@ size_flags_horizontal = 0
texture = ExtResource("2_keyyt") texture = ExtResource("2_keyyt")
expand_mode = 2 expand_mode = 2
[node name="PartyFighterInfo" type="VBoxContainer" parent="MarginContainer/HBoxContainer/Left"] [node name="PartyFighterInfo" type="VBoxContainer" parent="BottomMarginContainer/HBoxContainer/PartyFighterContainer"]
layout_mode = 2 layout_mode = 2
size_flags_vertical = 0 size_flags_vertical = 0
theme_override_constants/separation = 10 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 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 layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_6o8cs") 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 layout_mode = 2
text = "Lv. 99" text = "Lv. 99"
label_settings = SubResource("LabelSettings_38ujs") 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) self_modulate = Color(0.450091, 0.470517, 0.93375, 1)
custom_minimum_size = Vector2(12, 12) custom_minimum_size = Vector2(12, 12)
layout_mode = 2 layout_mode = 2
@ -170,29 +278,31 @@ texture = ExtResource("3_fa6tk")
expand_mode = 2 expand_mode = 2
stretch_mode = 4 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 layout_mode = 2
text = "Monstername" text = "Monstername"
label_settings = SubResource("LabelSettings_kcdfy") 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 layout_mode = 2
theme_override_styles/background = SubResource("StyleBoxFlat_auqmk") theme_override_styles/background = SubResource("StyleBoxFlat_auqmk")
theme_override_styles/fill = SubResource("StyleBoxFlat_84eln") theme_override_styles/fill = SubResource("StyleBoxFlat_84eln")
value = 50.0 value = 50.0
show_percentage = false show_percentage = false
[node name="Spacer" type="Control" parent="MarginContainer/HBoxContainer"] [node name="Spacer" type="Control" parent="BottomMarginContainer/HBoxContainer"]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_stretch_ratio = 0.5 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 unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 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 layout_mode = 2
theme_override_constants/h_separation = 18 theme_override_constants/h_separation = 18
theme_override_constants/icon_max_width = 20 theme_override_constants/icon_max_width = 20
@ -212,7 +322,7 @@ text = "Battle"
icon = ExtResource("4_saqy8") icon = ExtResource("4_saqy8")
alignment = 0 alignment = 0
[node name="PartyButton" type="Button" parent="MarginContainer/HBoxContainer/MainBattleMenu"] [node name="PartyButton" type="Button" parent="BottomMarginContainer/HBoxContainer/MainBattleMenu"]
layout_mode = 2 layout_mode = 2
theme_override_constants/h_separation = 18 theme_override_constants/h_separation = 18
theme_override_constants/icon_max_width = 20 theme_override_constants/icon_max_width = 20
@ -232,7 +342,7 @@ text = "Party"
icon = ExtResource("5_pnobx") icon = ExtResource("5_pnobx")
alignment = 0 alignment = 0
[node name="ItemsButton" type="Button" parent="MarginContainer/HBoxContainer/MainBattleMenu"] [node name="ItemsButton" type="Button" parent="BottomMarginContainer/HBoxContainer/MainBattleMenu"]
layout_mode = 2 layout_mode = 2
theme_override_constants/h_separation = 18 theme_override_constants/h_separation = 18
theme_override_constants/icon_max_width = 20 theme_override_constants/icon_max_width = 20
@ -252,7 +362,7 @@ text = "Items"
icon = ExtResource("6_ikm1n") icon = ExtResource("6_ikm1n")
alignment = 0 alignment = 0
[node name="RunButton" type="Button" parent="MarginContainer/HBoxContainer/MainBattleMenu"] [node name="RunButton" type="Button" parent="BottomMarginContainer/HBoxContainer/MainBattleMenu"]
layout_mode = 2 layout_mode = 2
theme_override_constants/h_separation = 18 theme_override_constants/h_separation = 18
theme_override_constants/icon_max_width = 20 theme_override_constants/icon_max_width = 20
@ -272,10 +382,10 @@ text = "Run"
icon = ExtResource("7_tihhr") icon = ExtResource("7_tihhr")
alignment = 0 alignment = 0
[node name="BattleMovesMenu" type="VBoxContainer" parent="MarginContainer/HBoxContainer"] [node name="BattleMovesMenu" type="VBoxContainer" parent="BottomMarginContainer/HBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
visible = false visible = false
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 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: func _process(delta: float) -> void:
simulate_joystick_motion(JOY_AXIS_RIGHT_X, delta_position.x * delta * speed, 0) 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) delta_position *= (1 - damping_factor)
func _gui_input(event: InputEvent) -> void: 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: func show_battle_ui(p_visible = true) -> void:
battle_ui.visible = p_visible battle_ui.visible = p_visible
battle_ui.update()
func _on_ingame_controls_menu_button_clicked() -> void: func _on_ingame_controls_menu_button_clicked() -> void:
ingame_menu.visible = true ingame_menu.visible = true