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!
1 Answer
1I have not tested yet, but I found this surfing on the net:
Texture2D.SetPixel
Here is it the sintax:
Texture2D.SetPixel(x: int, y: int, color: Color)
At the end you should write
Texture2D.Apply()
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);
Scratch.Apply();
I’ve not tested yet, so I don’t know if it works.
Sorry for my bad English
Bye!
I need help with the same sort of thing.
– CelovisThis question is ages old, but did you ever get this working? The setpixel method seems to be a bit processor heavy to call in an update method...
– n00s