feat/refactor: player health and overlay display

This commit is contained in:
2026-07-05 20:17:06 +02:00
parent a4289a21aa
commit cc42a45f68
5 changed files with 27 additions and 10 deletions
+8 -2
View File
@@ -10,6 +10,8 @@ float playerSpeeds[SPEED_COUNT] = {
10.0f
};
Config config;
playerSpeedID GetPlayerSpeedID(float speed) {
for (int i = 0; i < SPEED_COUNT; i++) {
if (playerSpeeds[i] == speed) {
@@ -27,12 +29,15 @@ Player* GetPlayer(void)
void CreatePlayer(void)
{
InitConfig(&config, "config/player.ini");
int PLAYER_HEALTH_MAX = GetConfigInt(&config, "HEALTH_MAX");
TextureAsset startShipAsset = playerTextureAssets[START_SHIP];
Texture2D texture = LoadTexture(startShipAsset.path);
float frameWidth = startShipAsset.frameWidth;
float rotation = startShipAsset.rotation;
Sprite playerSprite = {
.texture = texture,
@@ -66,7 +71,8 @@ void CreatePlayer(void)
.sprite = playerSprite,
.animation = playerAnimation,
.physics = playerPhysics,
.rotation = rotation
.rotation = rotation,
.health = PLAYER_HEALTH_MAX
};
}