diff --git a/Makefile b/Makefile index 87fb62f..0d4e600 100644 --- a/Makefile +++ b/Makefile @@ -6,11 +6,8 @@ OBJS = src/Main.c src/Controls.c src/Debug.c src/Copying.c #compiler to use -CC = cc +CC = gcc -#gimmie dem warnings yo - -COMPILER_FLAGS = -Wall #libs we linkin bro diff --git a/README.md b/README.md index 2beeef8..b8b07fb 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,18 @@ # Tux Vs X ENGINE -A remake of the first game I made. -

This time made with C and raylib.

- -

Sprites made by Jelly_poi.

-

Programming and design by M-C-O-B.

- -Make sure to read the LICENSE file - - -# TO-DO - -* More clean code -* Build Guide -* Hitboxes working in .h files -* Screen Boundaries -* Projectiles -* Portable Binaries of the game - -# BRANCHES - -

To see new code use

- -git checkout unstable +A remake of the first game I made. +

This time made with C and raylib.

+ +

Sprites made by Jelly_poi.

+

Programming and design by M-C-O-B.

+ +Make sure to read the LICENSE file + + +# TO-DO + +* More clean code +* Build Guide +* Hitboxes +* Projectiles +* Portable Binaries of the game diff --git a/src/Controls.c b/src/Controls.c index 32a0196..d236194 100644 --- a/src/Controls.c +++ b/src/Controls.c @@ -6,8 +6,8 @@ // Controls void Func_Controls() { - if (IsKeyDown(KEY_LEFT)) TuxPos_x -= GetFrameTime() * 800.0f; - if (IsKeyDown(KEY_RIGHT)) TuxPos_x += GetFrameTime() * 800.0f; - if (IsKeyDown(KEY_UP)) TuxPos_y -= GetFrameTime() * 800.0f; - if (IsKeyDown(KEY_DOWN)) TuxPos_y += GetFrameTime() * 800.0f; + if (IsKeyDown(KEY_LEFT)) {TuxPos_x -= GetFrameTime() * 800.0f;} + if (IsKeyDown(KEY_RIGHT)) {TuxPos_x += GetFrameTime() * 800.0f;} + if (IsKeyDown(KEY_UP)) {TuxPos_y -= GetFrameTime() * 800.0f;} + if (IsKeyDown(KEY_DOWN)) {TuxPos_y += GetFrameTime() * 800.0f;} } diff --git a/src/Copying.c b/src/Copying.c index cd618b6..fdb54b6 100644 --- a/src/Copying.c +++ b/src/Copying.c @@ -10,6 +10,5 @@ void Func_License() "This program comes with ABSOLUTELY NO WARRANTY; \n" "This is free software, and you are welcome to redistribute it\n" "under certain conditions; for details read the LICENSE.\n" - "For the source code go to https://gitdab.com/Canneddonuts/Tux_Vs_X_ENGINE.git\n" ); } diff --git a/src/Main.c b/src/Main.c index 8c9ff1d..08a6baa 100644 --- a/src/Main.c +++ b/src/Main.c @@ -1,22 +1,16 @@ #include "raylib.h" + #include "Controls.h" #include "Debug.h" #include "Copying.h" -// Functions -void Func_CheckHitboxToggle(); - // Globles // Position Varaibles float EnemyPos_x = 482.0f, EnemyPos_y = 62.0f; float TuxPos_x = 32.0f, TuxPos_y = 62.0f; -// Toggle bools -bool ShowHitbox = false; -bool ShowPos = false; - // Setup Code void Func_Setup() { @@ -36,31 +30,11 @@ void Func_MainGameLoop() Texture2D enemy = LoadTexture("assets/enemy.png"); Texture2D arctic = LoadTexture("assets/arctic.png"); - // Hitboxes - Rectangle EnemyHitbox = { GetScreenWidth()/2.0f - 30, GetScreenHeight()/2.0f - 30, 290, 300}; - Rectangle TuxHitbox = { GetScreenWidth()/2.0f - 30, GetScreenHeight()/2.0f - 30, 90, 40}; - - - Rectangle boxCollision = { 0 }; - bool collision = false; - - // GameLoop - while (!WindowShouldClose()) { - - // Checks and calls the Pos show function - if (IsKeyPressed(KEY_P)) ShowPos = !ShowPos; - if (ShowPos==true) Func_ShowPos(); - + // GameLoop + while (!WindowShouldClose()) { + Func_ShowPos(); Func_Controls(); - TuxHitbox.x = TuxPos_x+50; - TuxHitbox.y = TuxPos_y+50; - EnemyHitbox.x = EnemyPos_x; - EnemyHitbox.y = EnemyPos_y; - - collision = CheckCollisionRecs(EnemyHitbox, TuxHitbox); - if (collision) boxCollision = GetCollisionRec(EnemyHitbox, TuxHitbox); - BeginDrawing(); ClearBackground(RAYWHITE); @@ -68,36 +42,16 @@ void Func_MainGameLoop() DrawTexture(arctic, 50, 0, RAYWHITE); DrawTexture(tux, TuxPos_x, TuxPos_y, RAYWHITE); DrawTexture(enemy, EnemyPos_x, EnemyPos_y, RAYWHITE); - - Func_CheckHitboxToggle(); - - if (ShowHitbox==true) { - DrawRectangleRec(EnemyHitbox, RED); - DrawRectangleRec(TuxHitbox, BLUE); - } - - if (collision) { - DrawText("FINALY BASIC AWFUL COLLISION", 50, 18, 20, MAROON); - } else { - DrawText("Tux Vs X ENGINE PROTOTYPE please read the LINCENSE", 50, 18, 20, BLACK); - } - - DrawText("Press 'H' to toggle hitboxes", 50, 72, 20, DARKGREEN); - DrawText("Press 'P' to toggle printing of the positions", 50, 95, 20, DARKGREEN); - + DrawText("Tux Vs X ENGINE PROTOTYPE please read the LINCENSE", 50, 18, 20, BLACK); + EndDrawing(); - } + } // Unload Textures UnloadTexture(tux); UnloadTexture(enemy); UnloadTexture(arctic); } -void Func_CheckHitboxToggle() -{ - if (IsKeyPressed(KEY_H)) ShowHitbox = !ShowHitbox; -} - int main() {