mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-22 08:04:23 +00:00
Create Cursor
matching mouse position on every physics timestep
This commit is contained in:
parent
fa502ba267
commit
446083dd73
2 changed files with 17 additions and 0 deletions
11
scenes/game/cursor.gd
Normal file
11
scenes/game/cursor.gd
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
extends Node2D
|
||||||
|
class_name Cursor
|
||||||
|
|
||||||
|
## A [Node2D] syncing its position with the mouse on each physics timestep.
|
||||||
|
|
||||||
|
|
||||||
|
@onready var game := MainGame.get_ancestor(self)
|
||||||
|
|
||||||
|
|
||||||
|
func _physics_process(_delta: float) -> void:
|
||||||
|
global_position = game.camera.get_global_mouse_position()
|
6
scenes/game/cursor.tscn
Normal file
6
scenes/game/cursor.tscn
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://col1q3elvkfwk"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scenes/game/cursor.gd" id="1_1og6v"]
|
||||||
|
|
||||||
|
[node name="Cursor" type="Node2D"]
|
||||||
|
script = ExtResource("1_1og6v")
|
Loading…
Reference in a new issue