Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | SereneMango |
Basically Interactable (the emitter code) is for more than one area (the current scene I’m working with has 3). What I want is, when the KinematicBody (the player) is in a certain Area, that one Area will send its name to the Text Box.
I’m having an issue with signals. I get this error when the KinematicBody enters one Area (and also when the scene is loaded, curiously):
E 0:00:05.732 emit_signal: Error calling method from signal 'body_entered': 'Control(Textbox.gd)::get_dialog': Method expected 1 arguments, but called with 2..
<C++ Source> core/object.cpp:1228 @ emit_signal()
Here are the codes for the emitter and the receiver, respectively:
Interactable
func _ready():
var textbox = get_node("../textbox")
self.connect("body_entered", textbox, "get_dialog", [self])
Textbox
func get_dialog(area):
var speaking = "res://Test/Text/_%D.json" % area
var file = File.new()
file.open(speaking, file.READ)
dialog = parse_json(file.get_as_text())
load_dialog()`