diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..db218bc --- /dev/null +++ b/Makefile @@ -0,0 +1,23 @@ +#COPYRIGHT 2021 by M-C-O-B all code is under the GNU General Public License v3.0 and later + +#files to compile + +OBJS = src/main.c src/Controls.c + +#compiler to use + +CC = gcc + + +#libs we linkin bro + +LINKER_FLAGS = -lraylib -lGL -lm -lpthread -ldl -lrt -lX11 + +#name of muh bin lel + +OBJ_NAME = T_V_X_E + +#no regerts cuz its all together now + +all : $(OBJS) + $(CC) $(OBJS) $(COMPILER_FLAGS) $(LINKER_FLAGS) -o $(OBJ_NAME) diff --git a/README.md b/README.md index 7daa395..4e2ce05 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,9 @@ # Tux_Vs_X_ENGINE A remake of the first game I made. -made with C and raylib. \ No newline at end of file +made with C and raylib. + +Sprites made my Jelly_poi +Code and design by M-C-O-B + +Make sure to read the to-do.md and the LICENSE files diff --git a/To-Do.md b/To-Do.md new file mode 100644 index 0000000..5a9789f --- /dev/null +++ b/To-Do.md @@ -0,0 +1,3 @@ +1.More clean code +2.Build Guide +3.Most Of the game lul diff --git a/assets/arctic.png b/assets/arctic.png new file mode 100644 index 0000000..2b41773 Binary files /dev/null and b/assets/arctic.png differ diff --git a/assets/enemy.png b/assets/enemy.png new file mode 100644 index 0000000..91f5507 Binary files /dev/null and b/assets/enemy.png differ diff --git a/assets/tux.png b/assets/tux.png new file mode 100644 index 0000000..d7af9e7 Binary files /dev/null and b/assets/tux.png differ diff --git a/src/Controls.c b/src/Controls.c new file mode 100644 index 0000000..6b15aa3 --- /dev/null +++ b/src/Controls.c @@ -0,0 +1,12 @@ +#include "raylib.h" +#include "Controls.h" +// Tux Position Varaibles +float TuxPos_x = 32.0f, TuxPos_y = 62.0f; +// Controls +int 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;} +} diff --git a/src/Controls.h b/src/Controls.h new file mode 100644 index 0000000..d9dbe1e --- /dev/null +++ b/src/Controls.h @@ -0,0 +1,7 @@ +#pragma once + +// makes the Varaibles globle across c files +extern float TuxPos_x; +extern float TuxPos_y; + +int Func_Controls(); diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..ec3b917 --- /dev/null +++ b/src/main.c @@ -0,0 +1,69 @@ +#include "raylib.h" +#include + +#include "Controls.h" + +// Globles + +// Position Varaibles +float EnemyPos_x = 482.0f, EnemyPos_y = 62.0f; + + +int Func_ShowPos() +{ + // Ouput Position Infomation in the command line + printf("TuxPos_x = %f TuxPos_y = %f EnemyPos_x = %f EnemyPos_y = %f\n", TuxPos_x, TuxPos_y, EnemyPos_x, EnemyPos_y); +} + + +// Setup Code +int Func_Setup() +{ + const int screenWidth = 800; + const int screenHeight = 450; + + InitWindow(screenWidth, screenHeight, "Tux Vs Windows"); + + SetTargetFPS(60); +} + +// GameLoop Code +int Func_MainGameLoop() +{ + // Load Textures + Texture2D tux = LoadTexture("assets/tux.png"); + Texture2D enemy = LoadTexture("assets/enemy.png"); + Texture2D arctic = LoadTexture("assets/arctic.png"); + + // GameLoop + while (!WindowShouldClose()) + { + Func_ShowPos(); + Func_Controls(); + + + BeginDrawing(); + ClearBackground(RAYWHITE); + + // Put the sprites on the screen + DrawTexture(arctic, 50, 0, RAYWHITE); + DrawTexture(tux, TuxPos_x, TuxPos_y, RAYWHITE); + DrawTexture(enemy, EnemyPos_x, EnemyPos_y, RAYWHITE); + EndDrawing(); + } + // Unload Textures + UnloadTexture(tux); + UnloadTexture(enemy); + UnloadTexture(arctic); +} + + +int main() +{ + Func_Setup(); + Func_MainGameLoop(); + + CloseWindow(); + + return 0; +}