What's the best way to dynamically "erase" parts of a sprite?

Basically I want to make an effect that is similar to a lottery ticket scratch off effect. The player needs to touch the device to erase the upper level sprite and reveal the sprite image underneath it. I don’t know how to do this… any advice is appreciated!

I have not tested yet, but I found this surfing on the net:

Here is it the sintax:

    Texture2D.SetPixel(x: int, y: int, color: Color)

At the end you should write


In this way, it applies all changes.
So, you could write something like this:

    var trasparentColor : Color = Color.white; //define a new variable color called trasparenColor

    trasparentColor.a = 0; //the component alpha (a) of trasparentColor is set to zero (zero = trasparent; one = opaque)

    Scratch.SetPixel(coordinateX, coordinateY, trasparentColor);


I’ve not tested yet, so I don’t know if it works.

Sorry for my bad English :slight_smile: Bye!