2D multiplayer platformer using Godot Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

20 lines
653 B

class_name Cursor
extends Node2D
## Position of the cursor in HUD coordinates.
var hud_position: Vector2
func _ready() -> void:
Input.mouse_mode = Input.MOUSE_MODE_HIDDEN
func _notification(what: int) -> void:
# TODO: Keep mouse visible when it was pressed down in the game window.
# Meaning the game will continue to receive mouse move updates.
match what:
NOTIFICATION_WM_MOUSE_ENTER: visible = true
NOTIFICATION_WM_MOUSE_EXIT: visible = false
func _process(delta: float) -> void:
# FIXME: Fix flickering mouse position when player moves.
position = get_global_mouse_position()
hud_position = get_viewport().get_mouse_position()