Fullscreen Image Fade by preyx2nd Mar 2005 1:48
|
---|
Summary Allows you to load and fade in or out any fullscreen-sized image to or from the previous screen. The function automatically determines the fade direction by your start and stop alp Description This function takes four arguments, and returns none. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com `Fullscreen Image Fade by Bryan Yang `filename$: in same format as "LOAD IMAGE" function (string) `starta: the starting alpha value (0-255) `stopa: the stopping alpha value (0-255) `rate: the change in alpha value per cycle (rate > 0) `NOTE: alpha=255 is opaque and alpha=0 is transparent. `WARNING: NO ERROR CHECKING! Always double-check your inputs. FUNCTION Fade(filename$, starta, stopa, rate) GET IMAGE 1001, 0, 0, SCREEN WIDTH(), SCREEN HEIGHT(), 1 LOAD IMAGE filename$, 1000 SPRITE 1000, 0, 0, 1000 SET SPRITE 1000, 0, 1 SET SPRITE PRIORITY 1000, 1000 a = starta IF starta > stopa r = -rate ELSE r = rate ENDIF REPEAT SET SPRITE ALPHA 1000, a PASTE IMAGE 1001, 0, 0, 0 a = a + r SYNC UNTIL (r>0 AND a>stopa) OR (r<0 AND a<stopa) SET SPRITE ALPHA 1000, stopa PASTE IMAGE 1001, 0, 0, 0 SYNC ENDFUNCTION |