added first theme progress and switched all files to use static typing
This commit is contained in:
parent
c9458f3627
commit
b5ace17da9
2665 changed files with 50249 additions and 476 deletions
|
|
@ -26,13 +26,13 @@ func _gui_input(event: InputEvent) -> void:
|
|||
|
||||
if pressed and event is InputEventScreenDrag:
|
||||
delta_position = clamp(previous_position - event.position, Vector2(-10, -10), Vector2(10, 10))
|
||||
|
||||
|
||||
# finally update the previous position
|
||||
previous_position = event.position
|
||||
|
||||
func simulate_joystick_motion(axis: int, value: float, device_id: int = 0) -> void:
|
||||
var joystick_event = InputEventJoypadMotion.new()
|
||||
joystick_event.device = device_id
|
||||
func simulate_joystick_motion(axis: JoyAxis, value: float, device_id: int = 0) -> void:
|
||||
var joystick_event: InputEventJoypadMotion = InputEventJoypadMotion.new()
|
||||
joystick_event.device = device_id
|
||||
joystick_event.axis = axis # Axis index (e.g., 0 for X-axis, 1 for Y-axis)
|
||||
joystick_event.axis_value = value # Value of the axis, typically between -1 and 1
|
||||
|
||||
|
|
|
|||
|
|
@ -12,15 +12,15 @@ var save_button_held_down: bool = false
|
|||
var save_timer: float = 0.0
|
||||
var time_to_save: float = 0.8 # second
|
||||
|
||||
func _process(delta) -> void:
|
||||
func _process(delta: float) -> void:
|
||||
if save_button_held_down:
|
||||
if save_timer >= time_to_save:
|
||||
save_timer_reached.emit()
|
||||
save_timer = 0.0
|
||||
|
||||
|
||||
# Save the game
|
||||
SaveManager.save_game()
|
||||
|
||||
|
||||
save_button_held_down = false
|
||||
else:
|
||||
save_timer_incremented.emit(ceili((save_timer / time_to_save) * 100))
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ theme_override_styles/panel = SubResource("StyleBoxFlat_nfkty")
|
|||
script = ExtResource("2_pyri2")
|
||||
|
||||
[node name="Thumbstick" type="TextureRect" parent="MarginContainer/HBoxContainer/Left/JoystickPanel"]
|
||||
unique_name_in_owner = true
|
||||
self_modulate = Color(0, 0, 0, 0.392157)
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
extends Panel
|
||||
|
||||
@onready var talk_a_texture = preload("res://assets/textures/Xbox Series/Vector/xbox_button_a.svg")
|
||||
@onready var drag_texture = preload("res://assets/textures/Generic/Vector/generic_button_circle.svg")
|
||||
@onready var thumbstick = $Thumbstick
|
||||
var thumbstick_size_factor = 0.5
|
||||
@onready var talk_a_texture: CompressedTexture2D = preload("res://assets/textures/Xbox Series/Vector/xbox_button_a.svg")
|
||||
@onready var drag_texture: CompressedTexture2D = preload("res://assets/textures/Generic/Vector/generic_button_circle.svg")
|
||||
@onready var thumbstick: TextureRect = %Thumbstick
|
||||
var thumbstick_size_factor: float = 0.5
|
||||
|
||||
|
||||
var middle: Vector2 = Vector2(100, 100)
|
||||
|
|
@ -18,46 +18,46 @@ var rotation_delta: Vector2 = Vector2(0, 0)
|
|||
func _ready() -> void:
|
||||
#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:
|
||||
if event is not InputEventScreenTouch and event is not InputEventScreenDrag:
|
||||
return
|
||||
|
||||
|
||||
if event.is_pressed() == false:
|
||||
simulate_joystick_motion(JOY_AXIS_LEFT_X, Vector2.ZERO.x)
|
||||
simulate_joystick_motion(JOY_AXIS_LEFT_Y, Vector2.ZERO.y)
|
||||
thumbstick.position = middle - thumbstick.size / 2.0
|
||||
thumbstick.texture = talk_a_texture
|
||||
|
||||
|
||||
if event is InputEventScreenTouch and pressed == true:
|
||||
Input.action_press("ui_select")
|
||||
pressed = false
|
||||
|
||||
|
||||
if event is InputEventScreenTouch and event.is_pressed():
|
||||
pressed = true
|
||||
|
||||
|
||||
if event is InputEventScreenDrag:
|
||||
# cancel the talking action
|
||||
pressed = false
|
||||
# swap to drag texture
|
||||
thumbstick.texture = drag_texture
|
||||
|
||||
var touch_position = event.position
|
||||
|
||||
|
||||
var touch_position: Vector2 = event.position
|
||||
|
||||
# visual thumbstick movement
|
||||
var thumbstick_position = touch_position - thumbstick.size / 2.0
|
||||
var thumbstick_position: Vector2 = 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()
|
||||
var _delta: Vector2 = middle - touch_position
|
||||
var direction: Vector2 = _delta.normalized()
|
||||
simulate_joystick_motion(JOY_AXIS_LEFT_X, -direction.x)
|
||||
simulate_joystick_motion(JOY_AXIS_LEFT_Y, -direction.y)
|
||||
|
||||
func simulate_joystick_motion(axis: int, value: float, device_id: int = 0) -> void:
|
||||
var joystick_event = InputEventJoypadMotion.new()
|
||||
joystick_event.device = device_id
|
||||
func simulate_joystick_motion(axis: JoyAxis, value: float, device_id: int = 0) -> void:
|
||||
var joystick_event: InputEventJoypadMotion = InputEventJoypadMotion.new()
|
||||
joystick_event.device = device_id
|
||||
joystick_event.axis = axis # Axis index (e.g., 0 for X-axis, 1 for Y-axis)
|
||||
joystick_event.axis_value = value # Value of the axis, typically between -1 and 1
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue