From 13bd9e293e8ed12f39d7b97036abfad69b84ed19 Mon Sep 17 00:00:00 2001 From: realtradam Date: Sun, 12 May 2024 17:45:10 -0400 Subject: score system --- src/bullet.c | 12 ++++++------ src/main.c | 8 ++++++-- src/player.h | 1 + 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/bullet.c b/src/bullet.c index 12e4ca6..785ce2f 100644 --- a/src/bullet.c +++ b/src/bullet.c @@ -43,13 +43,13 @@ render_bullets(void) continue; } else if(bullets[i].team == 1) - { - DrawCube(bullets[i].position, 0.25, 0.25, 0.25, DARKBLUE); - } + { + DrawCube(bullets[i].position, 0.25, 0.25, 0.25, DARKBLUE); + } else if(bullets[i].team == 2) - { - DrawCube(bullets[i].position, 0.25, 0.25, 0.25, DARKPURPLE); - } + { + DrawCube(bullets[i].position, 0.25, 0.25, 0.25, DARKPURPLE); + } } } diff --git a/src/main.c b/src/main.c index ce5130c..a1cbc2a 100644 --- a/src/main.c +++ b/src/main.c @@ -189,8 +189,12 @@ int main(void) char text[50]; - sprintf(text, "Joystick %d,%d", inputs_p1.stick_x, inputs_p1.stick_y); - DrawText(text, 10, 30, 12, GREEN); + //sprintf(text, "Joystick %d,%d", inputs_p1.stick_x, inputs_p1.stick_y); + //DrawText(text, 10, 30, 12, GREEN); + sprintf(text, "Player1: %d", world.players[0].points); + DrawText(text, 50, 30, 12, BLUE); + sprintf(text, "Player2: %d", world.players[1].points); + DrawText(text, 210, 30, 12, VIOLET); /* DrawText("Position", 150, 30, 12, GREEN); DrawText(text, 150, 45, 12, GREEN); diff --git a/src/player.h b/src/player.h index 0e94080..63b7b83 100644 --- a/src/player.h +++ b/src/player.h @@ -15,6 +15,7 @@ struct float speed; Color color; int camera_mode; + int points; } Player; -- cgit v1.2.3