Desineria RPG Maker
Você esta conectado na Desineria RPG Maker!

Participe do fórum, é rápido e fácil

Desineria RPG Maker
Você esta conectado na Desineria RPG Maker!
Desineria RPG Maker
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

barra de hp/mp em cima do player visivel para todos jogadores

2 participantes

Ir para baixo

barra de hp/mp em cima do player visivel para todos jogadores Empty barra de hp/mp em cima do player visivel para todos jogadores

Mensagem  wesleyhero Qui Nov 03, 2011 5:17 pm

no Client~Side procure por:
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

depois posto umas imagens para vcs verem como fica
wesleyhero
wesleyhero
Moderador Global
Moderador Global

Mensagens : 11
Pontos : 33
Reputação : 9
Data de inscrição : 02/11/2011

Desineria RPG Maker
Nível de atividade Nível de atividade:
barra de hp/mp em cima do player visivel para todos jogadores Left_bar_bleue34/1000barra de hp/mp em cima do player visivel para todos jogadores Empty_bar_bleue  (34/1000)

Ir para o topo Ir para baixo

barra de hp/mp em cima do player visivel para todos jogadores Empty Re: barra de hp/mp em cima do player visivel para todos jogadores

Mensagem   Ter Nov 08, 2011 3:53 pm

Tutorial muito bom,curti +rep.
avatar

Pontos : 0
Data de inscrição : 31/12/1969

Desineria RPG Maker
Nível de atividade Nível de atividade:
barra de hp/mp em cima do player visivel para todos jogadores Left_bar_bleue138/1000barra de hp/mp em cima do player visivel para todos jogadores Empty_bar_bleue  (138/1000)

Ir para o topo Ir para baixo

Ir para o topo


 
Permissões neste sub-fórum
Não podes responder a tópicos