uhh...I'm writing something for my incoming game...
try this one
and this one is the main prog
of course you can change it if you want - and some things are not needed...you can just use the basic Bmax commands (see the type function Update/Draw)
Hope this helps
byez
try this one
'fx_image Global list_imageFX:tlist=New tlist Type timagefx Global event_raise:Int=0 Field image Field v_alpha:Float,i_alpha#=-.01 Field l_alpha:Float=1 Field fademode=1 Field x#,y# Field dx#,dy# Field rot#=0,i_rot#=0 Field scale_x#=1 Field scale_y#=1 Field scale_dx#=0 Field scale_dy#=0 Field status=0 Field action=0 Field strip_number=10 Field color[3] Field blendMode=ALPHABLEND Field checked:Int=0 Field duration:Int ' ' control the audio (optional) Field channel:TChannel Field volume:Float Field volume_delta:Float Function Add:timageFx(_image:timage,action=0) Local t_imagefx:timagefx=New timageFX t_imageFX.image=_image t_imageFX.color[0]=255 t_imageFX.color[1]=255 t_imageFX.color[2]=255 t_imageFX.v_alpha=1.0 t_imageFX.l_alpha=0 t_imageFX.action=action ListAddLast list_imageFX,t_imageFX Return t_imageFX End Function Method Strip(n=10) action=action|1 strip_number=n End Method Method Alpha(_alp#,i_alp#=0.1) v_alpha=_alp i_alpha=i_alp End Method Method SetFadeIn(timer=2000) v_alpha=0 i_alpha=Float(100)/timer l_alpha=1 fademode=0 duration=timer 'Print "Fade IN "+v_alpha+" INC: ("+i_alpha+")" End Method Method SetFadeOut(timer=2000) v_alpha=1 i_alpha=-Float(100)/timer l_alpha=0 fademode=1 duration=timer 'Print "Fade OUT "+v_alpha+" INC: ("+i_alpha+")" End Method ' End Rem Method AudioFade(chan:TChannel,vol_s:Float) If duration=0 Return channel=chan volume=vol_s volume_delta=Float(100)/duration End Method Method SetColor(r,g,b) color[0]=r color[1]=g color[2]=b End Method Function ClearAll() For Local t:timageFX=EachIn list_imageFX ListRemove list_imageFX,t t.image=Null t=Null Next End Function Function Update() For Local t:timageFX=EachIn list_imageFX rit:Int=t.draw() Next Return rit End Function Method Draw() Select action Case 0' fade in & out If fademode=0 v_alpha=v_alpha+i_alpha volume=volume+volume_delta If v_alpha>l_alpha status=1;Return 1 Else v_alpha=v_alpha+i_alpha volume=volume-volume_delta If v_alpha<l_alpha status=1;Return 1 End If Case 1 If checked=0 loop_s=0 loop_f=GraphicsHeight()/strip_number LOOP_2=0 loop_stp=loop_f checked=1 End If End Select If volume<0 volume=0 If volume>1 volume=1 If channel<>Null SetChannelVolume channel,volume ' vol:-delta_vol ResumeChannel channel End If 'draw image... o_blend=GetBlend() o_alpha#=GetAlpha() GetColor(O_r,O_g,O_b) GetScale(o_x#,o_y#) SetBlend BLENDmode SetScale 1,1 SetAlpha v_alpha SetColor color[0],color[1],color[2] DrawImage image,x,y Select action Case 1 SetColor 0,0,0 Repeat DrawRect 0,loop_s,GraphicsWidth(),loop_2 loop_S:+loop_stp loop_2:+1 Until loop_s>=loop_f End Select SetBlend o_blend SetScale o_X,o_Y SetAlpha o_alpha SetColor o_r,o_g,O_b End Method End Type
and this one is the main prog
'test Graphics 640,480 Include "fx_image.bmx" Global image=LoadImage("gfx/bkg_04.png") myfx:timagefx=timagefx.add(image) myfx.SetFadeOut(10000) Repeat Cls ris=timagefx.update() Flip Until MouseHit(1) Or ris=1 myfx.SetFadeIn(10000) Repeat Cls ris=timagefx.update() Flip Until MouseHit(1) Or ris=1 End
of course you can change it if you want - and some things are not needed...you can just use the basic Bmax commands (see the type function Update/Draw)
Hope this helps
byez