mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-21 23:54:23 +00:00
Create MatchMousePosition
behaviour
This commit is contained in:
parent
114e386835
commit
4e1ba1311f
2 changed files with 17 additions and 0 deletions
11
behaviours/match_mouse_position.gd
Normal file
11
behaviours/match_mouse_position.gd
Normal file
|
@ -0,0 +1,11 @@
|
|||
extends Node
|
||||
class_name MatchMousePosition
|
||||
|
||||
|
||||
@onready var parent: Node2D = get_parent()
|
||||
@onready var game := MainGame.get_ancestor(self)
|
||||
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
var global_mouse_position: Vector2 = game.camera.get_global_mouse_position()
|
||||
parent.global_position = global_mouse_position
|
6
behaviours/match_mouse_position.tscn
Normal file
6
behaviours/match_mouse_position.tscn
Normal file
|
@ -0,0 +1,6 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://cbidjjvi0ia6i"]
|
||||
|
||||
[ext_resource type="Script" path="res://behaviours/match_mouse_position.gd" id="1_1h6oc"]
|
||||
|
||||
[node name="MatchMousePosition" type="Node"]
|
||||
script = ExtResource("1_1h6oc")
|
Loading…
Reference in a new issue