mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-24 17:14:23 +00:00
Add a get_via_group
method to Cursor
This commit is contained in:
parent
549dc2a1b3
commit
3d9233f01f
1 changed files with 7 additions and 0 deletions
|
@ -7,5 +7,12 @@ class_name Cursor
|
|||
@onready var game := MainGame.get_via_group(self)
|
||||
|
||||
|
||||
static func get_via_group(node: Node) -> MainGame:
|
||||
var result = node.get_tree().get_nodes_in_group("cursor")
|
||||
if result.is_empty():
|
||||
return null
|
||||
return result[0]
|
||||
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
move_and_collide(game.camera.get_global_mouse_position() - global_position)
|
||||
|
|
Loading…
Reference in a new issue