fixed camera controls
This commit is contained in:
parent
cd62e12389
commit
d6a0911801
78 changed files with 4044 additions and 81 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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%
|
||||
|
|
|
|||
|
|
@ -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="."]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue