This commit is contained in:
Alina Bhatti 2025-12-15 12:03:00 +01:00
parent 7bd8731cbb
commit 64adfd8a39

View File

@ -262,21 +262,7 @@ int main()
startTime = GetTime(); startTime = GetTime();
timerStarted = true; timerStarted = true;
} }
// Klick-Erkennung (Ray Picking) nur wenn noch nicht 2 ausgewählt sind
// 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)
if (!gameWon && IsMouseButtonPressed(MOUSE_LEFT_BUTTON) && (second == nullptr)) if (!gameWon && IsMouseButtonPressed(MOUSE_LEFT_BUTTON) && (second == nullptr))
{ {
Vector2 mouse = GetMousePosition(); Vector2 mouse = GetMousePosition();
@ -289,11 +275,7 @@ int main()
{ {
if (c.IsMatched() || c.IsFlipped()) continue; if (c.IsMatched() || c.IsFlipped()) continue;
Vec3 p = c.GetPosition();
auto p = c.GetPosition();
BoundingBox box; BoundingBox box;
box.min = { p.x - 0.75f, p.y - 0.75f, p.z - 0.75f }; box.min = { p.x - 0.75f, p.y - 0.75f, p.z - 0.75f };
@ -318,32 +300,18 @@ int main()
{ {
second = hitCube; second = hitCube;
second->FlipForward(); 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) for (auto &c : cubes)
{ {
c.Update(flipSpeed); 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 // Matching-Logik: erst wenn beide vollständig umgedreht sind
if (first && second && first->IsFlipped() && second->IsFlipped()) if (first && second && first->IsFlipped() && second->IsFlipped())
>>>>>>> 5fc4346 (funktioniert, 3 oder 6 + Timer komplett)
{ {
moves++; moves++;
@ -360,13 +328,9 @@ int main()
first->FlipBackward(); first->FlipBackward();
second->FlipBackward(); second->FlipBackward();
} }
<<<<<<< HEAD
first = second = nullptr;
=======
first = nullptr; first = nullptr;
second = nullptr; second = nullptr;
>>>>>>> 5fc4346 (funktioniert, 3 oder 6 + Timer komplett)
} }
// Gewinnprüfung // Gewinnprüfung