finish score

This commit is contained in:
thatscringebro
2023-10-11 12:54:42 -04:00
parent 6948896d9f
commit 19d0b0e8e0
3 changed files with 34 additions and 1521284 deletions

View File

@@ -167,6 +167,7 @@ void Game::run() {
window.draw(racecar.getDrawable()); window.draw(racecar.getDrawable());
window.draw(speedText); window.draw(speedText);
displaySavedTimes();
if (lapPoints.size() == 3) { if (lapPoints.size() == 3) {
displayEndGame(); displayEndGame();
@@ -174,9 +175,24 @@ void Game::run() {
else { else {
window.draw(timerText); window.draw(timerText);
} }
displaySavedTimes();
window.display(); window.display();
if (lapPoints.size() == 3) {
while (window.isOpen()) {
sf::Event event;
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
window.close();
backgroundMusic.stop();
}
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Enter))
break;
}
break;
}
sf::sleep(sf::microseconds(DELAY)); sf::sleep(sf::microseconds(DELAY));
} }
} }
@@ -189,7 +205,11 @@ bool Game::isTrackCollision(float x, float y) {
} else { } else {
int currX = (x / 13.85) - 1; int currX = (x / 13.85) - 1;
int currY = (y / 27.88) - 1; int currY = (y / 27.88) - 1;
char currentChar = asciiMap[currY * 194 + currX]; char currentChar;
if (currY * 194 + currX < 6478)
currentChar = asciiMap[currY * 194 + currX];
else
return true;
//std::cout << x << ", " << y << std::endl; //std::cout << x << ", " << y << std::endl;
if (currentChar == '\\' || currentChar == '|' || currentChar == '/' || currentChar == '-' || currentChar == '_') { if (currentChar == '\\' || currentChar == '|' || currentChar == '/' || currentChar == '-' || currentChar == '_') {
return true; return true;

1521274
high_scores.txt

File diff suppressed because it is too large Load Diff

Binary file not shown.