Faisal Ahmed Faisal Ahmed - 1 year ago 86
Vb.net Question

VB.NET percentage of value decrease

im working on a game and im having a problem calculating the percentage of value decrease.

for example Player 1 has a health value of 3503. Player 2 attacks Player 1 with -1450.
now i want to know the percentage of health lost (eg : player 1 has lost 58% of his original health)

Answer Source
    Dim Player1_Health As Integer = 3503
    Dim Player2_Attack As Integer = -1450
    Dim Percentage As Integer = Math.Abs(Player2_Attack) / Player1_Health * 100
    Dim msg As String = "Player 1 has lost " & Percentage & "% of his original health!"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download