Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)
You are not logged in.
I want my sprite to have a white pixel in it, but gbtd automatically makes white pixels transparent. There has to be something I'm not seeing here. Does anyone know how to stop specific white pixels from becoming transparent?
Offline
The GB can hold two sprite palettes, the first color in these palettes will always be recognized as transparency, making each palette have 3 useable colors and transparency.
If you want to do a sprite with white in it you'll have to set up a palette like Black-Darker-Dark-White (uses Black as transparency) , Darker-Black-Dark-White (uses Darker as transparency) or something like that.
Then you'll have to make sure that the sprite properties is set to use the correct palette of the two.
Offline
You can achieve 4 color sprites by putting the 4th shade in separate sprites and have those use the other palette if you really need to.
Offline
You could, but keep in mind that there's a 10 sprites per line limitation. Sprites exceeding that limit will simply be hidden.
Offline
so i set the colors in GBTD as Black-Darker-Dark-White (uses Black as transparency). exported it and compiled in GBDK. the supposed white color came out black on the emulator. how do i set the code to use the palette i assigned in GBTD?
Offline
Did you remember to change the sprite palette in your game?
http://bgb.bircd.org/pandocs.htm#lcdmonochromepalettes (I'm not sure how to do this in GBDK though)
If the colors are coming out reversed, try %00011011. If only the white is wrong, try %00100111.
Last edited by h0tp3ngu1n (2020-01-07 14:46:13)
Offline
Thanks gbjosh. it solved when im trying to make the white opaque but im ran into another problem. i wanted to also have a black opaque color so i set the palette on GBTD as Darker-Black-Dark-White but the black opaque doesnt show up on the emulator when i compiled the code. I think the S_PALETTE just reverse the order of the palette in GBTD. instead of the default White-Dark-Darker-Black, it reverse the order to Black-Darker-Dark-White. Do you know of another way so i can use Black and White as opaque at the same time on the same palette? Thanks
Offline
Hi,
for displaying your sprites you have two different palettes available. OBP0 and OBP1 (OBP0 is your standard palette). With the sprite property S_PALETTE you can switch between OBP0 and OBP1. However for displaying white as a non transparent color it is not necessary to switch between the palettes. You can just use OBP0 and change the colors of the palette.
The gameboy uses 4 different colors:
black = 11 binary
dark grey = 10 binary
light grey = 01 binary
white = 00 binary
The default setting of OBP0 is 11 10 01 00 binary or 0xE1. This means the 1st palette color is black, the 2nd palette color is dark grey, the 3rd palette color is light grey and the 4th palette color is white. The 4th palette color is considered as transparent. Here is an example:
You draw your sprite in GBTD as usual (no need to change the colors in GBTD) but you want to change light grey to white.
Set OBP0_REG = 0xE0 = 11 10 00 00 binary = black, dark grey, white, white (transparent)
Hope this helps.
Last edited by 0x7f (2020-01-08 13:36:32)
Offline
YES!!! Thank you 0x7f! Thank you for clearing that up. I set the OBP0 = 0xe1 and OBP1 = 0xe0 and just use S_PALETTE on the sprite that needed it.
Offline