Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

To erase parts of the image, I looped through all the pixels that were going to be erased and changed their color to clear with this nested for loop:

for (int x = relativePos.x-7; x <= relativePos.x+7; x++)
{
    for (int y = relativePos.y - 7; y <= relativePos.y + 7; y++)
    {
        erasingTexture.SetPixel(x,y,Color.clear);
    }
}
erasingTexture.Apply();

Here, relativePos is a Vector2Int that stores the position of the player on the render texture, and erasingTexture is the Texture2D that is being erased. It was pretty simple actually, although it’s probably not the fastest way of doing it.

I managed to reproduce it in Godot thanks to your explanations ! You helped me so much since I tried doing that a long time ago but failed to find a way. Thank you very much for taking the time to explain and once again good job on the jam, I'll be sure to check your future games keep up the good work !

Thank you and you’re welcome!