Gameboy Development Forum

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.

Ads

#1 2021-08-26 06:53:58

popcalent
Member
Registered: 2021-08-18
Posts: 12

Sprites and transparencies

Hello,

I have a problem when I create sprites. The white pixels around the sprite are supposed to be transparent so the sprite doesn't look like a 8x8 (or whatever dimensions) solid block. However, the white pixels inside the sprite, I want them to remain white.

Example:

https://i.ibb.co/2PqcyGP/sprite.png

The white pixels around the sprite should be transparent, but the white pixels in the eyes should remain white no matter what's behind. How can I do that?

Offline

 

#2 2021-08-26 11:23:52

0x7f
Member
Registered: 2019-11-24
Posts: 65

Re: Sprites and transparencies

Hi,

sprites have 4 colors whereby one is transparent. The default setting is:

Color 0 = white (transparent)
Color 1 = grey
Color 2 = dark grey
Color 3 = black

Color 0 is always the transparent color. The best way for your sprite is to replace the grey parts with dark grey and change the object palette using the OBP0 register in order to get a non transperent white.

Color 0 = white (transparent)
Color 1 = white
Color 2 = dark grey
Color 3 = black

Last edited by 0x7f (2021-08-26 11:27:03)

Offline

 

#3 2021-08-26 12:09:59

toxa
Member
Registered: 2020-02-13
Posts: 305

Re: Sprites and transparencies

Also sprites may have either obp0 or obp1 palette. If you put two sprites with different palettes one over the other, you can get a 4-colored sprite. Many games use that trick.

Offline

 

#4 2021-08-28 16:15:49

popcalent
Member
Registered: 2021-08-18
Posts: 12

Re: Sprites and transparencies

Thanks toxa and 0x7f. I'll do the double sprite trick, then.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson