2 Commits
Author SHA1 Message Date
bhattial100541 64adfd8a39 .. 2025-12-15 12:03:00 +01:00
bhattial100541 7bd8731cbb Puntestand einbauen 2025-12-14 04:34:32 +01:00
5 changed files with 40 additions and 39 deletions
Vendored
BIN
View File
Binary file not shown.
+8
View File
@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
Generated
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
+10
View File
@@ -0,0 +1,10 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
]
}
+16 -39
View File
@@ -205,6 +205,8 @@ int main()
gamecube* second = nullptr;
float flipSpeed = 5.0f; // Drehgeschwindigkeit
bool gameWon = false;
int moves = 0;
// Fenster und Kamera
InitWindow(800, 600, "3D Memory Game with Matrix3D Library");
@@ -237,6 +239,8 @@ int main()
first = second = nullptr;
currentScreen = GAMEPLAY;
timerStarted = false; // Timer-Reset
moves = 0;
} else if (IsKeyPressed(KEY_SIX)) {
selectedPairs = 6; // 12 Würfel
SetupGame(cubes, selectedPairs);
@@ -244,6 +248,8 @@ int main()
first = second = nullptr;
currentScreen = GAMEPLAY;
timerStarted = false; // Timer-Reset
moves = 0;
}
break;
}
@@ -256,21 +262,7 @@ int main()
startTime = GetTime();
timerStarted = true;
}
// Klick-Erkennung
<<<<<<< HEAD
if (!gameWon && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
{
Vector2 mouse = GetMousePosition();
for (auto &c : cubes)
{
if (!c.IsFlipped() && !c.IsMatched())
{
Vector2 screenPos = GetWorldToScreen({c.GetPosition().x, c.GetPosition().y, c.GetPosition().z}, camera);
if (fabs(mouse.x - screenPos.x) < 40 && fabs(mouse.y - screenPos.y) < 40)
c.FlipForward();
=======
// Klick-Erkennung (nur wenn noch nicht 2 ausgewählt sind)
// Klick-Erkennung (Ray Picking) – nur wenn noch nicht 2 ausgewählt sind
if (!gameWon && IsMouseButtonPressed(MOUSE_LEFT_BUTTON) && (second == nullptr))
{
Vector2 mouse = GetMousePosition();
@@ -283,11 +275,7 @@ int main()
{
if (c.IsMatched() || c.IsFlipped()) continue;
auto p = c.GetPosition();
Vec3 p = c.GetPosition();
BoundingBox box;
box.min = { p.x - 0.75f, p.y - 0.75f, p.z - 0.75f };
@@ -312,33 +300,21 @@ int main()
{
second = hitCube;
second->FlipForward();
>>>>>>> 5fc4346 (funktioniert, 3 oder 6 + Timer komplett)
}
}
}
// Animation aller Würfel
// Animation aller Würfel (KEINE first/second Auto-Zuweisung hier!)
for (auto &c : cubes)
{
c.Update(flipSpeed);
<<<<<<< HEAD
if (c.IsFlipped() && !c.IsMatched())
{
if (!first) first = &c;
else if (!second && &c != first) second = &c;
}
}
// Matching-Logik
if (first && second)
=======
}
// Matching-Logik
// Matching-Logik: erst wenn beide vollständig umgedreht sind
if (first && second && first->IsFlipped() && second->IsFlipped())
>>>>>>> 5fc4346 (funktioniert, 3 oder 6 + Timer komplett)
{
moves++;
Color col1 = first->GetColor();
Color col2 = second->GetColor();
@@ -352,13 +328,9 @@ int main()
first->FlipBackward();
second->FlipBackward();
}
<<<<<<< HEAD
first = second = nullptr;
=======
first = nullptr;
second = nullptr;
>>>>>>> 5fc4346 (funktioniert, 3 oder 6 + Timer komplett)
}
// Gewinnprüfung
@@ -416,6 +388,11 @@ int main()
char liveBuf[64];
sprintf(liveBuf, "Time: %.2f", GetTime() - startTime);
DrawText(liveBuf, 10, 40, 20, DARKGRAY);
char moveBuf[64];
snprintf(moveBuf, sizeof(moveBuf), "Moves: %d", moves);
DrawText(moveBuf, 10, 70, 20, DARKGRAY);
}
break;
} // ENDE GAMEPLAY DRAW