I try to make a game like first game in Godot tutorial
When i test the game, debug show below error:
E 0:00:11.372 _call_function: Error calling deferred method: 'RigidBody2D(Mod.gd)::set_monitoring': Method not found..<C++ Source> core/message_queue.cpp:243 @ _call_function()
and when my enemies spawn it was stuck in the edge of screen.
below is my code:
extends RigidBody2D
export (int) var MIN_SPEED
export (int) var MAX_SPEED
var mob_types = ["mobb", "mobg", "mobr", "moby"]
func _ready():
$MobSprite.animation = mob_types[randi() % mob_types.size()]
$AnimationPlayer.play("mobrotate")
func _on_VisibilityNotifier2D_screen_exited():
queue_free()
func collected():
# limit collision to single time
call_deferred("set_monitoring", false)
queue_free()
Please help me fix this problem
Thanks you