diff --git a/behaviours/move_towards_mouse.gd b/behaviours/move_towards_mouse.gd index 4c8c561..14552b7 100644 --- a/behaviours/move_towards_mouse.gd +++ b/behaviours/move_towards_mouse.gd @@ -8,7 +8,7 @@ signal captured @export_range(-500, 500, 1) var speed: float = 100.0 -@onready var camera := MainGame.get_ancestor(self).camera +@onready var game := MainGame.get_ancestor(self) enum State { STILL, CAPTURED } @@ -17,7 +17,7 @@ var state: State = State.STILL func get_relative_mouse_position(): - var global_mouse_position: Vector2 = camera.get_global_mouse_position() + var global_mouse_position: Vector2 = game.camera.get_global_mouse_position() var relative_mouse_position: Vector2 = global_mouse_position - global_position return relative_mouse_position