From e8f03c4d6a94aa16b3587bdce525cf0cf7c6c6c3 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Tue, 14 Jan 2025 14:38:52 +0100 Subject: next commit --- ui/cursor.gd | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'ui/cursor.gd') diff --git a/ui/cursor.gd b/ui/cursor.gd index 947356e..1264789 100644 --- a/ui/cursor.gd +++ b/ui/cursor.gd @@ -4,13 +4,24 @@ extends Node2D var current_action_idx := 0 var last_action_idx := 0 +var actions: Actions + func _ready() -> void: + if not FileAccess.file_exists("res://client_data/data/sprite/cursors/actions.tscn"): + return + + actions = load("res://client_data/data/sprite/cursors/actions.tscn").instantiate() + add_child(actions) + Input.mouse_mode = Input.MOUSE_MODE_HIDDEN - $Actions.play("000") + actions.play("000") func _process(_delta: float) -> void: + if not actions: + return + global_position = get_global_mouse_position() if Input.get_current_cursor_shape() == Input.CURSOR_ARROW: @@ -24,10 +35,10 @@ func _process(_delta: float) -> void: if current_action_idx != last_action_idx: if current_action_idx == -1: Input.mouse_mode = Input.MOUSE_MODE_VISIBLE - $Actions.visible = false + actions.visible = false else: Input.mouse_mode = Input.MOUSE_MODE_HIDDEN - $Actions.visible = true - $Actions.play(str(current_action_idx).pad_zeros(3)) + actions.visible = true + actions.play(str(current_action_idx).pad_zeros(3)) last_action_idx = current_action_idx -- cgit v1.2.3