vowowo8 func _on_Player_area_entered( area ):
if area.is_in_group("coins"):
area.pickup()
emit_signal("pickup", "coin")
So the question is, what is the area, is it Area2d type for c#? and what is area.pickup()? I know pickup method should be in coin file, but if area is area2d how can i get the pickup method from there?
My guess is that the ‘area’ argument is the coin node.
If this is attached to an area node’s area_entered function, then Godot will call it automatically when an area overlaps the area. In GDScript, this argument (area) will be the node object you overlapped with. Because GDScript is a dynamic language, you can just call methods/functions without needing to define its type.
For C# though, it is different because it is a typed language. I’m not sure which type Godot passes to the area_entered function in C#, but what you will need to do is take this type Godot passes, cast it to the coin type (check for null, if the cast is null it is not a coin), and then call the pickup function if it casts successfully.
I think the Godot documentation for C# shows how to cast and check, and it probably also shows what type is passed to the area_entered function. 🙂