Skip to content

Commit

Permalink
Merge pull request #78 from Akiva-Grobman/fix-rounds-count
Browse files Browse the repository at this point in the history
Fixed rounds count bug when car is collided
  • Loading branch information
ELK4N4 authored Oct 15, 2020
2 parents b919ebc + 541e6ec commit 36025cd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions src/com/k300/cars/player_car/PlayerCar.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,19 @@ private void collisionEffect() {
rearCollision = false;
frontalCollision = true;
}
if(startLine.hasLegalCrossStartLine(this, MOVEMENT_DIRECTION.FORWARDS)) {
rounds++;
}
} else if (frontalCollision) {
mover.driveBackwards();
if(isOffTrack()) {
mover.driveForwards();
rearCollision = true;
frontalCollision = false;
}
if(startLine.hasLegalCrossStartLine(this, MOVEMENT_DIRECTION.BACKWARDS)) {
rounds++;
}
}
decreaseSpeed(COLLISION_SPEED_DECREMENT);
}
Expand Down

0 comments on commit 36025cd

Please sign in to comment.