gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Graphics > multiple backgrounds

#59961 - christosterone - Sat Nov 05, 2005 11:50 pm

Hi

i have only ever used one background before, and i have some questions concerning multiple backgrounds.

can i have a different set of tiles for each background?( ex. 256 tiles for bg2, different 256 tiles bg3, etc)

also, how do i make the backgrounds with the higher priority transparent?

thanks, chris

#59989 - poslundc - Sun Nov 06, 2005 3:44 am

christosterone wrote:
can i have a different set of tiles for each background?( ex. 256 tiles for bg2, different 256 tiles bg3, etc)


Sure, just specify a different char base block in REG_BGCNTX and put your tiles into that CBB.

Alternatively, if your BGs aren't affine BGs (since they can only use up to 256 chars) but text BGs (which can use up to 1024 chars), you can have them both use the same CBB, and load the tiles for the first one into indices 0-255, then load the tiles for the second one into indices 256-511. Then just make sure the second map's screen data is updated to reflect an offset by the number of tiles in the first background (256 in this case).

Quote:
also, how do i make the backgrounds with the higher priority transparent?


Any instances of color 0 in your tiles will always be transparent, and show through to any sprites, backgrounds, etc. underneath them.

If you want to make your backgrounds translucent/alpha-blended, see the following:

TONC on blending
Effects Registers documentation in Cowbite

Post if you run into difficulty implementing it.

Dan.

#60006 - christosterone - Sun Nov 06, 2005 6:35 am

ahh thank you so much.

now ive dealt with rotational backgrounds, but it seems that because i have 320 tiles, i will need to use text backgrounds.

do i load the character/screen blocks any differently with text backgrounds than rotational backgrounds?

thanks, chris

#60007 - tepples - Sun Nov 06, 2005 6:37 am

With text backgrounds, you usually use a 32x32 tile (256x256 pixel) map for each background, and you write each tile in one 16-bit unit.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.