Here is the code, Ive tried to manually type in the function name I connected. But it still doesnt work.
public class Atom : RigidBody2D
{
public int atomSize = 50;
[Export]
public float speed = 1f;
Vector2 velocity = new Vector2();
Vector2 target;
public override void _Ready()
{
}
public override void _PhysicsProcess(float delta)
{
GetInput();
SetLinearVelocity(velocity);
}
void GetInput()
{
target = GetGlobalMousePosition();
float distance = Mathf.Sqrt(((target.x - Position.x)*(target.x - Position.x)) + ((target.y - Position.y)*(target.y - Position.y)));
if(distance > 512f)
distance = 512f;
velocity = (target - Position).Normalized() * speed * distance;
}
private void _OnCollisionEnter(Node body)
{
GD.Print("Boooom");
if(body.IsInGroup("Proton"))
{
atomSize += 1;
Scale = new Vector2(1.5f, 1.5f);
}
else if(body.IsInGroup("Electron"))
{
atomSize += 1;
Scale = new Vector2(0.75f, 0.75f);
}
}
}