24 lines
993 B
GDScript
24 lines
993 B
GDScript
extends Node
|
|
## Handle all the cursor appareance related stuff.
|
|
|
|
# Mapping 8 primary directions to custom cursor images
|
|
const DIRECTION_CURSOR_MAP = {
|
|
Vector2(-1, -1): preload("uid://bnwb6728ln3ae"),
|
|
Vector2(0, -1): preload("uid://cgx332aowj6dn"),
|
|
Vector2(1, -1): preload("uid://dmn7dlir4ohff"),
|
|
Vector2(1, 0): preload("uid://bwfy3euyxmi7j"),
|
|
Vector2(1, 1): preload("uid://cpklilc6jmw0d"),
|
|
Vector2(0, 1): preload("uid://cbr6j5g1ipdi4"),
|
|
Vector2(-1, 1): preload("uid://doia8nobwmv4n"),
|
|
Vector2(-1, 0): preload("uid://bqg7s8lukudkc"),
|
|
Vector2(0, 0): preload("uid://dp4ed16rb1754"),
|
|
}
|
|
var edge_scroll_vector = Vector2(1,1)
|
|
|
|
|
|
func _on_player_root_cursor_edge_scrolling(direction: Vector2) -> void:
|
|
if direction.length() > 0 or edge_scroll_vector.length() != 0:
|
|
#print("direction lenght = ",direction.length()," and stored vector is ", edge_scroll_vector.length())
|
|
edge_scroll_vector = direction
|
|
Input.set_custom_mouse_cursor(DIRECTION_CURSOR_MAP.get(direction))
|
|
print(direction)
|