Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
could use some help on my sprites
#3
Code:
Private 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 = 1
               ElseIf (Player(Index).YOffset > PIC_Y / 3) And ((Player(Index).YOffset > PIC_Y / 3 * 2)) Then
               Anim = 2
               End If
           Case DIR_DOWN
               Anim = 1
               If (Player(Index).YOffset < PIC_X / 4 * -1) Then Anim = 0
               If (Player(Index).YOffset < PIC_X / 2 * -1) Then Anim = 2
           Case DIR_LEFT
               Anim = 0
               If (Player(Index).XOffset < PIC_Y / 3) Then
               Anim = 1
               ElseIf (Player(Index).XOffset > PIC_Y / 3) And ((Player(Index).XOffset > PIC_Y / 3 * 2)) Then
               Anim = 2
               End If
           Case DIR_RIGHT
               Anim = 0
               If (Player(Index).XOffset < PIC_Y / 4 * -1) Then Anim = 1
               If (Player(Index).XOffset < PIC_Y / 2 * -1) Then Anim = 2
       End Select
   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

        rec.top = (Player(Index).Sprite) * 64 + 32
        rec.Bottom = rec.top + 32
        rec.Left = (Player(Index).Dir * 3 + Anim) * 64
        rec.Right = rec.Left + 64
  
    X = Player(Index).X * 32 + sx - 16 + Player(Index).XOffset
    Y = Player(Index).Y * 32 + sx + Player(Index).YOffset

        If Y < 0 Then
            rec.top = (Player(Index).Sprite) * 64 + 32
            rec.Bottom = rec.top + 32
            Y = Player(Index).YOffset + sx
        End If

        If X < 0 Then
            rec.Left = (Player(Index).Dir * 3 + Anim) * 64 + 16
            rec.Right = rec.Left + 48
            X = Player(Index).XOffset
        End If
      
        If X > MAX_MAPX * 32 Then
            rec.Left = (Player(Index).Dir * 3 + Anim) * 64
            rec.Right = rec.Left + 48
            X = MAX_MAPX * 32 + sx - 16 + Player(Index).XOffset
        End If

        Call DD_BackBuffer.BltFast(X - (NewPlayerX * PIC_X) - NewXOffset, Y - (NewPlayerY * PIC_Y) - NewYOffset, DD_SpriteSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
End Sub
there it is.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)