added hitbox toggle
This commit is contained in:
parent
53130a6d19
commit
6749eeb679
1 changed files with 16 additions and 4 deletions
20
src/Main.c
20
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()
|
||||||
{
|
{
|
||||||
|
@ -39,7 +41,8 @@ void Func_MainGameLoop()
|
||||||
bool collision = false;
|
bool collision = false;
|
||||||
|
|
||||||
// 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,14 +75,21 @@ 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
|
||||||
UnloadTexture(tux);
|
UnloadTexture(tux);
|
||||||
UnloadTexture(enemy);
|
UnloadTexture(enemy);
|
||||||
UnloadTexture(arctic);
|
UnloadTexture(arctic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Func_CheckHitboxToggle()
|
||||||
|
{
|
||||||
|
if (IsKeyPressed(KEY_H)) ShowHitbox = !ShowHitbox;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue