31-12-2008, 02:13 AM
It's not a normal BltPlayer code.. There's a lot of sprites per sheet, 36... Although here you go.
Code:
Sub BltPlayer(ByVal Index As Long)
Dim Anim As Byte
Dim x As Long, y As Long
' Only used if ever want to switch to blt rather then bltfast
With rec_pos
.Top = GetPlayerY(Index) * PIC_Y + Player(Index).yOffset
.Bottom = .Top + PIC_Y
.Left = GetPlayerX(Index) * PIC_X + Player(Index).xOffset
.Right = .Left + PIC_X
End With
' Check for animation
Anim = 0
If Player(Index).Attacking = 0 Then
Select Case GetPlayerDir(Index)
Case DIR_UP
Anim = 0
If (Player(Index).yOffset < PIC_Y / 3) Then
Anim = 0
ElseIf (Player(Index).yOffset > PIC_Y / 3) And ((Player(Index).yOffset > PIC_Y / 3 * 2)) Then
Anim = 1
ElseIf (Player(Index).yOffset > PIC_Y / 3) And ((Player(Index).yOffset > PIC_Y / 3 * 1)) Then
Anim = 2
End If
If Player(Index).Sitting = 1 Then
Anim = 8
End If
Case DIR_DOWN
Anim = 0
If (Player(Index).yOffset < PIC_X / 6 * -1) Then Anim = 1
If (Player(Index).yOffset < PIC_X / 4 * -1) Then Anim = 2
If Player(Index).Sitting = 1 Then
Anim = 8
End If
Case DIR_LEFT
Anim = 0
If (Player(Index).xOffset < PIC_Y / 3) Then
Anim = 0
ElseIf (Player(Index).xOffset > PIC_Y / 3) And ((Player(Index).xOffset > PIC_Y / 3 * 4)) Then
Anim = 4
ElseIf (Player(Index).xOffset > PIC_Y / 3) And ((Player(Index).xOffset > PIC_Y / 3 * 3)) Then
Anim = 3
ElseIf (Player(Index).xOffset > PIC_Y / 3) And ((Player(Index).xOffset > PIC_Y / 3 * 2)) Then
Anim = 2
ElseIf (Player(Index).xOffset > PIC_Y / 3) And ((Player(Index).xOffset > PIC_Y / 3 * 1)) Then
Anim = 1
End If
If Player(Index).Sitting = 1 Then
Anim = 8
End If
Case DIR_RIGHT
Anim = 0
If (Player(Index).xOffset < PIC_Y / 5 * -1) Then Anim = 4
If (Player(Index).xOffset < PIC_Y / 4 * -1) Then Anim = 3
If (Player(Index).xOffset < PIC_Y / 3 * -1) Then Anim = 2
If (Player(Index).xOffset < PIC_Y / 2 * -1) Then Anim = 1
If Player(Index).Sitting = 1 Then
Anim = 8
End If
End Select
Else
If Player(Index).AttackTimer + 500 > GetTickCount Then
Anim = 6
If Player(Index).AttackTimer + 400 > GetTickCount Then
Anim = 5
End If
End If
End If
' Check to see if we want to stop making him attack
If Player(Index).AttackTimer + 1000 < GetTickCount Then
Player(Index).Attacking = 0
Player(Index).AttackTimer = 0
End If
rec.Top = GetPlayerSprite(Index) * 64 + 32
rec.Bottom = rec.Top + 32
rec.Left = (GetPlayerDir(Index) * 9 + Anim) * 64
rec.Right = rec.Left + 64
x = GetPlayerX(Index) * PIC_X + Player(Index).xOffset
y = GetPlayerY(Index) * PIC_Y + Player(Index).yOffset - 4
' Check if its out of bounds because of the offset
If y < 0 Then
y = 0
rec.Top = rec.Top + (y * -1)
End If
rec.Top = GetPlayerSprite(Index) * PIC_Y + PIC_Y
rec.Bottom = rec.Top + PIC_Y
Call DD_BackBuffer.BltFast(x, y, DD_SpriteSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
End Sub