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();
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();
@ -289,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 };
@ -318,32 +300,18 @@ 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++;
@ -360,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