fixed camera controls

This commit is contained in:
Luca 2024-11-17 13:06:55 +01:00
parent cd62e12389
commit d6a0911801
78 changed files with 4044 additions and 81 deletions

View file

@ -34,10 +34,11 @@ func update() -> void:
enemy_monster_healthbar.value = player.enemy.data.current_health
func _on_battle_button_pressed() -> void:
print("attacking enemy")
Utils.get_player().attack_enemy()
func _on_party_button_pressed() -> void:
Utils.get_player().catch_enemy()
func set_message(msg: String) -> void:
%Message.text = msg
@ -53,3 +54,4 @@ func enable() -> void:
%PartyButton.disabled = false
%ItemsButton.disabled = false
%RunButton.disabled = false

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=13 format=3 uid="uid://dyroahq85mhws"]
[ext_resource type="Script" path="res://ui/battle_ui/battle_ui.gd" id="1_jyqir"]
[ext_resource type="Script" uid="uid://cgg3sy2qd5352" path="res://ui/battle_ui/battle_ui.gd" id="1_jyqir"]
[ext_resource type="Texture2D" uid="uid://ve2k0qrfpwxw" path="res://assets/textures/Generic/Vector/generic_button_circle_fill.svg" id="2_keyyt"]
[ext_resource type="Texture2D" uid="uid://4t8cotroofge" path="res://assets/textures/Game Icons/Vector/2x/upRight.png" id="3_fa6tk"]
[ext_resource type="Texture2D" uid="uid://cxry7h4q17lir" path="res://assets/textures/Game Icons/Vector/2x/star.png" id="4_saqy8"]
@ -362,3 +362,4 @@ layout_mode = 2
size_flags_horizontal = 3
[connection signal="pressed" from="BottomMarginContainer/VBoxContainer/HBoxContainer/MainBattleMenu/BattleButton" to="." method="_on_battle_button_pressed"]
[connection signal="pressed" from="BottomMarginContainer/VBoxContainer/HBoxContainer/MainBattleMenu/PartyButton" to="." method="_on_party_button_pressed"]

View file

@ -2,12 +2,11 @@ extends Control
var pressed: bool = false
var previous_position : Vector2 = Vector2.ZERO
var speed : float = 0.5
var delta_position: Vector2 = Vector2.ZERO
var damping_factor: float = 0.08
var damping_factor: float = 0.15
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, 0)
delta_position *= (1 - damping_factor)
func _gui_input(event: InputEvent) -> void:
@ -25,7 +24,7 @@ func _gui_input(event: InputEvent) -> void:
previous_position = Vector2.ZERO
if pressed and event is InputEventScreenDrag:
delta_position = clamp(previous_position - event.position, Vector2(-10, -10), Vector2(10, 10))
delta_position = previous_position - event.position
# finally update the previous position
previous_position = event.position

View file

@ -34,7 +34,7 @@ func _on_settings_button_pressed() -> void:
SoundManager.play_sound_effect("ui_click", "UI")
settings_button_clicked.emit()
# the save function should work as follows:
# the save function works as follows:
# a percentage sign with 0% should be shown
# the player has to hold down the save button
# during holding down, the percentage increases until 100%

View file

@ -1,8 +1,8 @@
[gd_scene load_steps=11 format=3 uid="uid://1anjhvi173g3"]
[ext_resource type="Script" path="res://ui/ingame_controls/ingame_controls.gd" id="1_iw1sp"]
[ext_resource type="Script" uid="uid://dylk55426bidt" path="res://ui/ingame_controls/ingame_controls.gd" id="1_iw1sp"]
[ext_resource type="Texture2D" uid="uid://2vxx2waofxpw" path="res://assets/textures/Xbox Series/Vector/xbox_button_menu_outline.svg" id="1_wr5sh"]
[ext_resource type="Script" path="res://ui/ingame_controls/joystick.gd" id="2_pyri2"]
[ext_resource type="Script" uid="uid://cuik3h7xk1ung" path="res://ui/ingame_controls/joystick.gd" id="2_pyri2"]
[ext_resource type="Texture2D" uid="uid://8anyvhkcy4ng" path="res://assets/textures/Xbox Series/Vector/xbox_button_a.svg" id="3_lgi8v"]
[ext_resource type="Texture2D" uid="uid://cbep021ykpb23" path="res://assets/textures/Game Icons/Vector/2x/save.png" id="5_2pil1"]
[ext_resource type="Texture2D" uid="uid://bwyoxxotdisyp" path="res://assets/textures/Game Icons/Vector/2x/gear.png" id="5_nwwsc"]
@ -23,14 +23,11 @@ corner_detail = 12
[node name="IngameControls" type="Control"]
layout_mode = 3
anchors_preset = 12
anchor_top = 1.0
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 0
size_flags_horizontal = 3
size_flags_vertical = 3
grow_vertical = 2
script = ExtResource("1_iw1sp")
[node name="MarginContainer" type="MarginContainer" parent="."]

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=7 format=3 uid="uid://b5y7pdfe6ougf"]
[ext_resource type="Script" path="res://ui/ui.gd" id="1_fkttd"]
[ext_resource type="Script" path="res://ui/ingame_controls/camera_controls.gd" id="1_x56x6"]
[ext_resource type="Script" uid="uid://bhajdnao0awhr" path="res://ui/ui.gd" id="1_fkttd"]
[ext_resource type="Script" uid="uid://cp2jtkql0gaci" path="res://ui/ingame_controls/camera_controls.gd" id="1_x56x6"]
[ext_resource type="PackedScene" uid="uid://dt00rjsodtady" path="res://ui/main_menu/main_menu.tscn" id="3_tcmm8"]
[ext_resource type="PackedScene" uid="uid://1anjhvi173g3" path="res://ui/ingame_controls/ingame_controls.tscn" id="4_likk0"]
[ext_resource type="PackedScene" uid="uid://bbvbnrcjatkrb" path="res://ui/ingame_menu/ingame_menu.tscn" id="5_qjqu1"]
@ -59,9 +59,13 @@ visible = false
[node name="IngameControls" parent="." instance=ExtResource("4_likk0")]
unique_name_in_owner = true
visible = false
anchors_preset = 12
anchor_top = 1.0
grow_vertical = 0
[node name="IngameMenu" parent="." instance=ExtResource("5_qjqu1")]
unique_name_in_owner = true
visible = false
[node name="BattleUI" parent="." instance=ExtResource("6_uxa7j")]
visible = false