If I understand the question, you want to process a mouse click event, but only when it's on the tower icon instead of anywhere inside the collision shape. If that's the case, you can just include 2 CollisionShape2D
nodes (one for the range, and one just covering the tower icon) like this. That could look like this in the scene tree.
Tower (Area2D)
- range (ColliisonShape2D for tower range)
- click (CollisionShape2D for mouse click)
Then, in your input handler, you just need to check the value of the passed shape_idx
argument, which indicates which collisionshape was clicked). So, something like:
func _on_Area2D_input_event(viewport, event, shape_idx):
if event is InputEventMouseButton and event.pressed && shape_idx == 1:
print("Tower clicked")
Note, the clicking on the "range" collision shape will set shape_idx
to 0 and clicking on the click
collision shape will set shape_idx
to 1