Allow me to explain my issue, I am using an Area2D node as something that the player has to click on to earn points, and I would like to know how I could make the click detection work for all nodes in a group, I've added my Area2D node to a group, and I have to instance it. Nothing happens when I click the instances, only when I click the original node.
extends Node2D
var score = 0
onready var clickme = preload("res://assets/ClickMe.tscn")
onready var clickmeinstance = clickme.instance()
func _on_ClickMe_input_event(_viewport, _event, _shape_idx):
if Input.is_mouse_button_pressed(1):
score+=1
clickmeinstance.position = Vector2(rand_range(0, 320), rand_range(0, 240)).round()
get_tree().get_root().call_deferred("add_child", clickmeinstance)
get_node("CanvasLayer/Score/ScoreLabel").text = str(score)