Problem -
See the game description and game code below the problem statement to know what I want to ask. Thank you.
The collision are working fine when I collide my red with green by moving opposite to direction of green's movement and touching it.
However if I move in the same direction of green's movement and collide with it it doesn't get destroyed, and it happens tht I am just pushing the green block.
And I want to actually destroy it coming from any direction.
Game description -
Basically, I have two rectangular bodies(kinematic2d) with rectangular sprites and collisionshape2d covering full. Let me call them red and green. Red being user always positioned at mouse position and green being enemies coming at random on screen with different speeds and positions.

Ignore the violet color ones for now.
Code-
For the green I have used collision masks and layers correctly so that it ignores collision with each other but collides with red and code snippet being-
func _fixed_process(delta):
if(is_colliding()==true):
queue_free()
Full code of green if you wish to see-
#script - green rectangle object
extends KinematicBody2D
var velocity = Vector2()
func _ready():
var x = rand_range(0,512)
var y = rand_range(0,256)
var x_sp = rand_range(-150,150)
var y_sp = rand_range(-150,150)
velocity.x = x_sp
velocity.y = y_sp
set_pos(Vector2(x,y))
add_to_group("grp_green")
set_fixed_process(true)
pass
func _fixed_process(delta):
if(is_colliding()==true):
queue_free()
var motion = delta*velocity
move(motion)
var curr_speed = motion
var curr_pos = get_pos()
if(curr_speed.x >= 0 && curr_speed.y>=0):
if(curr_pos.x >= 512):
set_pos(Vector2(0,curr_pos.y))
if(curr_pos.y >= 256):
set_pos(Vector2(curr_pos.x,0))
elif (curr_speed.x <= 0 && curr_speed.y>=0):
if(curr_pos.x <= 0):
set_pos(Vector2(512,curr_pos.y))
if(curr_pos.y >= 256):
set_pos(Vector2(curr_pos.x,0))
elif (curr_speed.x <= 0 && curr_speed.y<=0):
if(curr_pos.x <= 0):
set_pos(Vector2(512,curr_pos.y))
if(curr_pos.y <= 0):
set_pos(Vector2(curr_pos.x,256))
elif (curr_speed.x >= 0 && curr_speed.y<=0):
if(curr_pos.x >= 512):
set_pos(Vector2(0,curr_pos.y))
if(curr_pos.y <= 0):
set_pos(Vector2(curr_pos.x,256))
pass
And code for red-
#script - me to the cursor position
extends KinematicBody2D
func _ready():
set_fixed_process(true)
pass
func _fixed_process(delta):
set_pos(get_global_mouse_pos())
pass