Skip to content

Instantly share code, notes, and snippets.

@iSarCasm
Last active January 18, 2016 11:46
Show Gist options
  • Save iSarCasm/d5686fec91fad6fd9085 to your computer and use it in GitHub Desktop.
Save iSarCasm/d5686fec91fad6fd9085 to your computer and use it in GitHub Desktop.
for(int y = 0; y < aHeight; y++)
{
for(int x = 0; x < aWidth; x++)
{
int basePxPosition_x = (x - offset_x);
int basePxPosition_y = (y - offset_y);
int copyPxPosition_x = basePxPosition_x - offset_w + offset_x;
int copyPxPosition_y = basePxPosition_y - offset_h + offset_y;
if (CutOff(basePxPosition_x, basePxPosition_y, aWidth, aHeight)) {
newTexturePixels[x + y*aWidth] = new Color(0, 0, 0, 0);
cutOff = true;
} else if (GroundAlpha(basePxPosition_x, basePxPosition_y, aWidth, aBaseTexturePixels)) {
newTexturePixels[x + y*aWidth] = new Color(0, 0, 0, 0);
} else if (CutOff(copyPxPosition_x, copyPxPosition_y, cWidth, cHeight)) {
newTexturePixels[x + y*aWidth] = new Color(0, 0, 0, 0);
} else {
newTexturePixels[x + y*aWidth] = aCopyTexturePixels[copyPxPosition_x + copyPxPosition_y*cWidth];
}
}
}
aReturnTexture.SetPixels(newTexturePixels);
aReturnTexture.Apply();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment