global mouse pos

This commit is contained in:
2024-08-31 19:16:11 +02:00
parent 4a06557419
commit 6faa06f036
4 changed files with 9 additions and 11 deletions

View File

@@ -7,6 +7,8 @@ extends Node
@onready var plant_scene = preload("res://objects/Plant.tscn")
@onready var timer: Timer = $Timer
@export var camera: Camera2D
func _unhandled_input(event: InputEvent) -> void:
if Input.is_action_just_pressed("plant") and timer.is_stopped():
@@ -14,5 +16,5 @@ func _unhandled_input(event: InputEvent) -> void:
var plant = plant_scene.instantiate()
add_child(plant)
plant.init(chosen_type)
plant.plant(event.position)
plant.plant(camera.get_global_mouse_position())
timer.start()