Gitignore hinzugefügt und Blöcke werden gezählt.
This commit is contained in:
1 parent
987845e4dc
commit
32be3483ad
2 files changed
+16
-13
No files matched your search
+12
@@ -0,0 +1,12 @@
|
|||||||
|
# Kompilierte ausführbare Dateien
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
|
||||||
|
# Objektdateien
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
|
||||||
|
# Build-Ordner oder IDE-spezifische Ordner (falls vorhanden)
|
||||||
|
build/
|
||||||
|
.vscode/
|
||||||
@@ -40,11 +40,12 @@ int main(void) {
|
|||||||
// INIT
|
// INIT
|
||||||
const int screenWidth = 800;
|
const int screenWidth = 800;
|
||||||
const int screenHeight = 450;
|
const int screenHeight = 450;
|
||||||
InitWindow(screenWidth, screenHeight, "Raylib Manuell");
|
InitWindow(screenWidth, screenHeight, "Tetris-C");
|
||||||
|
|
||||||
Block *block = { 0 };
|
Block *block = { 0 };
|
||||||
createBlock(&block);
|
createBlock(&block);
|
||||||
int blockMoving = 1;
|
int blockMoving = 1;
|
||||||
|
int blockCounter = 1;
|
||||||
|
|
||||||
SetTargetFPS(60);
|
SetTargetFPS(60);
|
||||||
|
|
||||||
@@ -56,15 +57,6 @@ int main(void) {
|
|||||||
// Wenn Block noch nicht auf Boden, dann fallen
|
// Wenn Block noch nicht auf Boden, dann fallen
|
||||||
if (currentBlock->onGround == 0) {
|
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) {
|
if (currentBlock->position.y < screenHeight - 20) {
|
||||||
currentBlock->position.y += currentBlock->speed;
|
currentBlock->position.y += currentBlock->speed;
|
||||||
@@ -73,9 +65,6 @@ int main(void) {
|
|||||||
currentBlock->onGround = 1;
|
currentBlock->onGround = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
collisionBlock = collisionBlock->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -86,6 +75,7 @@ int main(void) {
|
|||||||
// Wenn sich kein Block mehr bewegt, einen neuen erstellen
|
// Wenn sich kein Block mehr bewegt, einen neuen erstellen
|
||||||
if (blockMoving == 0) {
|
if (blockMoving == 0) {
|
||||||
createBlock(&block);
|
createBlock(&block);
|
||||||
|
blockCounter++;
|
||||||
blockMoving = 1;
|
blockMoving = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,6 +84,7 @@ int main(void) {
|
|||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
DrawFPS(20, 20);
|
DrawFPS(20, 20);
|
||||||
|
DrawText(TextFormat("Blocks: %i", blockCounter), 20, 40, 20, GREEN);
|
||||||
|
|
||||||
currentBlock = block;
|
currentBlock = block;
|
||||||
while (currentBlock != NULL) {
|
while (currentBlock != NULL) {
|
||||||
|
|||||||
Reference in new issue
Block a user