From 01739c4918f5a82dd3ea6d7e7babf94e533eafd0 Mon Sep 17 00:00:00 2001 From: parking_turkeys Date: Thu, 9 Jul 2026 16:35:00 -0400 Subject: [PATCH] retrying www --- game.h | 7 +++++++ level.c | 10 ++++++++++ main.c | 4 ++-- main_v2.c | 30 ++++++++++++++++++++++++++++++ player.c | 10 ++++++++++ 5 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 game.h create mode 100644 level.c create mode 100644 main_v2.c create mode 100644 player.c diff --git a/game.h b/game.h new file mode 100644 index 0000000..62967f7 --- /dev/null +++ b/game.h @@ -0,0 +1,7 @@ +#define SCREENWIDTH 640 +#define SCREENHEIGHT 480 +#define FPS 30 +#define WINDOWTITLE "platformer v2 (it works this time) (not really)" + +int drawstage(void); +int drawplayer(void); diff --git a/level.c b/level.c new file mode 100644 index 0000000..0337dfd --- /dev/null +++ b/level.c @@ -0,0 +1,10 @@ +#include "raylib.h" +#include +#include +#include "game.h" + +int drawstage(void) +{ + ClearBackground(RAYWHITE); + return 1; +} diff --git a/main.c b/main.c index 68a7bbb..97dd19c 100644 --- a/main.c +++ b/main.c @@ -57,7 +57,7 @@ int main(void) player.velocity.y = 0; move_x(&player, direction.x); move_y(&player, direction.y); - if (injump = -1) {gravity(&player, ground, ground_length);} else { injump += GetFrameTime(); player.position.y = jumpstart + powf(injump, 2) * 16 + 2 * injump; + if (injump = -1) {gravity(&player, ground, ground_length);} else { injump += GetFrameTime(); player.position.y = jumpstart + powf(injump, 2) * 16 + 2 * injump;} //set position move_character(&player, ground, ground_length, GetFrameTime()); //player.position.y += 1; @@ -107,7 +107,7 @@ Vector2 handle_inputs(struct character *player) direction.x++; }; if (IsKeyDown(inputs[4])) { injump = 0; - jumpstart = player->position.y + jumpstart = player->position.y; } return direction; } diff --git a/main_v2.c b/main_v2.c new file mode 100644 index 0000000..b961bc8 --- /dev/null +++ b/main_v2.c @@ -0,0 +1,30 @@ +// THIS TIME I WILL PLAN THIS OUT +// OKAY SO UHHHH IDK HOW TO DO THIS LMFAO +// MAYBE a seperate file? for the player?? +// oh first +#include "raylib.h" +// wait arent you supposed to make a file with h in it or smth +// i have no idea how to use C btw +// ok yeah that's to link all the other files together +#include "game.h" // remember to make this +#include +#include // seems useful + +int main(void) +{ + InitWindow(SCREENWIDTH, SCREENHEIGHT, WINDOWTITLE); + SetTargetFPS(FPS); + + while (!WindowShouldClose()) { + //update variables + + BeginDrawing(); + drawstage(); + drawplayer(); + EndDrawing(); + } + + CloseWindow(); + + return 0; +} diff --git a/player.c b/player.c new file mode 100644 index 0000000..9ab055f --- /dev/null +++ b/player.c @@ -0,0 +1,10 @@ +#include "raylib.h" +#include +#include +#include "game.h" + + +int drawplayer(void) +{ + return 1; +} -- 2.47.3