First commit with game files
This commit is contained in:
parent
6bcf6fb77e
commit
e3b240b89c
9 changed files with 120 additions and 1 deletions
23
Makefile
Normal file
23
Makefile
Normal file
|
@ -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)
|
|
@ -1,4 +1,9 @@
|
|||
# Tux_Vs_X_ENGINE
|
||||
|
||||
A remake of the first game I made.
|
||||
made with C and raylib.
|
||||
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
|
||||
|
|
3
To-Do.md
Normal file
3
To-Do.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
1.More clean code
|
||||
2.Build Guide
|
||||
3.Most Of the game lul
|
BIN
assets/arctic.png
Normal file
BIN
assets/arctic.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
BIN
assets/enemy.png
Normal file
BIN
assets/enemy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
assets/tux.png
Normal file
BIN
assets/tux.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
12
src/Controls.c
Normal file
12
src/Controls.c
Normal file
|
@ -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;}
|
||||
}
|
7
src/Controls.h
Normal file
7
src/Controls.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
// makes the Varaibles globle across c files
|
||||
extern float TuxPos_x;
|
||||
extern float TuxPos_y;
|
||||
|
||||
int Func_Controls();
|
69
src/main.c
Normal file
69
src/main.c
Normal file
|
@ -0,0 +1,69 @@
|
|||
#include "raylib.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#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;
|
||||
}
|
Loading…
Reference in a new issue