From 32be3483adecd76c0d457a87d58a504c7b7ed912 Mon Sep 17 00:00:00 2001 From: Daniel Maas Date: Sat, 26 Sep 2026 20:12:12 +0200 Subject: [PATCH] =?UTF-8?q?Gitignore=20hinzugef=C3=BCgt=20und=20Bl=C3=B6ck?= =?UTF-8?q?e=20werden=20gez=C3=A4hlt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 12 ++++++++++++ main.c | 27 +++++++++------------------ 2 files changed, 21 insertions(+), 18 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..132303a --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +# Kompilierte ausführbare Dateien +*.exe +*.out +*.app + +# Objektdateien +*.o +*.obj + +# Build-Ordner oder IDE-spezifische Ordner (falls vorhanden) +build/ +.vscode/ \ No newline at end of file diff --git a/main.c b/main.c index 5364d07..4a50cc5 100644 --- a/main.c +++ b/main.c @@ -40,11 +40,12 @@ int main(void) { // INIT const int screenWidth = 800; const int screenHeight = 450; - InitWindow(screenWidth, screenHeight, "Raylib Manuell"); + InitWindow(screenWidth, screenHeight, "Tetris-C"); Block *block = { 0 }; createBlock(&block); int blockMoving = 1; + int blockCounter = 1; SetTargetFPS(60); @@ -56,24 +57,12 @@ int main(void) { // Wenn Block noch nicht auf Boden, dann fallen if (currentBlock->onGround == 0) { - Block *collisionBlock = block; - while (collisionBlock != NULL) { - struct Rectangle rect1 = {currentBlock->position.x, currentBlock->position.y, 20, 20}; - struct Rectangle rect2 = {collisionBlock->position.x, collisionBlock->position.y, 20, 20}; - if (CheckCollisionRecs(rect1, rect2)) { - currentBlock->onGround = 1; - break; - } - - if (currentBlock->position.y < screenHeight - 20) { - currentBlock->position.y += currentBlock->speed; - } else { - blockMoving = 0; - currentBlock->onGround = 1; - } - - collisionBlock = collisionBlock->next; + if (currentBlock->position.y < screenHeight - 20) { + currentBlock->position.y += currentBlock->speed; + } else { + blockMoving = 0; + currentBlock->onGround = 1; } @@ -86,6 +75,7 @@ int main(void) { // Wenn sich kein Block mehr bewegt, einen neuen erstellen if (blockMoving == 0) { createBlock(&block); + blockCounter++; blockMoving = 1; } @@ -94,6 +84,7 @@ int main(void) { ClearBackground(RAYWHITE); DrawFPS(20, 20); + DrawText(TextFormat("Blocks: %i", blockCounter), 20, 40, 20, GREEN); currentBlock = block; while (currentBlock != NULL) {