Fix missing javadoc tags
Make enemy AI a little bit slower Signed-off-by: Chris Cromer <chris@cromer.cl>
This commit is contained in:
parent
cbcb6d0d01
commit
7744b5ae6d
15
build.gradle
15
build.gradle
@ -82,21 +82,6 @@ plugins.withType(DistributionPlugin) {
|
||||
}
|
||||
}
|
||||
|
||||
task createDocs {
|
||||
def docs = file("$buildDir/docs")
|
||||
outputs.dir docs
|
||||
}
|
||||
|
||||
distributions {
|
||||
main {
|
||||
contents {
|
||||
from(createDocs) {
|
||||
into 'docs'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wrapper {
|
||||
gradleVersion = '5.6.2'
|
||||
}
|
@ -215,7 +215,7 @@ public class EnemyAI extends AI implements Runnable, Constants {
|
||||
public void run() {
|
||||
while (getActive()) {
|
||||
try {
|
||||
Thread.sleep(600);
|
||||
Thread.sleep(700);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
logger.info(e.getMessage());
|
||||
|
@ -89,6 +89,7 @@ public interface PlayerAI extends Runnable, Constants {
|
||||
* @return Returns the new sorted destinations
|
||||
*/
|
||||
default List<State> sortDestinations(List<State> destinations, State initial) {
|
||||
// TODO: make the AI look for the goal farthest from the enemy
|
||||
destinations.sort((state1, state2) -> {
|
||||
if (state1.getImportance() > state2.getImportance()) {
|
||||
// The first state is more important
|
||||
|
@ -59,14 +59,16 @@ public class Player extends Object implements Constants {
|
||||
super(scene, cell);
|
||||
setLogger(getLogger(this.getClass(), LogLevel.PLAYER));
|
||||
loadPlayerAnimation();
|
||||
if (PLAYER_AI == PlayerAIType.ASTAR) {
|
||||
ai = new PlayerAStarAI(scene, this);
|
||||
}
|
||||
else if (PLAYER_AI == PlayerAIType.BFS) {
|
||||
ai = new PlayerBreadthFirstAI(scene, this);
|
||||
}
|
||||
else {
|
||||
ai = null;
|
||||
switch (PLAYER_AI) {
|
||||
case ASTAR:
|
||||
ai = new PlayerAStarAI(scene, this);
|
||||
break;
|
||||
case BFS:
|
||||
ai = new PlayerBreadthFirstAI(scene, this);
|
||||
break;
|
||||
default:
|
||||
ai = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,6 +132,8 @@ public class Player extends Object implements Constants {
|
||||
|
||||
/**
|
||||
* Move the player up
|
||||
*
|
||||
* @return Returns true if the player moved
|
||||
*/
|
||||
@Override
|
||||
protected boolean moveUp() {
|
||||
@ -188,6 +192,8 @@ public class Player extends Object implements Constants {
|
||||
|
||||
/**
|
||||
* Move the player down
|
||||
*
|
||||
* @return Returns true if the player moved
|
||||
*/
|
||||
@Override
|
||||
protected boolean moveDown() {
|
||||
@ -241,6 +247,8 @@ public class Player extends Object implements Constants {
|
||||
|
||||
/**
|
||||
* Move the player to the left
|
||||
*
|
||||
* @return Returns true if the player moved
|
||||
*/
|
||||
@Override
|
||||
protected boolean moveLeft() {
|
||||
@ -294,6 +302,8 @@ public class Player extends Object implements Constants {
|
||||
|
||||
/**
|
||||
* Move the player to the right
|
||||
*
|
||||
* @return Returns true if the player moved
|
||||
*/
|
||||
@Override
|
||||
protected boolean moveRight() {
|
||||
|
Loading…
Reference in New Issue
Block a user