Hi all
I tried to use signal in my code but i get a error when my character enters the detection zone and the code try to execute the methode
i make the signal connection in the code.
can any body tell me whats going wrong :/
error: E 0:00:08.376 emit_signal: Error calling method from signal 'body_entered': 'KinematicBody2D(flyEnemy.cs)::onHurtboxBodyEntered': Method not found..
<C++ Source> core/object.cpp:1228 @ emit_signal()
---
using Godot;
using System;
public class flyEnemy : KinematicBody2D
{
[Export]
float GRAVITY = 500;
[Export]
float speed =200;
private Vector2 motion = Vector2.Zero;
public override void _Ready()
{
GetNode("hurtbox").Connect("body_entered", this, nameof(onHurtboxBodyEntered));
}
public override void _PhysicsProcess(float delta){
motion.y += GRAVITY * delta;
motion = MoveAndSlide(motion, new Vector2(0, -1));
}
private void onHurtboxBodyEntered() => QueueFree();
}
---