03-02-2009, 10:23 PM
yea got that, heres my sub,
Code:
Public Sub BltPlayer(ByVal Index As Long)
Dim Anim As Byte
Dim i As Long
Dim SpellNum As Long
Dim X As Long
Dim Y As Long
Dim Sprite As Long, spriteleft As Long
Dim rec As DXVBLib.RECT
Sprite = GetPlayerSprite(Index)
' Check for animation
Anim = 0
If Player(Index).Attacking = 0 Then
Select Case GetPlayerDir(Index)
Case DIR_UP
spriteleft = 0
Case DIR_RIGHT
spriteleft = 3
Case DIR_DOWN
spriteleft = 1
Case DIR_LEFT
spriteleft = 2
End Select
With rec
.Top = 0
.Bottom = DDSD_Sprite(Sprite).lHeight
.Left = (spriteleft * 3 + Anim) * (DDSD_Sprite(Sprite).lWidth / 12)
.Right = .Left + (DDSD_Sprite(Sprite).lWidth / 12)
End With
Else
If Player(Index).AttackTimer + 500 > GetTickCount Then
Anim = 2
End If
End If
' Check to see if we want to stop making him attack
With Player(Index)
If .AttackTimer + 1000 < GetTickCount Then
.Attacking = 0
.AttackTimer = 0
End If
End With
X = GetPlayerX(Index) * PIC_X + Player(Index).XOffset - ((DDSD_Sprite(Sprite).lWidth / 12 - 32) / 2)
If ((DDSD_Sprite(Sprite).lHeight) - 32) > 0 Then
Y = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset - ((DDSD_Sprite(Sprite).lHeight) - 32)
Else
Y = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset
End If
' Check if its out of bounds because of the offset
' Is player's Y less than 0..?
If Y < 0 Then
With rec
.Top = .Top - Y
End With
Y = 0
End If
' Is player's X less than 0..?
If X < 0 Then
With rec
.Left = .Left + (X * -1)
'.Right = .Left + 48 - (x * -1)
End With
X = 0
End If
' Is player's X more than max map values..?
If X + (DDSD_Sprite(Sprite).lWidth / 12) > MAX_MAPX * 32 + 32 Then
With rec
.Right = .Right + (X - (MAX_MAPX * 32))
End With
End If
Call BltSprite(Sprite, X, Y, rec)
' ** Blit Spells Animations **
For i = 1 To MAX_SPELLANIM
SpellNum = Player(Index).SpellAnimations(i).SpellNum
If SpellNum > 0 Then
If Player(Index).SpellAnimations(i).Timer < GetTickCount Then
Player(Index).SpellAnimations(i).FramePointer = Player(Index).SpellAnimations(i).FramePointer + 1
Player(Index).SpellAnimations(i).Timer = GetTickCount + 120
If Player(Index).SpellAnimations(i).FramePointer >= DDSD_Spell(SpellNum).lWidth \ SIZE_X Then
Player(Index).SpellAnimations(i).SpellNum = 0
Player(Index).SpellAnimations(i).Timer = 0
Player(Index).SpellAnimations(i).FramePointer = 0
End If
End If
If Player(Index).SpellAnimations(i).SpellNum > 0 Then
With rec
.Top = 0
.Bottom = DDSD_Spell(SpellNum).lHeight
.Left = Player(Index).SpellAnimations(i).FramePointer * (DDSD_Spell(SpellNum).lWidth / 12)
.Right = .Left + (DDSD_Spell(SpellNum).lWidth / 12)
End With
Call BltSpell(Spell(SpellNum).Pic, X, Y, rec)
End If
End If
Next
End Sub