This commit is contained in:
2026-05-19 17:19:54 +02:00
parent 8ff3e29374
commit d93e71e716
4 changed files with 25 additions and 0 deletions

View File

@@ -35,6 +35,23 @@ namespace {
file << "Igralec: " << playerName << "\n";
file << "Točke: " << score << "\n";
file << "Datum: " << std::put_time(&localTime, "%Y-%m-%d %H:%M:%S") << "\n";
// Replay system
std::vector<Game::Object::Transform> playerHistory;
Game::GameManager::getPlayerPositionHistory(playerHistory);
std::ofstream replayFile("replay.txt", std::ios::trunc);
if (!replayFile.is_open()) {
WARN("Neuspešno odpiranje replay.txt za pisanje");
return;
}
for (const auto& transform : playerHistory) {
replayFile << transform.x << " " << transform.y << " " << transform.rotation << " " << transform.scaleX << " " << transform.scaleY << "\n";
}
LOG("Zapis končne statistike in replaya igre dokončan");
replayFile.close();
file.close();
}
}

View File

@@ -161,6 +161,9 @@ namespace Game::AGame {
} else if (!mIsShipMode && mGroundTex) {
setTexture(mGroundTex);
}
// Push replay
GameManager::pushPlayerPosition(mTransform);
}
void Player::onCollisionEnter(Object::Entity* other) {