summaryrefslogtreecommitdiff
path: root/ui/cursor.gd
diff options
context:
space:
mode:
Diffstat (limited to 'ui/cursor.gd')
-rw-r--r--ui/cursor.gd19
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