Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Is there a way i could enable the visibility of the Players hp bar to everyone


minipimp
 Share

Recommended Posts

Is there a way i could enable the visibility of the Players hp bar to everyone, so everyone can see it ? i have been searching and i think it may have something to do with BltPlayerBars. im not sure at all and I hope i gave enough information for my question. If anyone could please help me that would be great.
Link to comment
Share on other sites

i have this working but it has a bug or something , the actual players health is not on the hp bar , all it is is the red back.

```
Sub BltPlayerBars(ByVal Index As Long)
    Dim X As Long, y As Long

    X = (GetPlayerX(Index) * PIC_X + sx + Player(Index).xOffset) - (NewPlayerX * PIC_X) - NewXOffset
    y = (GetPlayerY(Index) * PIC_Y + sx + Player(Index).yOffset) - (NewPlayerY * PIC_Y) - NewYOffset

    If Player(Index).HP = 1 Then
        Exit Sub
    End If
    If SpriteSize = 1 Then
        ' draws the back bars
        Call DD_BackBuffer.SetFillColor(RGB(255, 0, 0))
        Call DD_BackBuffer.DrawBox(X, y - 30, X + 32, y - 34)

        ' draws HP
        Call DD_BackBuffer.SetFillColor(RGB(0, 255, 0))
        Call DD_BackBuffer.DrawBox(X, y - 30, X + ((Player(Index).HP / 100) / (Player(Index).MaxHp / 100) * 32), y - 34)
    Else
        If SpriteSize = 2 Then
            ' draws the back bars
            Call DD_BackBuffer.SetFillColor(RGB(255, 0, 0))
            Call DD_BackBuffer.DrawBox(X, y - 30 - PIC_Y, X + 32, y - 34 - PIC_Y)

            ' draws HP
            Call DD_BackBuffer.SetFillColor(RGB(0, 255, 0))
            Call DD_BackBuffer.DrawBox(X, y - 30 - PIC_Y, X + ((Player(Index).HP / 100) / (Player(Index).MaxHp / 100) * 32), y - 34 - PIC_Y)
        Else
            ' draws the back bars
            Call DD_BackBuffer.SetFillColor(RGB(255, 0, 0))
            Call DD_BackBuffer.DrawBox(X, y + 2, X + 32, y - 2)

            ' draws HP
            Call DD_BackBuffer.SetFillColor(RGB(0, 255, 0))
            Call DD_BackBuffer.DrawBox(X, y + 2, X + ((Player(Index).HP / 100) / (Player(Index).MaxHp / 100) * 32), y - 2)
        End If
    End If
End Sub
```
Is there anything wrong with it?
Link to comment
Share on other sites

@S▐I▐N▐N▐I▐X:

> ```
> Sub BltPlayerBars(ByVal Index As Long)
>     Dim X As Long, y As Long
>
>     X = (GetPlayerX(Index) * PIC_X + sx + Player(Index).xOffset) - (NewPlayerX * PIC_X) - NewXOffset
>     y = (GetPlayerY(Index) * PIC_Y + sx + Player(Index).yOffset) - (NewPlayerY * PIC_Y) - NewYOffset
>
>     If Player(Index).HP = 1 Then
>         Exit Sub
>     End If
>     If SpriteSize = 1 Then
>         ' draws the back bars
>         Call DD_BackBuffer.SetFillColor(RGB(255, 0, 0))
>         Call DD_BackBuffer.DrawBox(X, y - 30, X + 32, y - 34)
>
>         ' draws HP
>         Call DD_BackBuffer.SetFillColor(RGB(0, 255, 0))
>         Call DD_BackBuffer.DrawBox(X, y - 30, X + ((Player(Index).HP / 100) / (Player(Index).MaxHp / 100) * 32), y - 34)
>     Else
>         If SpriteSize = 2 Then
>             ' draws the back bars
>             Call DD_BackBuffer.SetFillColor(RGB(255, 0, 0))
>             Call DD_BackBuffer.DrawBox(X, y - 30 - PIC_Y, X + 32, y - 34 - PIC_Y)
>
>             ' draws HP
>             Call DD_BackBuffer.SetFillColor(RGB(0, 255, 0))
>             Call DD_BackBuffer.DrawBox(X, y - 30 - PIC_Y, X + ((Player(Index).HP / 100) / (Player(Index).MaxHp / 100) * 32), y - 34 - PIC_Y)
>         Else
>             ' draws the back bars
>             Call DD_BackBuffer.SetFillColor(RGB(255, 0, 0))
>             Call DD_BackBuffer.DrawBox(X, y + 2, X + 32, y - 2)
>
>             ' draws HP
>             Call DD_BackBuffer.SetFillColor(RGB(0, 255, 0))
>             Call DD_BackBuffer.DrawBox(X, y + 2, X + ((Player(Index).HP / 100) / (Player(Index).MaxHp / 100) * 32), y - 2)
>         End If
>     End If
> End Sub
> ```

That's nice coding! But, what's with the If SpriteSize = 1?

Other than that I don't see much of a problem..
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...