added hitbox toggle
This commit is contained in:
parent
53130a6d19
commit
6749eeb679
1 changed files with 16 additions and 4 deletions
16
src/Main.c
16
src/Main.c
|
@ -1,6 +1,5 @@
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
|
|
||||||
#include "Controls.h"
|
#include "Controls.h"
|
||||||
#include "Debug.h"
|
#include "Debug.h"
|
||||||
#include "Copying.h"
|
#include "Copying.h"
|
||||||
|
@ -11,6 +10,9 @@
|
||||||
float EnemyPos_x = 482.0f, EnemyPos_y = 62.0f;
|
float EnemyPos_x = 482.0f, EnemyPos_y = 62.0f;
|
||||||
float TuxPos_x = 32.0f, TuxPos_y = 62.0f;
|
float TuxPos_x = 32.0f, TuxPos_y = 62.0f;
|
||||||
|
|
||||||
|
// Toggle bools
|
||||||
|
bool ShowHitbox = false;
|
||||||
|
|
||||||
// Setup Code
|
// Setup Code
|
||||||
void Func_Setup()
|
void Func_Setup()
|
||||||
{
|
{
|
||||||
|
@ -40,6 +42,7 @@ void Func_MainGameLoop()
|
||||||
|
|
||||||
// GameLoop
|
// GameLoop
|
||||||
while (!WindowShouldClose()) {
|
while (!WindowShouldClose()) {
|
||||||
|
|
||||||
Func_ShowPos();
|
Func_ShowPos();
|
||||||
Func_Controls();
|
Func_Controls();
|
||||||
|
|
||||||
|
@ -59,7 +62,9 @@ void Func_MainGameLoop()
|
||||||
DrawTexture(tux, TuxPos_x, TuxPos_y, RAYWHITE);
|
DrawTexture(tux, TuxPos_x, TuxPos_y, RAYWHITE);
|
||||||
DrawTexture(enemy, EnemyPos_x, EnemyPos_y, RAYWHITE);
|
DrawTexture(enemy, EnemyPos_x, EnemyPos_y, RAYWHITE);
|
||||||
|
|
||||||
if (IsKeyDown(KEY_SPACE)) {
|
Func_CheckHitboxToggle();
|
||||||
|
|
||||||
|
if (ShowHitbox==true) {
|
||||||
DrawRectangleRec(EnemyHitbox, RED);
|
DrawRectangleRec(EnemyHitbox, RED);
|
||||||
DrawRectangleRec(TuxHitbox, BLUE);
|
DrawRectangleRec(TuxHitbox, BLUE);
|
||||||
}
|
}
|
||||||
|
@ -70,6 +75,8 @@ void Func_MainGameLoop()
|
||||||
DrawText("Tux Vs X ENGINE PROTOTYPE please read the LINCENSE", 50, 18, 20, BLACK);
|
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();
|
EndDrawing();
|
||||||
}
|
}
|
||||||
// Unload Textures
|
// Unload Textures
|
||||||
|
@ -78,6 +85,11 @@ void Func_MainGameLoop()
|
||||||
UnloadTexture(arctic);
|
UnloadTexture(arctic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Func_CheckHitboxToggle()
|
||||||
|
{
|
||||||
|
if (IsKeyPressed(KEY_H)) ShowHitbox = !ShowHitbox;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue