private void _on_BallBody_body_entered(Godot.Object otherBody) { Node2D ob = otherBody as Node2D; if (ob.GetName().Contains("Peg")) { ((Peg)ob).Collided(); } }
private void CheckCollectibles() { KinematicCollision2D collision = GetSlideCollision(0); Node2D body = (Node2D)collision.Collider; if (body.GetParent().GetParent().GetName().Contains("Collectible")) { GD.Print(body.GetParent().GetParent().GetParent().GetName()); ((Collectible)body.GetParent().GetParent()).Consume(); ((Node2D)body.GetParent()).QueueFree(); } else if (body.GetName().Contains("SceneSwitcher")) { ((SceneSwitcher)body).SwitchScene(); } }