diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2025-01-14 14:38:52 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2025-01-14 14:38:52 +0100 |
commit | e8f03c4d6a94aa16b3587bdce525cf0cf7c6c6c3 (patch) | |
tree | d8d5a78a0872b86c3b40089e465120883669542b /ui/cursor.gd | |
parent | b75cc72c4e10bd652330b6d2bd99f3fd9129a3b3 (diff) |
next commit
Diffstat (limited to 'ui/cursor.gd')
-rw-r--r-- | ui/cursor.gd | 19 |
1 files changed, 15 insertions, 4 deletions
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 |