Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
paperdoll 32x63 code
#5
Sign Wrote:Ill be nice and give you my paperdoll code, since alot of people helped me with things I didn't know how to do.

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
                  If (Player(Index).YOffset < PIC_Y / 2) Then Anim = 1
              Case DIR_DOWN
                  If (Player(Index).YOffset < PIC_Y / 2 * -1) Then Anim = 1
              Case DIR_LEFT
                  If (Player(Index).XOffset < PIC_Y / 2) Then Anim = 1
              Case DIR_RIGHT
                  If (Player(Index).XOffset < PIC_Y / 2 * -1) Then Anim = 1
        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
    If Player(Index).AttackTimer + 1000 < GetTickCount Then
        Player(Index).Attacking = 0
        Player(Index).AttackTimer = 0
    End If
    
    rec.Left = (GetPlayerDir(Index) * 3 + Anim) * PIC_X
    rec.Right = rec.Left + PIC_X
    
    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)
    
        If GetPlayerDir(Index) = DIR_UP Then
        If Player(Index).Shield > 0 Then
              rec.top = Item(Player(Index).Shield).Pic * 64 + PIC_Y
              rec.Bottom = rec.top + PIC_Y
              Call DD_BackBuffer.BltFast(x, y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
        If Player(Index).Weapon > 0 Then
              rec.top = Item(Player(Index).Weapon).Pic * PIC_Y + PIC_Y
              rec.Bottom = rec.top + PIC_Y
              Call DD_BackBuffer.BltFast(x, y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
    End If
    
    If Player(Index).Armor > 0 Then
        rec.top = Item(Player(Index).Armor).Pic * PIC_Y + PIC_Y
        rec.Bottom = rec.top + PIC_Y
        Call DD_BackBuffer.BltFast(x, y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
    End If
    If Player(Index).Helmet > 0 Then
        rec.top = Item(Player(Index).Helmet).Pic * PIC_Y + PIC_Y
        rec.Bottom = rec.top + PIC_Y
        Call DD_BackBuffer.BltFast(x, y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
    End If
    If GetPlayerDir(Index)  DIR_UP Then
        If Player(Index).Shield > 0 Then
              rec.top = Item(Player(Index).Shield).Pic * PIC_Y + PIC_Y
              rec.Bottom = rec.top + PIC_Y
              Call DD_BackBuffer.BltFast(x, y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
        If Player(Index).Weapon > 0 Then
              rec.top = Item(Player(Index).Weapon).Pic * PIC_Y + PIC_Y
              rec.Bottom = rec.top + PIC_Y
              Call DD_BackBuffer.BltFast(x, y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
    End If
End Sub

Sub BltPlayerTop(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
                  If (Player(Index).YOffset < PIC_Y / 2) Then Anim = 1
              Case DIR_DOWN
                  If (Player(Index).YOffset < PIC_Y / 2 * -1) Then Anim = 1
              Case DIR_LEFT
                  If (Player(Index).XOffset < PIC_Y / 2) Then Anim = 1
              Case DIR_RIGHT
                  If (Player(Index).XOffset < PIC_Y / 2 * -1) Then Anim = 1
        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
    If Player(Index).AttackTimer + 1000 < GetTickCount Then
        Player(Index).Attacking = 0
        Player(Index).AttackTimer = 0
    End If
    
    rec.Left = (GetPlayerDir(Index) * 3 + Anim) * PIC_X
    rec.Right = rec.Left + PIC_X
    
    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
    y = y - 32
    If y < 0 And y > -32 Then
        With rec
              .top = .top - y
              y = 0
        End With
    End If
    
    rec.top = GetPlayerSprite(Index) * PIC_Y
    rec.Bottom = rec.top + PIC_Y
        
    'Call DD_BackBuffer.Blt(rec_pos, DD_SpriteSurf, rec, DDBLT_WAIT Or DDBLT_KEYSRC)
    Call DD_BackBuffer.BltFast(x, y, DD_SpriteSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
    
        If GetPlayerDir(Index) = DIR_UP Then
        If Player(Index).Shield > 0 Then
              rec.top = Item(Player(Index).Shield).Pic * PIC_Y
              rec.Bottom = rec.top + PIC_Y
              Call DD_BackBuffer.BltFast(x, y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
        If Player(Index).Weapon > 0 Then
              rec.top = Item(Player(Index).Weapon).Pic * PIC_Y
              rec.Bottom = rec.top + PIC_Y
              Call DD_BackBuffer.BltFast(x, y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
    End If
    
    If Player(Index).Armor > 0 Then
        rec.top = Item(Player(Index).Armor).Pic * PIC_Y
        rec.Bottom = rec.top + PIC_Y
        Call DD_BackBuffer.BltFast(x, y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
    End If
    If Player(Index).Helmet > 0 Then
        rec.top = Item(Player(Index).Helmet).Pic * PIC_Y
        rec.Bottom = rec.top + PIC_Y
        Call DD_BackBuffer.BltFast(x, y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
    End If
    If GetPlayerDir(Index)  DIR_UP Then
        If Player(Index).Shield > 0 Then
              rec.top = Item(Player(Index).Shield).Pic * PIC_Y
              rec.Bottom = rec.top + PIC_Y
              Call DD_BackBuffer.BltFast(x, y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
        If Player(Index).Weapon > 0 Then
              rec.top = Item(Player(Index).Weapon).Pic * PIC_Y
              rec.Bottom = rec.top + PIC_Y
              Call DD_BackBuffer.BltFast(x, y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
    End If
End Sub

To Complete Find Call Bltplayer

copy all those codes and paste after
then change call bltplayer to call bltplayertop

then just follow the paperdoll tutorial skipping the
bltplayer parts. and There you GO!
is this the entire code or is there more and if there is more where is it i have been waiting a long time to see what paper doll does and don't want to add it to elysium
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)