diff options
author | nathansmithsmith <nathansmith7@mailfence.com> | 2023-10-28 16:45:35 -0600 |
---|---|---|
committer | nathansmithsmith <nathansmith7@mailfence.com> | 2023-10-28 16:45:35 -0600 |
commit | a143a9e7b5ce7b47f4d2c56b250e089b88a888b5 (patch) | |
tree | d364daa65d9e3e0b6b415ab47174e237b899f8e4 /src/gameScreen.c | |
parent | 60fce38926856e1842aab7c14be99336f34b733f (diff) |
Things change color so you know when its on target
Diffstat (limited to 'src/gameScreen.c')
-rw-r--r-- | src/gameScreen.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gameScreen.c b/src/gameScreen.c index ec26fee..61865bd 100644 --- a/src/gameScreen.c +++ b/src/gameScreen.c @@ -120,7 +120,7 @@ void drawGameScreenTargetInfo(Game * game, GameScreen * gameScreen) { data->targetedEntityId, data->targetedEntityFingerprint, Vector3Distance(player->position, targetedEntity->position), - traceRayToEntity(*targetedEntity, (Ray){player->position, data->gunTarget}).hit ? "Yes" : "No" + data->isOnTarget ? "Yes" : "No" ); } } @@ -139,8 +139,14 @@ void drawGameScreenGui(Game * game) { GameScreen * gameScreen = &game->gameScreen; // Draw cross hair. - if (gameScreen->mainCamera == FIRST_PERSON_CAMERA) - drawCrossHair(10.0, 2.0, BLUE); + if (gameScreen->mainCamera == FIRST_PERSON_CAMERA) { + // Get color depending if on target or not. + Entity * player = getEntityFromWorld(game->world, 0); + AntifaShip * data = (AntifaShip*)player->data; + Color color = data->isOnTarget ? RED : BLUE; + + drawCrossHair(10.0, 2.0, color); + } drawGameScreenInfoText(game, gameScreen); drawGameScreenTargetInfo(game, gameScreen); |