Adjusted wind direction changing angles to a smaller angle.

#story[882]
main
zwu18 9 years ago
parent 8390b19299
commit ce5a726153

@ -110,18 +110,18 @@ public class Race implements Runnable {
* Initiate a random wind direction * Initiate a random wind direction
*/ */
protected void initialiseWindDir(){ protected void initialiseWindDir(){
windDir = new Random().nextInt(65535); windDir = (int) new Random().nextInt(65535+1);
} }
/** /**
* Changes the wind direction. Checks to make sure wind direction is between 0 - 65535 * Changes the wind direction. Checks to make sure wind direction is between 0 - 65535
*/ */
protected void changeWindDir(){ protected void changeWindDir(){
int r = new Random().nextInt(3) + 1; int r = new Random().nextInt(4) + 1;
if (r == 1){ if (r == 1){
windDir+=250; windDir+=100;
} else if (r == 2) { } else if (r == 2) {
windDir-=250; windDir-=100;
} }
if (windDir > 65535){ if (windDir > 65535){
windDir -= 65535; windDir -= 65535;
@ -129,6 +129,7 @@ public class Race implements Runnable {
if (windDir < 0){ if (windDir < 0){
windDir += 65535; windDir += 65535;
} }
System.out.println(windDir);
} }
/** /**

Loading…
Cancel
Save