Fix missing javadoc tags

Make enemy AI a little bit slower

Signed-off-by: Chris Cromer <chris@cromer.cl>
This commit is contained in:
Chris Cromer 2019-10-21 14:52:47 -03:00
parent cbcb6d0d01
commit 7744b5ae6d
4 changed files with 20 additions and 24 deletions

View File

@ -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'
}

View File

@ -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());

View File

@ -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

View File

@ -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() {