#9010 - immortalninjak - Sat Jul 26, 2003 1:41 pm
Hi all, me again.
Working from gbajunkies Tile/map tutorial I'm trying to display a 8*8 sprite.
As seperate programs I can draw a sprite, and display a BG. But when I try and put them together it doesnt work.
If I set the OAMData to 0x6010000 and sprite attribute 2 to 0, I get artifacts in the top left corner.
If I set OAMData to 0x6014000 and attribute 2 to 512 i get nothing but the Bg.
here's the code that draws the bg
followed by the code that should draw the sprite
sorry for being such a noob but any help would be greatly appreciated.
Although at this rate, the thing I come up with at the end will be a mix and match of board posts!
thanks again.
Working from gbajunkies Tile/map tutorial I'm trying to display a 8*8 sprite.
As seperate programs I can draw a sprite, and display a BG. But when I try and put them together it doesnt work.
If I set the OAMData to 0x6010000 and sprite attribute 2 to 0, I get artifacts in the top left corner.
If I set OAMData to 0x6014000 and attribute 2 to 512 i get nothing but the Bg.
here's the code that draws the bg
Code: |
SetMode(MODE_1 | OBJ_ENABLE | OBJ_MAP_1D); bg2.number = 2; //background number 0-3 bg2.charBaseBlock = 0; //tile data position bg2.screenBaseBlock = 28; //map data position on 2Kb boundary bg2.colorMode = BG_COLOR_256; //256-colour background bg2.size = ROTBG_SIZE_256x256; //size of map bg2.mosaic = 0; //not enabled bg2.x_scroll = 120; //scrolling variables bg2.y_scroll = 80; EnableBackground(&bg2); for(loop = 0; loop < 256; loop++){ BGPaletteMem[loop] = tilesPalette[loop]; } for(loop = 0; loop < tiles_WIDTH * tiles_HEIGHT /2; loop++) bg2.tileData[loop] = tilesData[loop]; temp = (u16*)New; for(loop = 0; loop < 32*32/2; loop++) bg2.mapData[loop] = temp[loop]; |
followed by the code that should draw the sprite
Code: |
for (loop = 0; loop < 256; loop++) OBJPaletteMem[loop] = sPalette[loop]; InitializeSprites(); sprites[0].attribute0 = COLOR_256 | SQUARE | 80; sprites[0].attribute1 = SIZE_8 | 40; sprites[0].attribute2 = 0; for(loop = 0; loop < 8*8/2; loop++) { OAMData[loop] = sData[loop]; } |
sorry for being such a noob but any help would be greatly appreciated.
Although at this rate, the thing I come up with at the end will be a mix and match of board posts!
thanks again.