4 Commits
Author SHA1 Message Date
bhattial100541 2bf7de8f28 Delete .DS_Store 2025-12-15 10:57:01 +00:00
bhattial100541 d4cf18dfcd Delete .vscode/launch.json 2025-12-15 10:54:54 +00:00
bhattial100541 41845f8b1d Delete .idea/vcs.xml 2025-12-15 10:54:44 +00:00
bhattial100541 0f42ef18d0 Delete .idea/.gitignore 2025-12-15 10:54:37 +00:00
5 changed files with 39 additions and 40 deletions
Vendored
BIN
View File
Binary file not shown.
-8
View File
@@ -1,8 +0,0 @@
# 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
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
-10
View File
@@ -1,10 +0,0 @@
{
// 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": [
]
}
+39 -16
View File
@@ -205,8 +205,6 @@ int main()
gamecube* second = nullptr; gamecube* second = nullptr;
float flipSpeed = 5.0f; // Drehgeschwindigkeit float flipSpeed = 5.0f; // Drehgeschwindigkeit
bool gameWon = false; bool gameWon = false;
int moves = 0;
// Fenster und Kamera // Fenster und Kamera
InitWindow(800, 600, "3D Memory Game with Matrix3D Library"); InitWindow(800, 600, "3D Memory Game with Matrix3D Library");
@@ -239,8 +237,6 @@ int main()
first = second = nullptr; first = second = nullptr;
currentScreen = GAMEPLAY; currentScreen = GAMEPLAY;
timerStarted = false; // Timer-Reset timerStarted = false; // Timer-Reset
moves = 0;
} else if (IsKeyPressed(KEY_SIX)) { } else if (IsKeyPressed(KEY_SIX)) {
selectedPairs = 6; // 12 Würfel selectedPairs = 6; // 12 Würfel
SetupGame(cubes, selectedPairs); SetupGame(cubes, selectedPairs);
@@ -248,8 +244,6 @@ int main()
first = second = nullptr; first = second = nullptr;
currentScreen = GAMEPLAY; currentScreen = GAMEPLAY;
timerStarted = false; // Timer-Reset timerStarted = false; // Timer-Reset
moves = 0;
} }
break; break;
} }
@@ -262,7 +256,21 @@ 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();
@@ -275,7 +283,11 @@ 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 };
@@ -300,21 +312,33 @@ int main()
{ {
second = hitCube; second = hitCube;
second->FlipForward(); second->FlipForward();
>>>>>>> 5fc4346 (funktioniert, 3 oder 6 + Timer komplett)
} }
} }
} }
// Animation aller Würfel (KEINE first/second Auto-Zuweisung hier!) // Animation aller Würfel
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++;
Color col1 = first->GetColor(); Color col1 = first->GetColor();
Color col2 = second->GetColor(); Color col2 = second->GetColor();
@@ -328,9 +352,13 @@ 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
@@ -388,11 +416,6 @@ int main()
char liveBuf[64]; char liveBuf[64];
sprintf(liveBuf, "Time: %.2f", GetTime() - startTime); sprintf(liveBuf, "Time: %.2f", GetTime() - startTime);
DrawText(liveBuf, 10, 40, 20, DARKGRAY); DrawText(liveBuf, 10, 40, 20, DARKGRAY);
char moveBuf[64];
snprintf(moveBuf, sizeof(moveBuf), "Moves: %d", moves);
DrawText(moveBuf, 10, 70, 20, DARKGRAY);
} }
break; break;
} // ENDE GAMEPLAY DRAW } // ENDE GAMEPLAY DRAW