added save mechanic

This commit is contained in:
Luca 2024-09-20 21:36:47 +02:00
parent b24117740b
commit 04873e3880
226 changed files with 4577 additions and 38 deletions

View file

@ -16,7 +16,7 @@ var pressed: bool = false
var rotation_delta: Vector2 = Vector2(0, 0)
func _ready() -> void:
thumbstick.custom_minimum_size = Vector2(size.x, size.x) * thumbstick_size_factor
#thumbstick.custom_minimum_size = Vector2(size.x, size.x) * thumbstick_size_factor
thumbstick.position = middle - thumbstick.size / 2.0
func _on_gui_input(event: InputEvent) -> void:
@ -31,7 +31,6 @@ func _on_gui_input(event: InputEvent) -> void:
if event is InputEventScreenTouch and pressed == true:
Input.action_press("ui_select")
print("Talk")
pressed = false
if event is InputEventScreenTouch and event.is_pressed():
@ -44,7 +43,13 @@ func _on_gui_input(event: InputEvent) -> void:
thumbstick.texture = drag_texture
var touch_position = event.position
thumbstick.position = touch_position - thumbstick.size / 2.0
# visual thumbstick movement
var thumbstick_position = touch_position - thumbstick.size / 2.0
#var clamped_thumbstick_position = thumbstick_position.clampf(-40.0, 40.0)
thumbstick.position = thumbstick_position
# actual value
var _delta = middle - touch_position
var direction = _delta.normalized()
simulate_joystick_motion(JOY_AXIS_LEFT_X, -direction.x)
@ -59,10 +64,6 @@ func simulate_joystick_motion(axis: int, value: float, device_id: int = 0) -> vo
Input.parse_input_event(joystick_event) # Process the event
func _on_resized() -> void:
print("Size changed to %s" % size)
middle = size / 2.0
thumbstick = get_node("Thumbstick")
#if thumbstick:
thumbstick.custom_minimum_size = Vector2(size.x, size.x) * thumbstick_size_factor
thumbstick.position = middle - thumbstick.size / 2.0