finish score
This commit is contained in:
parent
6948896d9f
commit
19d0b0e8e0
24
game.cpp
24
game.cpp
@ -167,6 +167,7 @@ void Game::run() {
|
||||
window.draw(racecar.getDrawable());
|
||||
window.draw(speedText);
|
||||
|
||||
displaySavedTimes();
|
||||
|
||||
if (lapPoints.size() == 3) {
|
||||
displayEndGame();
|
||||
@ -174,9 +175,24 @@ void Game::run() {
|
||||
else {
|
||||
window.draw(timerText);
|
||||
}
|
||||
displaySavedTimes();
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
@ -189,7 +205,11 @@ bool Game::isTrackCollision(float x, float y) {
|
||||
} else {
|
||||
int currX = (x / 13.85) - 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;
|
||||
if (currentChar == '\\' || currentChar == '|' || currentChar == '/' || currentChar == '-' || currentChar == '_') {
|
||||
return true;
|
||||
|
||||
1521274
high_scores.txt
1521274
high_scores.txt
File diff suppressed because it is too large
Load Diff
BIN
terminal_racer
BIN
terminal_racer
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user