16.07.2016, 17:13
I already have created a bar which should present proportion of health. Player1 fights with Player2, they both have 100HP, in this case this algorithm works
475.3648 - a position of textdraw when Player1 wins (Player2 has 0HP)
629.9 - a position of textdraw when Player2 wins (Player1 has 0HP)
154.5352 - difference of 629.9 and 475.3648
But this works only when players have same amount of health. I use the same method with custom healthbar and it works perfectly
Does anyone have an idea how to create a working algorithm for this?
Код:
475.3648 + (154.5352 * (100.0 / 100.0) * 0.5)
629.9 - a position of textdraw when Player2 wins (Player1 has 0HP)
154.5352 - difference of 629.9 and 475.3648
But this works only when players have same amount of health. I use the same method with custom healthbar and it works perfectly
Код:
PlayerTextDrawTextSize(playerid, HealthBar, 545.824340 + (58.67566 * (Player[playerid][p_health_amount] / 100.0)), 0.0);