#33894 - ymalik - Mon Jan 10, 2005 10:10 pm
In the following code I have a star background and on top of it I have a transparent cloud background. The star background (background 0) is composed of 4 8x8 8 bit tiles randomly placed. The cloud background (background 1) is a 240x256 8 bit image. In between I want to have a sprite that is above the star background but you can see through it through the cloud background. The sprite is a 32x32 8 bit image. I can only seem to make the sprite either above the star background or transparent below the clouds, but not both, and the black area around the sprite shows through the clouds. Also, the cloud image seems to be torn into two pieces down the middle vertically and stretched. How can I accomplish all of this?
Thanks,
Yasir
Thanks,
Yasir
Code: |
int main(void) { int i; Sprite sprite; s16 stars_x = 0, clouds_x = 0, ship_x = 104, ship_y = 126; SetMode(MODE_0 | BG0_ENABLE | BG1_ENABLE | OBJ_ENABLE | OBJ_MAP_1D); // star background DMA_Copy(3, (void *) palette_Palette, BGPaletteMem, 256, DMA_16NOW); DMA_Copy(3, (void *) stars_Tiles, (void *) CharBaseBlock(0), 256, DMA_16NOW); generate_stars(); // clouds DMA_Copy(3, (void *) clouds_Tiles, (void *) CharBaseBlock(1), 12224/2, DMA_16NOW); DMA_Copy(3, (void *) clouds_Map, (void *) ScreenBaseBlock(30), 960, DMA_16NOW); // ship DMA_Copy(3, (void *) palette, (void *) OBJPaletteMem, 256, DMA_16NOW); DMA_Copy(3, (void *) obj0, (void *) OBJ_GFXMem, 512, DMA_16NOW); sprite.attribute0 = COLOR_256 | ship_y | SQUARE; sprite.attribute1 = SIZE_32 | ship_x; sprite.attribute2 = 0 | BIT(10); // where to look for tiles where to look for map REG_BG0CNT = 0 << CHAR_SHIFT | BG_COLOR_256 | TEXTBG_SIZE_256x256 | 31 << SCREEN_SHIFT | 0; REG_BG1CNT = 1 << CHAR_SHIFT | BG_COLOR_256 | TEXTBG_SIZE_256x256 | 30 << SCREEN_SHIFT | 1; REG_BLDMOD = BIT(0) | BIT(9) | BIT(6) | BIT(12); while(1) { process_buttons(&ship_x); stars_x++; clouds_x--; sprite.attribute1 = SIZE_32 | ship_x; wait_vblank(); OAMMem[0] = sprite.attribute0; OAMMem[1] = sprite.attribute1; OAMMem[2] = sprite.attribute2; REG_BG0VOFS = stars_x >> 4; REG_BG1VOFS = clouds_x >> 2; } return 0; } |