Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | w32.deadcode | |
Old Version | Published before Godot 3 was released. |
hello
i’ve used godot for some time, but still am mostly a nooblet
having set up a lil tank, and getting it to shoot lazers, i proceeded to make them disappear upon hitting an obstacle. strangely enough, something goes wrong the moment body_enter signal is called.
i get this error (it doesn’t crash the game thou):
error calling method from signal (body_enter), expected 0 arguments
it’s really weird because the brackets in the “_hit()” function are empty (i assume this is where arguments usually reside?)
code, the object is an Area2D (sorry for raw paste, but i cant get the code frame thingy to work)
func _ready():
connect(“body_enter”,self,“_hit”)
func _process(delta):
v=Vector2(vb*sin(r)delta,vbcos(r)*delta)
set_rot(r)
get_node(‘sprit’).set_global_pos(self.get_global_pos().floor())
func _hit():
queue_free()
i used the body_enter signal many times in the past and this has never happened, so am quite confused. :<
Please, use the “code” button on the QA editor, don’t just paste it. To get it working, you should select your code, and then press it. (also, this is markdown, so if you just indent those lines with four spaces…)
Bojidar Marinov | 2016-02-29 13:34