no Client~Side procure por:
em baixo adicione:
dps na modDirectDraw7 procure por:
e mude para:
Demonstração de como vai ficar:
Créditos: a mim Thales12
- Código:
Public Sub BltPlayer(ByVal Index As Long)
Dim Anim As Byte, i As Long, X As Long, Y As Long
Dim Sprite As Long, spritetop As Long
Dim rec As DxVBLib.RECT
Dim attackspeed As Long
' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler
Sprite = GetPlayerSprite(Index)
If Sprite < 1 Or Sprite > NumCharacters Then Exit Sub
CharacterTimer(Sprite) = GetTickCount + SurfaceTimerMax
If DDS_Character(Sprite) Is Nothing Then
Call InitDDSurf("characters" & Sprite, DDSD_Character(Sprite), DDS_Character(Sprite))
End If
' speed from weapon
If GetPlayerEquipment(Index, Weapon) > 0 Then
attackspeed = Item(GetPlayerEquipment(Index, Weapon)).Speed
Else
attackspeed = 1000
End If
' Reset frame
If Player(Index).Step = 3 Then
Anim = 0
ElseIf Player(Index).Step = 1 Then
Anim = 2
End If
' Check for attacking animation
If Player(Index).AttackTimer + (attackspeed / 2) > GetTickCount Then
If Player(Index).Attacking = 1 Then
Anim = 3
End If
Else
' If not attacking, walk normally
Select Case GetPlayerDir(Index)
Case DIR_UP
If (Player(Index).YOffset > 8) Then Anim = Player(Index).Step
Case DIR_DOWN
If (Player(Index).YOffset < -8) Then Anim = Player(Index).Step
Case DIR_LEFT
If (Player(Index).XOffset > 8) Then Anim = Player(Index).Step
Case DIR_RIGHT
If (Player(Index).XOffset < -8) Then Anim = Player(Index).Step
End Select
End If
' Check to see if we want to stop making him attack
With Player(Index)
If .AttackTimer + attackspeed < GetTickCount Then
.Attacking = 0
.AttackTimer = 0
End If
End With
' Set the left
Select Case GetPlayerDir(Index)
Case DIR_UP
spritetop = 3
Case DIR_RIGHT
spritetop = 2
Case DIR_DOWN
spritetop = 0
Case DIR_LEFT
spritetop = 1
End Select
With rec
.top = spritetop * (DDSD_Character(Sprite).lHeight / 4)
.Bottom = .top + (DDSD_Character(Sprite).lHeight / 4)
.Left = Anim * (DDSD_Character(Sprite).lWidth / 4)
.Right = .Left + (DDSD_Character(Sprite).lWidth / 4)
End With
' Calculate the X
X = GetPlayerX(Index) * PIC_X + Player(Index).XOffset - ((DDSD_Character(Sprite).lWidth / 4 - 32) / 2)
' Is the player's height more than 32..?
If (DDSD_Character(Sprite).lHeight) > 32 Then
' Create a 32 pixel offset for larger sprites
Y = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset - ((DDSD_Character(Sprite).lHeight / 4) - 32)
Else
' Proceed as normal
Y = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset
End If
' render the actual sprite
Call BltSprite(Sprite, X, Y, rec)
' check for paperdolling
For i = 1 To UBound(PaperdollOrder)
If GetPlayerEquipment(Index, PaperdollOrder(i)) > 0 Then
If Item(GetPlayerEquipment(Index, PaperdollOrder(i))).Paperdoll > 0 Then
Call BltPaperdoll(X, Y, Item(GetPlayerEquipment(Index, PaperdollOrder(i))).Paperdoll, Anim, spritetop)
End If
End If
Next
' Error handler
Exit Sub
errorhandler:
HandleError "BltPlayer", "modDirectDraw7", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
End Sub
em baixo adicione:
- Código:
Public Sub BltPlayerHP(ByVal Index As Long)
Dim X As Long, Y As Long, Sprite As Long
X = GetPlayerX(Index) * PIC_X + Player(Index).XOffset
Sprite = GetPlayerSprite(Index)
If Sprite < 1 Or Sprite > NumCharacters Then
Y = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset - 25
Else
Y = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset - (DDSD_Character(Sprite).lHeight) + 149
End If
' Draw the outside box
Call DDS_BackBuffer.SetFillColor(RGB(0, 0, 0))
Call DDS_BackBuffer.DrawBox(ConvertMapX(X), ConvertMapY(Y), ConvertMapX(X + 35), ConvertMapY(Y + 4))
' Draw the HP bar
Call DDS_BackBuffer.SetFillColor(RGB(0, 255, 0))
Call DDS_BackBuffer.DrawBox(ConvertMapX(X), ConvertMapY(Y), ConvertMapX(X + Int(((GetPlayerVital(Index, Vitals.HP) / 35) / (GetPlayerMaxVital(Index, Vitals.HP) / 35)) * 35)), ConvertMapY(Y + 4))
End Sub
Public Sub BltPlayerMP(ByVal Index As Long)
Dim X As Long, Y As Long, Sprite As Long
X = GetPlayerX(Index) * PIC_X + Player(Index).XOffset
Sprite = GetPlayerSprite(Index)
If Sprite < 1 Or Sprite > NumCharacters Then
Y = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset - 20
Else
Y = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset - (DDSD_Character(Sprite).lHeight) + 155
End If
' Draw the outside box
Call DDS_BackBuffer.SetFillColor(RGB(0, 0, 0))
Call DDS_BackBuffer.DrawBox(ConvertMapX(X), ConvertMapY(Y), ConvertMapX(X + 35), ConvertMapY(Y + 4))
' Draw the HP bar
Call DDS_BackBuffer.SetFillColor(RGB(50, 30, 300))
Call DDS_BackBuffer.DrawBox(ConvertMapX(X), ConvertMapY(Y), ConvertMapX(X + Int(((GetPlayerVital(Index, Vitals.MP) / 35) / (GetPlayerMaxVital(Index, Vitals.MP) / 35)) * 35)), ConvertMapY(Y + 4))
End Sub
dps na modDirectDraw7 procure por:
- Código:
' Players
For i = 1 To Player_HighIndex
If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
If Player(i).Y = Y Then
Call BltPlayer(i)
End If
End If
Next
e mude para:
- Código:
' Players
For i = 1 To Player_HighIndex
If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
If Player(i).Y = Y Then
Call BltPlayerHP(i)
Call BltPlayerMP(i)
Call BltPlayer(i)
End If
End If
Next
Demonstração de como vai ficar:
- Spoiler:
Créditos: a mim Thales12