Suporte ao desenvolvimento de jogos!


    Hud

    Compartilhe
    avatar
    Ricardo
    Ocasional
    Ocasional

    Mensagens : 156
    Créditos : 69

    Ficha do personagem
    Nível: 1
    Vida:
    30/30  (30/30)
    Energia:
    0/0  (0/0)

    Hud

    Mensagem por Ricardo em Ter Jun 05, 2012 8:40 am

    Imagem



    Client~Side
    modDirectDraw7

    Procure por:

    Código:
    Public DDS_Bars As DirectDrawSurface7

    Abaixo adicione:

    Código:
    Public DDS_Hud As DirectDrawSurface7

    Procure por:

    Código:
    Public DDSD_Bars As DDSURFACEDESC2

    Abaixo adicione:

    Código:
    Public DDSD_Hud As DDSURFACEDESC2

    Procure por:

    Código:
        If FileExist(App.Path & "\data files\graphics\bars.bmp", True) Then Call InitDDSurf("bars", DDSD_Bars, DDS_Bars)

    Abaixo adicione:

    Código:
        If FileExist(App.Path & "\data files\graphics\hud.bmp", True) Then Call InitDDSurf("hud", DDSD_Hud, DDS_Hud)

    Procure por:

    Código:
        ' Render the bars
        BltBars

    Abaixo adicione:

    Código:
        ' Render the hud
        BltHud

    No final do modulo adicione:

    Código:
    Sub BltHud()
    Dim HealthRec As RECT, SpiritRec As RECT, ExperienceRec As RECT, SpriteRec As RECT

        ' Health
        With HealthRec
            .top = 0
            .Bottom = 5
            .Left = 0
            .Right = ((GetPlayerVital(MyIndex, Vitals.HP) / DDSD_Hud.lWidth) / (GetPlayerMaxVital(MyIndex, Vitals.HP) / DDSD_Hud.lWidth)) * DDSD_Hud.lWidth
        End With
       
        Call DDS_BackBuffer.BltFast(Camera.Left + 40, Camera.top + 16, DDS_Hud, HealthRec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
       
        ' Spirit
        With SpiritRec
            .top = 5
            .Bottom = 10
            .Left = 0
            .Right = ((GetPlayerVital(MyIndex, Vitals.mp) / DDSD_Hud.lWidth) / (GetPlayerMaxVital(MyIndex, Vitals.mp) / DDSD_Hud.lWidth)) * DDSD_Hud.lWidth
        End With
       
        Call DDS_BackBuffer.BltFast(Camera.Left + 40, Camera.top + 22, DDS_Hud, SpiritRec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)

        ' Experience
        With ExperienceRec
            .top = 10
            .Bottom = 15
            .Left = 0
            .Right = ((GetPlayerExp(MyIndex) / DDSD_Hud.lWidth) / (GetPlayerNextLevel / DDSD_Hud.lWidth)) * DDSD_Hud.lWidth
        End With
       
        Call DDS_BackBuffer.BltFast(Camera.Left + 40, Camera.top + 28, DDS_Hud, ExperienceRec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
       
        ' Sprite
        With SpriteRec
            .top = 0
            .Bottom = DDSD_Character(GetPlayerSprite(MyIndex)).lHeight / 4
            .Left = 0
            .Right = DDSD_Character(GetPlayerSprite(MyIndex)).lWidth / 4
        End With
       
        Call DDS_BackBuffer.BltFast(Camera.Left + 5, Camera.top + 5, DDS_Character(GetPlayerSprite(MyIndex)), SpriteRec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
       
        ' Error handler
        Exit Sub
    errorhandler:
        HandleError "BltHud", "modDirectDraw7", Err.Number, Err.Description, Err.Source, Err.HelpContext
        Err.Clear
        Exit Sub
    End Sub

    modGlobals

    No final do modulo adicione:

    Código:
    ' experience
    Public GetPlayerNextLevel As Long

    modHandleData

    Mude a Sub HandlePlayerExp para:

    Código:
    Private Sub HandlePlayerExp(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    Dim Buffer As clsBuffer
    Dim i As Long
       
        ' If debug mode, handle error then exit out
        If Options.Debug = 1 Then On Error GoTo errorhandler
       
        Set Buffer = New clsBuffer
        Buffer.WriteBytes Data()
       
        SetPlayerExp MyIndex, Buffer.ReadLong
        GetPlayerNextLevel = Buffer.ReadLong
        frmMain.lblEXP.Caption = GetPlayerExp(Index) & "/" & GetPlayerNextLevel
        ' mp bar
        frmMain.imgEXPBar.Width = ((GetPlayerExp(MyIndex) / EXPBar_Width) / (GetPlayerNextLevel / EXPBar_Width)) * EXPBar_Width
       
        ' Error handler
        Exit Sub
    errorhandler:
        HandleError "HandlePlayerExp", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext
        Err.Clear
        Exit Sub
    End Sub

    Anexo


    Salve na pasta data files/graphics, no formato .bmp

    Créditos

    Ricardo


    Última edição por Ricardo em Ter Jun 05, 2012 6:29 pm, editado 3 vez(es)
    avatar
    Valentine
    Administrador
    Administrador

    Medalhas :
    Mensagens : 4961
    Créditos : 1055

    Re: Hud

    Mensagem por Valentine em Ter Jun 05, 2012 11:19 am

    Muito Bom Ricardo
    + 1 crédito


    _________________

    iuriigor
    Novato
    Novato

    Mensagens : 2
    Créditos : 0

    Re: Hud

    Mensagem por iuriigor em Ter Jul 03, 2012 12:55 pm

    da erro aki :

    .Right = ((GetPlayerVital(MyIndex, Vitals.HP) / DDSD_Hud.lWidth) / (GetPlayerMaxVital(MyIndex, Vitals.HP) / DDSD_Hud.lWidth)) * DDSD_Hud.lWidth[code]
    avatar
    AlexsandroChaos
    Novato
    Novato

    Mensagens : 26
    Créditos : 5

    Re: Hud

    Mensagem por AlexsandroChaos em Ter Dez 11, 2012 4:01 am

    oq e hud?

    Conteúdo patrocinado

    Re: Hud

    Mensagem por Conteúdo patrocinado


      Data/hora atual: Sex Set 21, 2018 8:35 am