Change color on collision

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Jorin G.
:warning: Old Version Published before Godot 3 was released.

Hi, everyone! My friend and I are making a 2D block-breaker game. Once we’ve drawn the blocks, how do we make them change color on contact with the ball sprite?

We’re starting out by doing the “Simple 2D Game” tutorial at the docs website

:bust_in_silhouette: Reply From: eons

The question is too generic, more details are needed, and these are 2 separate things but here are some ideas:

To do something on collision, depending on the game structure could be detecting collisions on the blocks or on the ball, or overlaps in the case of areas, during process or with signals, decide a way to work with your objects and use what you think is the best approach.

To change color of a sprite, can be via the modulate, using a shader for a special effect, having a hidden or transparent sprite on top to change it, making a spritesheet with all the modes and changing frames, etc.