Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Xero |
I made a kinematic body that collects gems which are areas (children of spatial)
extends Node
var score = 0
var score_per_gem = 1
func _on_gem1_body_entered():
score = score+score_per_gem
get_tree().set_free()
func _on_gem2_body_entered():
score = score+score_per_gem
get_tree().set_free()
func _on_gem3_body_entered():
score = score+score_per_gem
get_tree().set_free()
func _on_gem4_body_entered():
score = score+score_per_gem
get_tree().set_free()
and so on till gem9
Then i got this error in the debugger:
E 0:00:02.793 emit_signal: Error calling method from signal ‘body_entered’: ‘Spatial(gems.gd)::_on_gem2_body_entered’: Method expected 0 arguments, but called with 1…
<C++ Source> core/object.cpp:1228 @ emit_signal()
Tried adding body as an argument, game freezed and gave this message in debugger