Mario now duck (or flee) when grabbed

This commit is contained in:
Kleme
2017-06-29 20:38:38 +02:00
parent 19c69bcbf4
commit 9506bc923e
2 changed files with 11 additions and 5 deletions
+10 -4
View File
@@ -7,7 +7,7 @@ import java.util.Random;
public class MarioAI {
//times
private static final int MIN_STATE_TIME = 500;
private static final int MIN_STATE_TIME = 1000;
private static final int MAX_STILL_TIME = 10000-MIN_STATE_TIME;
private static final int MAX_WALKING_TIME = 5000-MIN_STATE_TIME;
private static final int MAX_RUNNING_TIME = 3000-MIN_STATE_TIME;
@@ -190,9 +190,15 @@ public class MarioAI {
break;
case LOOSING:
if(this.time-this.time2>100){
this.time2 = this.time+rand.nextInt(MAX_STILL_TIME)+MIN_STATE_TIME;
this.wait = true;
this.state = State.STILL;
int randi = rand.nextInt(100);
if(randi<80){ //0-79 - 80%
this.time2 = this.time+rand.nextInt(MAX_STILL_TIME)+MIN_STATE_TIME;
this.wait = true;
this.state = State.STILL_DUCK;
}else{ //80-99 - 20%
this.wait = false;
this.state = State.RUNNING;
}
}
break;
}
+1 -1
View File
@@ -25,7 +25,7 @@ public class MarioWindow extends JWindow implements ActionListener {
private static final long serialVersionUID = 1L;
private static final String VERSION = "1.6";
private static final String VERSION = "1.6.1";
private static final int REFRESH_MS = 20;
private static final int TILE_W = 20;