What I am doing is trying to get it to do something when an enemy(a kinematic body2d in a group called 'Enemy') collides with the player (a kinematicbody2d).
The problem is that when I use an if statement to check if the collider is in a group, the collision seems to return null and also it freaks out since my tilemap doesn't have a collider on it.
func _process(delta):
var collision_info = move_and_collide(Vector2(0,0))
if collision_info.collider.is_in_group('Enemy'):
print('Dead')
Once I start it and try to move, It stops and the debugger gives me this error:
Invalid get index 'collider' (on base: 'null instance').
It also says that collisioninfo = [null]
Let me know if you need anymore information to help me solve the issue please.
P.S. Every child node including the collision shape of the enemy is in the group "Enemy".
P.P.S When I try using the code you gave me (with a vector2(0,0) as the argument for the moveandcollide function) it returns null for collisioninfo and groups variables.