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 > Sprite lighen/darken

#26421 - Gene Ostrowski - Wed Sep 15, 2004 2:58 am

Anyone know how to get an OBJ to lighten other OBJS and BGs?

The gbatak docs indicate that it's possible, and I've seen some games that appear to be using sprites to lighten other sprites, but I've played with every combination of BLDY, BLDCNT and BLDALPHA that I could and cant get it to work.

The best I can do is get the sprite to lighten BGs, but it wants to ignore the OBJS underneath it.

I know the unit cannot alpha-blend between OBJs, but it appears to be somehow possible to use the lighten effect between OBJs.

Anyone ever get this to work, and if so what values for the regs did you use?

Thanks in advance.
_________________
------------------
Gene Ostrowski

#26422 - sajiimori - Wed Sep 15, 2004 3:11 am

Sprites can't blend with other sprites. You could flicker the top sprite every frame for a poor-man's blend.

#26424 - zazery - Wed Sep 15, 2004 6:58 am

I've never done either of these before but two solutions came to mind. I don't think they are the best solution but a solution nonetheless.
  1. Use a background just for blending effects. Have the map scroll with the sprite and using a few tiles (assuming tile mode here) and plot out an opaque sprite just like the actual one. Fill it with whatever colour to blend it with and then finally blend the layer with the sprite.

  2. Use calculations to determine the difference and change the sprite pallete accordingly.

#26426 - DekuTree64 - Wed Sep 15, 2004 7:07 am

Well it is possible to blend certain sprites with BGs (or just brightened/darkened) without doing all sprites, by setting the alpha mode to 0 (which is normally 'off'), and turning on the alpha bit in the OAM.
You still can't blend sprites with sprites (if you have a half transparent sprite on top of an opaque one, the transparent just blends with the BG underneath, ignoring the opaque sprite inbetween), but it does allow a little more flexibility in special effects being able to use transparent sprites for particles and such.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku