How to paint CollisionShape2d in Area2D?

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

Hi guys, I’m creating a paiting game, so I have the image as the background, and I wanna create some Area2D as paiting area.

And when I click on the Area2D, it should paint the CollisionShape2D with the selected color.

How can I paint CollisionShape2D?

:bust_in_silhouette: Reply From: gioele

I don’t think CollisionShape2D can be colored.

But you could make a scene tree like this:

  • Area2D
  • CollisionShape2D
  • Poligon2D
  • Tween

When you detect a click in the Area2D you can change visibility and color (or modulate) of polygon to obtain the effect you want (you can use Tween to animate the color change).