made characters in range attackable

This commit is contained in:
Sem van der Hoeven
2020-06-06 17:37:23 +02:00
parent bdb7c6e5c5
commit 24a03a2854
2 changed files with 3 additions and 1 deletions

View File

@@ -125,7 +125,7 @@ public class MainGame extends ApplicationAdapter {
for (int i = 1; i <= 5; i++) {
GameCharacter temp = new Agent("Agent" + i, characters[11][0], new BodySwap("Test"));
int width = mapRenderer.getGameTiles()[0].length;
mapRenderer.getGameTiles()[3][width-(i+1)].visit(temp);
mapRenderer.getGameTiles()[3][width - (i + 1)].visit(temp);
if (chosenFaction == Faction.MEGACORPORATION) {
this.team.addMember(temp);
}
@@ -141,6 +141,7 @@ public class MainGame extends ApplicationAdapter {
music.setVolume(.1f);
music.play();
music.setLooping(true);
}

View File

@@ -163,6 +163,7 @@ public class GameInputProcessor implements InputProcessor {
}
// clicking on enemy
if (mainGame.hasCharacterSelected() && gameTile.containsCharacter() && gameTile.getCharacter().getFaction() != mainGame.getChosenFaction()) {
if (mainGame.mapRenderer.getSurroundedTilesOfCurrentCharacter().contains(gameTile))
gameTile.getCharacter().damage(10);
}
// set selected character