diff --git a/src/Main.c b/src/Main.c index c8f5eed..6ad4e7a 100644 --- a/src/Main.c +++ b/src/Main.c @@ -1,6 +1,5 @@ #include "raylib.h" - #include "Controls.h" #include "Debug.h" #include "Copying.h" @@ -11,6 +10,9 @@ float EnemyPos_x = 482.0f, EnemyPos_y = 62.0f; float TuxPos_x = 32.0f, TuxPos_y = 62.0f; +// Toggle bools +bool ShowHitbox = false; + // Setup Code void Func_Setup() { @@ -39,7 +41,8 @@ void Func_MainGameLoop() bool collision = false; // GameLoop - while (!WindowShouldClose()) { + while (!WindowShouldClose()) { + Func_ShowPos(); Func_Controls(); @@ -59,7 +62,9 @@ void Func_MainGameLoop() DrawTexture(tux, TuxPos_x, TuxPos_y, RAYWHITE); DrawTexture(enemy, EnemyPos_x, EnemyPos_y, RAYWHITE); - if (IsKeyDown(KEY_SPACE)) { + Func_CheckHitboxToggle(); + + if (ShowHitbox==true) { DrawRectangleRec(EnemyHitbox, RED); DrawRectangleRec(TuxHitbox, BLUE); } @@ -70,14 +75,21 @@ void Func_MainGameLoop() DrawText("Tux Vs X ENGINE PROTOTYPE please read the LINCENSE", 50, 18, 20, BLACK); } + DrawText("Press 'H' to toggle hitboxes", 50, 72, 20, BLACK); + EndDrawing(); - } + } // Unload Textures UnloadTexture(tux); UnloadTexture(enemy); UnloadTexture(arctic); } +void Func_CheckHitboxToggle() +{ + if (IsKeyPressed(KEY_H)) ShowHitbox = !ShowHitbox; +} + int main() {