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.

Coding > sprite priority

#8067 - whodoo - Tue Jul 01, 2003 3:45 pm

I want a title screen like this.. first a background with a sky..Then a sprite..Then another bakground over both the first background and the sprite..then another sprite over all of this..
how do I make the first sprite lay over background0 and behind background1?

#8068 - niltsair - Tue Jul 01, 2003 3:48 pm

You change it's priority to 3 by setting the bits 10-11 in attribute 2.

From www.thepernproject :
Quote:
Bit 10-11 is the priority. As with backgrounds sprites can be assigned a priority of 0-3. Higher numbered sprites are drawn first meaning that a sprite of priority 0 will be drawn over the top of a sprite with priority of 3. Also a sprite priority is always higher than that of the corresponding background priority meaning that if both a sprite and a background have the same priority then the sprite will be drawn on top. One more thing: for sprites with the same priority then sprites with the lowest OAM number are drawn on top.