changing the radius of my area2d collisionShape2D makes it stop working

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By JiaoZiKai

Hello, I am coming from Unity and am finding something I thought would be a very fast and simple test project rather difficult. I am trying to create a script of circles that detect when they collide with other circles, the larger one will absorb the smaller one. But when I resize the collision circle it just stops working all together. here is my code.

extends KinematicBody2D

var radius = 25
var pos = Vector2(0,0)
var col = Color(0,0,0)

var moveSpeed = 3
var movement = Vector2()
var maxSpeed = 4

var isShrinking = false
var isGrowing = false

func _draw():
	draw_circle(pos, radius, col)

func _process(delta):
	$CollisionShape2D.shape.radius = radius
	$Hit/CollisionShape2D.shape.radius = radius #this is the one with problems
	if Input.is_action_pressed("d"):
		movement.x += moveSpeed
	elif Input.is_action_pressed("a"):
		movement.x -= moveSpeed
	else :
		movement.x = 0
	if Input.is_action_pressed("w"):
		movement.y -= moveSpeed
	elif Input.is_action_pressed("s"):
		movement.y += moveSpeed
	else :
		movement.y = 0

	if Input.is_action_just_pressed("ui_up"):
		radius += 5

	if isShrinking:
	if isGrowing:

func _shrink():

func _grow():

func _on_Hit_area_entered(area):
	if area.get_parent().radius > radius:
		isShrinking = true
	elif area.get_parent().radius < radius:
		isGrowing = true

func _on_Hit_area_exited(area):
	isGrowing = false
	isShrinking = false

I cant figure out how to do this, I feel it should be very simple but I cant find anything about this. If you can help me find a better way of doing this I would be very grateful

:bust_in_silhouette: Reply From: Death of Shadows

I think it is because your Area2D’s collision shape is the same size as the solid KinematicBody2D collision shape. Try making the Area2D’s collision shape slightly bigger than the solid region:
$CollisionShape2D.shape.radius = radius-1 $Hit/CollisionShape2D.shape.radius = radius
I hope this helps!