VB Code:
Dim MovePic As Integer
Dim MoveUp, SinX As Single
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Sub Form_Load()
SinX = 20
End Sub
Private Sub MoveDown_Timer()
MovePic = MovePic + 2
If MoveUp <= -1 Then
Timer2.Enabled = True
MoveDown.Enabled = False
Else
MoveUp = MoveUp - 0.1
End If
SinX = Sin(MoveUp) * 50
End Sub
Private Sub Timer1_Timer()
Me.Cls
'Draws the mask with vbSrcAnd raster operation
BitBlt Me.hDC, MovePic, SinX, picMask.ScaleWidth, picMask.ScaleHeight, picMask.hDC, 0, 0, vbSrcAnd
'Draws the sprite witht the vbSrcPaint raster operation
BitBlt Me.hDC, MovePic, SinX, picSprite.ScaleWidth, picSprite.ScaleHeight, picSprite.hDC, 0, 0, vbSrcPaint
End Sub
Private Sub Timer2_Timer()
MovePic = MovePic + 2
If MoveUp >= 1 Then
MoveDown.Enabled = True
Timer2.Enabled = False
Else
MoveUp = MoveUp + 0.1
End If
SinX = Sin(MoveUp) * 50
End Sub