Die Formel von Uhrwerk stimmt schon:

health_pos = 200 - (player_health / max_health * 200);

player_healt ist das momentane Leben deines Players.
max_healt ist das maximale Leben deines Players.

zum Beispiel:
player_healt = 90;
max_health = 100;
health_pos = 200 - (90 / 100 * 200); // = 20

player_healt = 40;
max_health = 100;
health_pos = 200 - (40 / 100 * 200); // = 120

player_healt = 90;
max_health = 200;
health_pos = 200 - (90 / 200 * 200); // = 110

player_healt = 180;
max_health = 200;
health_pos = 200 - (180 / 200 * 200); // = 20

Das ist einfache Mathematik. Solltest du schon beherrschen. Wird auch nicht einfacher bei Vectorberechnungen die du bei 3d brauchst

EDIT: Uups, ihr wart schneller...




Last edited by Widi; 05/10/10 21:20.