-
public int getCarPosition() {
char input = 'n';
Keyboard keyboard = new Keyboard();
Track t = new Track();
input = keyboard.readString().charAt(0);
if (game.steps==0) {
position=14;
}
if (input == 'g') {
position++;
if (position == rightBorderX) {
System.out.println("You left the track! Game over!");
System.exit(0);
}
}
else if (input == 'h') {
position++;
if (position == leftBorderX) {
System.out.println("You left the track! Game over!");
System.exit(0);
}
}
else if (input == 'f') {
position=position;
}
else {
System.out.println("Please enter f, g or h!");
steps--;
}
return position;
}
there was a picture here
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules