I am new to both Godot and C#, so I will try to be as clear as possible in my question.
I am trying to recreate Pong by following a tutorial that uses GDScript (not otpimal, but it forces me to "translate" stuff from one language to the other). The problem I'm currently facing is that I want to verify if the ball is hitting the racket or the walls by using groups. For this, the MoveAndCollide() method is both moving the ball and returning the colliding KinematicBody2D object in this "collision" variable.
Godot.KinematicCollision2D collision = MoveAndCollide(direction * delta);
if (collision != null)
{
direction = direction.Bounce(collision.Normal);
if (collision.Collider.IsInGroup("rackets") //the script doesn't recognize the method IsInGroup, so this line does not work
{
//change the ball's speed
}
}
In the tutorial, the author uses the method is_in_group, but it seems to not exist in the mono version.