There's an example of damaging targets here, but it's in the middle of the tutorial and may be hard to understand without reading through the preceding steps:
https://docs.godotengine.org/en/stable/tutorials/3d/fps_tutorial/part_four.html#adding-breakable-targets
It's 3D, so you would need to make the necessary adjustments for 2D.