Questions with transparency in animations - sample code included

Previous topic - Next topic

Falstaff

Hello!

My artist and I have been looking at defining our workflow for having animations in our game which include transparency. The effect we're trying to make is an animated cloud that fades away in the later frames of the animation.

I have attached a sample demo project which includes a test.png file provided by my artist. When I open it up in GIMP it looks like it's fading away in there (ie I can see the checker background layer showing through), so that looks fine.. but when I load the image up as an animation in GLBasic, it doesn't seem to show the same transparency. Instead it looks like only the background of the sprite is transparent, but the actual image data in each frame is fully visible.

The code itself is very basic, pretty much just LOADANIM and DRAWANIM

I realize it's possible to use ALPHAMODE in GLB to draw a whole frame with transparency, but I'm wondering if there's some way to be able to use the alpha channel of the .png to have different levels of transparency within a single animation frame? Is this possible? Is there something wrong with the source image?

Thanks in advance!

[attachment deleted by admin]

Crivens

Have you tried with ALPHAMODE -1? This should use all levels of transparency (ie. alpha channel). It's how I got nice smooth icons on my new game.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

ampos

you have to set ALPHAMODE -1 to make the "transparency" thing to work.

If it was just a sprite dissapearing I would use
Code (glbasic) Select

for alfa=-1 to -0.01 step .01 <-speed
   alphamode alfa
   drawsprite you,know
   showscreen
next


Instead of using showscreen I use

Code (glbasic) Select
function ss()
   showscreen
   alphamode -1
endfunction
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

Falstaff

ohh! Great thanks, I'm glad it was something so simple.  :booze:

I actually have a similar fading out effect used elsewhere in code, but this is great to be able to do stuff on the source image side of things too :)