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.

DS development > How to make sprites semitransparent?

#100485 - TheRain - Mon Aug 28, 2006 5:25 am

I'm using this bit of code:
Code:
    SUB_BLEND_CR=BLEND_NONE|BLEND_SRC_BG2|BLEND_DST_SPRITE;
SUB_BLEND_AB = 0x0F | (0x0F << 8);


Trying to get sprites to be 50/50 semitransparent to the background. Ideally I'd like to set whether a sprite is semitransparent on an individual, sprite by sprite basis... but I can't even get this bit of code to work for all of them. Can someone help me out on this one??

thanks, 'rain
_________________
DSMIDI and dSTAR sequencer brought to you by TheRain
http://www.collinmeyermusic.com/dev/

#100513 - gmiller - Mon Aug 28, 2006 11:54 am

You need to enable the sprites transparency in OAM as well. The blending in global but the use of that global value is on a sprite by sprite basis.

#100547 - TheRain - Mon Aug 28, 2006 4:49 pm

If I set the alpha part of attr[2] in OAM to 0, the sprite will dissapear completely... if I set it to 1 it has no transparency... is there a different attribute I should be using??
_________________
DSMIDI and dSTAR sequencer brought to you by TheRain
http://www.collinmeyermusic.com/dev/

#100603 - TheRain - Mon Aug 28, 2006 10:34 pm

Ah, I got it... I needed to set my sprites as the source and background as the destination, not visa versa... and I needed to have ATTR0_TYPE_BLENDED not attr2_alpha.

Thanks!
_________________
DSMIDI and dSTAR sequencer brought to you by TheRain
http://www.collinmeyermusic.com/dev/

#100644 - TheRain - Tue Aug 29, 2006 5:54 am

ok, I was wrong on that one too... the sprite transparency level is set independantly via the ATTR2_ALPHA(n) value.... i don't know what that blended attribute does.
_________________
DSMIDI and dSTAR sequencer brought to you by TheRain
http://www.collinmeyermusic.com/dev/

#100658 - Dark Knight ez - Tue Aug 29, 2006 10:33 am

Setting a source and destination is then still needed? Just curious.

#100679 - Quirky - Tue Aug 29, 2006 4:56 pm

Yes it is - since you can have sprites that only blend against certain bgs, while to others they remain completely solid.