TGC Codebase Backup



Splerge Wipe Effect by JHA

31st Jan 2004 2:11
Summary

Melts a Bitmap onto the screen for a nice wipe effect.



Description

Insert your own Image file into the program and run it. It will melt the image onto the screen. Pretty neat effect. Warning: Images bigger than the Display settings will not work. Remember, the bigger the picture, the slower the routine will run.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    ` Splerge Routine
` Adapted by Joe Austin

Sync On : Sync Rate 0

` Load the Bitmap
Load Bitmap "MyBitmap.bmp", 1   `<--- Put your bitmap here

` Do Inital Splerge
Splerge(0, 1, 0)

` Wait for Speed key before beginning new Splerge
A$ = ""
While A$ <> "Q"
   A$ = Upper$(Inkey$())
   If A$ = "1" Then Cls: Splerge(0, 1, 0)
   If A$ = "2" Then Cls: Splerge(10, 1, 0)
   If A$ = "3" Then Cls: Splerge(20, 1, 0)
   If A$ = "4" Then Cls: Splerge(30, 1, 0)
   If A$ = "5" Then Cls: Splerge(40, 1, 0)
EndWhile

End

Function Splerge(Speed, Source, Dest)

   bHeight = Bitmap Height(1)
   bWidth = Bitmap Width(1)

   For bCurLine = bHeight-1 to 1 Step -1
      Fill(Dest, 0, 0, bWidth, Source, bCurLine)
      If Speed
         Wait Speed
      EndIf
   Next bCurLine

EndFunction

Function Fill(Dest, ScreenX, ScreenY, bWidth, Source, bCurLine)

   Copy Bitmap Source, 0, bCurLine, bWidth, bCurLine+1, Dest, ScreenX, ScreenY, bWidth+1, bCurLine+2

   STP = 1: Count = 1

   While Count < bCurLine
      Copy Bitmap Dest, 0, 0, bWidth, STP, Dest, 0, STP, bWidth, STP
      STP = STP * 2
      Count = Count + STP
   EndWhile

   If Count > bCurLine
      Copy Bitmap Dest, 0, 0, bWidth, bCurLine - STP, Dest, 0, STP, bWidth, bCurLine - STP
   EndIf

   If Count = bCurLine
      Copy Bitmap Dest, 0, 0, bWidth, 1, Dest, 0, bCurLine - 1, bWidth, 1
   EndIf

   Sync

EndFunction