Hi, I don’t know what I’m doing wrong. Can someone help me?
I have the following sprites compressed and respective colors
final int color[] = { -16776960, -10461715, -137067, -237988, -196613,
-12981001, -13839010, -14832074, -2794921, -32641, };
final String str = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACCCCCCCAAAAAAAACCCCCCCCAAAAAACCCCCCCCCCCAAAAAAADEEEDEEEDAAAAAADEEBEEEBEEDAAAAADDEEEDEEEDDAAABBDDDDBBBDBBBBABBBDDDDBBBDBBBBBBBBDDDDDDDDBDBABBBBDDDDDADDBDBABBBDDDDDDDDDDDCAAABDDDDDDDDDDDCAAAAADDDDDDDDDCCCAAAAADDDDDDDDCCCAAAAADDDAADDDCCCAAAADDDDADDDDACAAEEAAACCCCCCCAEEAEEEACCCCCCCCAEEEEECCCCCCCCCCCEEAEEEEDEEEDEEEDEEEEEADEEBEEEBEEDEAEEEDDEEEDEEEDDEEEBBDDDDBBBDBBBBABBBDDDDBBBDBBBBBBBBDDDDDDDDBDBEBBBBDDDDDADDBDBEBBBDDDDDDDDDDDCEAEBDDDDDDDDDDDCEEEEADDDDDDDDDCCCAEEEADDDDDDDDCCCEEEAADDDAADDDCCCAEEEDDDDADDDDACEEAAFFFFFFFFFFFFAAAFFFFFFFFFFFFFFAFFFFFFFFFFFFFFBBFFFFFFFFFFFFFBBBFFFFFFFFFFFFFBBBFFFFFFFFFFFFFFBBFFFFFFFFFFFFFFBBFFFFFFFFFFFFFFFBFFFFFFFFFFFFFFBBFFFFFFFFFFFFFFBBFFFFFFFFFFFFFBBBFFFFFFB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IIIIIIIIIIIIIIIIIIIIIIII";
I want to make the first color (-16776960 - which is represented by letter A) transparent, so to decompress my sprite I’m using the following:
for (int i = 0; i < sprites.length; i++) {
sprites[i] = new BufferedImage(TILE_SIZE / 2, TILE_SIZE / 2, 2);
Graphics2D g = sprites[i].createGraphics();
for (int y = 0; y < 16; y++) {
for (int x = 0; x < 16; x++) {
if (str.charAt((y * 16 + x) + (i * 16 * 16)) != 'A') {
g.setColor(new Color(color[str.charAt((y * 16 + x)
+ (i * 16 * 16)) - 65]));
} else {
g.setColor(new Color(0xff000000 | color[str
.charAt((y * 16 + x) + (i * 16 * 16)) - 65]));
}
g.fillRect(x, y, TILE_SIZE / 2, TILE_SIZE / 2);
}
}
When color is A I’m doing an “or” with 0xff000000 but it’s not working, and my sprite is not transparent. I need it transparent to make it
use the ladder. See spritesheet:
http://howlerbr1.game-host.org:8080/molemole.gif
The player is still with black background instead of transparent.
thanks for any help!