I made it so that objects are dynamically spawned in the scene, but I need to make it so that the player(Area2D) can interact with them. But he can't.
Here's collision code
func _on_Meteor_area_entered(area):
queue_free()
hp - 5
print(hp)
Spawning objects code:
func _on_Timer_timeout():
var enemy = enemyscene.instance()
coll.shape = RectangleShape2D.new()
rng.randomize()
enemy.position.y = rng.randi_range(40, 560)
enemy.position.x = 1415
add_child(enemy)