]> _ Git - aichan-platformer.git/commitdiff
retrying www
authorparking_turkeys <roya1060wien@gmail.com>
Thu, 9 Jul 2026 20:35:00 +0000 (16:35 -0400)
committerparking_turkeys <roya1060wien@gmail.com>
Thu, 9 Jul 2026 20:35:00 +0000 (16:35 -0400)
game.h [new file with mode: 0644]
level.c [new file with mode: 0644]
main.c
main_v2.c [new file with mode: 0644]
player.c [new file with mode: 0644]

diff --git a/game.h b/game.h
new file mode 100644 (file)
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 (file)
index 0000000..0337dfd
--- /dev/null
+++ b/level.c
@@ -0,0 +1,10 @@
+#include "raylib.h"
+#include <stdio.h>
+#include <math.h>
+#include "game.h"
+
+int drawstage(void)
+{
+       ClearBackground(RAYWHITE);
+       return 1;
+}
diff --git a/main.c b/main.c
index 68a7bbb..97dd19c 100644 (file)
--- 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 (file)
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 <math.h>
+#include <stdio.h> // 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 (file)
index 0000000..9ab055f
--- /dev/null
+++ b/player.c
@@ -0,0 +1,10 @@
+#include "raylib.h"
+#include <stdio.h>
+#include <math.h>
+#include "game.h"
+
+
+int drawplayer(void)
+{
+       return 1;
+}