Finix
1
Godot Version
v4.6.1
QuestionAsk your question here! Try to give as many details as possible
This is the code, but when i test and collect the coins (moneda) on llvl 1 jumps this error
What can i do?
wchc
2
The error mentions the body_entered signal, but the code you provided has no such signal mentioned, so it can’t be be this script.
The body_entered function is being called on an object that doesn't exist. Perhaps the object existed at one point, but your program freed it.
Finix
4
extends Node
@export var area_2d: Area2D
var contenedor_monedas: ContenedorMonedas
func _ready() → void:
area_2d.body_entered.connect(_recogida)
func _recogida(_body):
contenedor_monedas.moneda_recogida()
queue_free()
This is the other part of the code
Your export variable area_2d must be assigned in the editor, click on the node this script is attached to and check the inspector