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 > Set priority of the background image in mode 4

#17030 - nghoyin - Sun Feb 29, 2004 7:46 am

Dear all, i have a question on mode 4 of display a background and sprite with priority. When i set the priority of my sprites to 0,they can be see on the bg pic, but if set above 0 then they didnt appear. so i would like to ask if there is some method to set the priority of the bg image so that the sprites can be see.thank you for answering me^^

#17032 - tepples - Sun Feb 29, 2004 8:55 am

You said setting the sprites' priority to 0 worked for you to get your sprites to appear. So what's your actual problem? If you care about sprite-to-sprite priorities, put frontmost sprites first in OAM. If you want the background to half-cover a sprite, you can't do that on the GBA in bitmap modes without using object window voodoo.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#17036 - nghoyin - Sun Feb 29, 2004 12:03 pm

thanks for your reply.
As i have about 5 sprites in my programme so each sprites i want to have different prority.So as you mean is that i can write the sprites to OAM as their porrity order?

#17057 - poslundc - Sun Feb 29, 2004 3:25 pm

Yes.

Dan.

#17068 - zazery - Sun Feb 29, 2004 5:39 pm

I've come across a problem like that before. If you are using the previous sprite to determine what character data you are going to set then you will need to mask the priority otherwise it will take the priority of the other one as well. I'm sure you know that but I thought I might point it out.

This is how I did mine. I'm sure there are better methods but I'm no GBA expert.

sprites[1].attribute0= COLOR_256 | SQUARE | 3;
sprites[1].attribute1= SIZE_8 | 3;
sprites[1].attribute2= 0;
sprites[1].attribute2= ((sprites[0].attribute2 & 0x01FF)+32) | PRIORITY(0);

Don't foget to set background priorities as well. I've used this code with mode zero so I don't know about mode 4.

Hope that helps