neustand mit allem final

This commit is contained in:
Alina Bhatti 2025-12-14 04:02:09 +01:00
parent 59f4d6b3af
commit 2fd3ee5870
3 changed files with 83 additions and 2 deletions

View File

@ -1,4 +1,12 @@
<<<<<<< HEAD
#include "gamecube.h"
=======
#include "raylib.h"
#include "gamecube.h"
#pragma once
>>>>>>> 5fc4346 (funktioniert, 3 oder 6 + Timer komplett)
gamecube::gamecube(const Vec3 &pos, Color col)
: position(pos), color(col) {}
@ -63,4 +71,9 @@ void gamecube::Draw() const
}
Vec3 gamecube::GetPosition() const { return position; }
float gamecube::GetRotationY() const { return rotation; }
<<<<<<< HEAD
float gamecube::GetRotationY() const { return rotation; }
=======
float gamecube::GetRotationY() const { return rotation; }
>>>>>>> 5fc4346 (funktioniert, 3 oder 6 + Timer komplett)

View File

@ -1,4 +1,9 @@
<<<<<<< HEAD
//
=======
//
>>>>>>> 5fc4346 (funktioniert, 3 oder 6 + Timer komplett)
// Created by bakee on 03.11.2025.
//
#include "gamematrix.h"
@ -94,4 +99,8 @@ namespace Matrix3D
return {res_hom[0], res_hom[1], res_hom[2]};
}
}
<<<<<<< HEAD
}
=======
}
>>>>>>> 5fc4346 (funktioniert, 3 oder 6 + Timer komplett)

View File

@ -258,6 +258,7 @@ int main()
}
// Klick-Erkennung
<<<<<<< HEAD
if (!gameWon && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
{
Vector2 mouse = GetMousePosition();
@ -268,6 +269,50 @@ int main()
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))
{
Vector2 mouse = GetMousePosition();
Ray ray = GetMouseRay(mouse, camera);
gamecube* hitCube = nullptr;
float bestDist = 1e9f;
for (auto &c : cubes)
{
if (c.IsMatched() || c.IsFlipped()) continue;
auto p = c.GetPosition();
BoundingBox box;
box.min = { p.x - 0.75f, p.y - 0.75f, p.z - 0.75f };
box.max = { p.x + 0.75f, p.y + 0.75f, p.z + 0.75f };
RayCollision col = GetRayCollisionBox(ray, box);
if (col.hit && col.distance < bestDist)
{
bestDist = col.distance;
hitCube = &c;
}
}
if (hitCube)
{
if (!first)
{
first = hitCube;
first->FlipForward();
}
else if (hitCube != first)
{
second = hitCube;
second->FlipForward();
>>>>>>> 5fc4346 (funktioniert, 3 oder 6 + Timer komplett)
}
}
}
@ -276,6 +321,7 @@ int main()
for (auto &c : cubes)
{
c.Update(flipSpeed);
<<<<<<< HEAD
if (c.IsFlipped() && !c.IsMatched())
{
if (!first) first = &c;
@ -285,6 +331,13 @@ int main()
// 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)
{
Color col1 = first->GetColor();
Color col2 = second->GetColor();
@ -299,7 +352,13 @@ int main()
first->FlipBackward();
second->FlipBackward();
}
<<<<<<< HEAD
first = second = nullptr;
=======
first = nullptr;
second = nullptr;
>>>>>>> 5fc4346 (funktioniert, 3 oder 6 + Timer komplett)
}
// Gewinnprüfung