18-03-2007, 08:24 PM
This is what I have, and it works fine:
Code:
Public Sub BltNpcTop(ByVal MapNpcNum As Long)
Dim Anim As Byte
Dim X As Long, y As Long
' Make sure that theres an npc there, and if not exit the sub
If MapNpc(MapNpcNum).num GetTickCount Then
Anim = 2
End If
End If
' Check to see if we want to stop making him attack
With MapNpc(MapNpcNum)
If .AttackTimer + 1000 < GetTickCount Then
.Attacking = 0
.AttackTimer = 0
End If
End With
With rec
.top = Npc(MapNpc(MapNpcNum).num).Sprite * PIC_Y
.Bottom = .top + PIC_Y
.Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * PIC_X
.Right = .Left + PIC_X
End With
With MapNpc(MapNpcNum)
X = .X * PIC_X + .XOffset
y = .y * PIC_Y + .YOffset ' - 4 BJORN
End With
' Check if its out of bounds because of the offset
If y < 0 Then
y = 0
With rec
.top = .top + (y * -1)
End With
End If
Call DD_BackBuffer.BltFast(X, y - ESIZE_YTOP, DD_SpriteSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
End Sub