Fixing bugs

This commit is contained in:
Vladislav Khorev committed 2026-03-06 23:15:56 +03:00
1 parent 41f370f2ee
commit 7ccda081b0
10 files changed
+50 -11

No files matched your search

+16 -11
View File
@@ -252,20 +252,26 @@ namespace ZL
Space::~Space() {
}
void Space::resetPlayerState()
{
shipAlive = true;
gameOver = false;
showExplosion = false;
explosionEmitter.setEmissionPoints(std::vector<Vector3f>());
Environment::shipState.position = Vector3f{ 0, 0, 45000.f };
Environment::shipState.velocity = 0.0f;
Environment::shipState.rotation = Eigen::Matrix3f::Identity();
Environment::inverseShipMatrix = Eigen::Matrix3f::Identity();
Environment::zoom = DEFAULT_ZOOM;
Environment::tapDownHold = false;
playerScore = 0;
}
void Space::setup() {
menuManager.onRestartPressed = [this]() {
this->shipAlive = true;
this->gameOver = false;
this->showExplosion = false;
this->explosionEmitter.setEmissionPoints(std::vector<Vector3f>());
Environment::shipState.position = Vector3f{ 0, 0, 45000.f };
Environment::shipState.velocity = 0.0f;
Environment::shipState.rotation = Eigen::Matrix3f::Identity();
Environment::inverseShipMatrix = Eigen::Matrix3f::Identity();
Environment::zoom = DEFAULT_ZOOM;
Environment::tapDownHold = false;
resetPlayerState();
if (networkClient) {
try {
@@ -276,7 +282,6 @@ namespace ZL
std::cerr << "Client: Failed to send RESPAWN\n";
}
}
this->playerScore = 0;
std::cerr << "Game restarted\n";
};