added coordinates to characters

This commit is contained in:
Sem van der Hoeven
2020-05-27 23:34:16 +02:00
parent fbe3f8f5a9
commit 42d88e434f
4 changed files with 8 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 80 KiB

View File

@@ -96,12 +96,9 @@ public class MainGame extends ApplicationAdapter {
TextureRegion[][] characters = TextureRegion.split(texture, 32, 32);
this.testCharacter = new Hacker("harry",characters[1][0], new BodySwap("test"));
GameCharacter character2 = new Hacker("test2",characters[2][0], new BodySwap("test"));
// this.tree.insert(testCharacter);
// this.tree.insert(character2);
// this.tree.insert(new Agent(characters[2][0], new Implant("test")));
this.setSelectedCharacter(testCharacter);
mapRenderer.getGameTiles()[0][1].visit(testCharacter);
mapRenderer.getGameTiles()[0][2].visit(character2);
mapRenderer.getGameTiles()[1][1].visit(testCharacter);
mapRenderer.getGameTiles()[1][2].visit(character2);
}

View File

@@ -36,6 +36,8 @@ public class GameTile extends Rectangle {
public boolean visit(GameCharacter character) {
if (this.character != null) return false;
this.character = character;
this.character.setX(this.x);
this.character.setY(this.y);
return true;
}
@@ -61,6 +63,7 @@ public class GameTile extends Rectangle {
"symbol=" + symbol +
", x=" + x +
", y=" + y +
", character=" + this.character +
'}';
}

View File

@@ -19,6 +19,7 @@ public abstract class GameCharacter extends Actor implements Comparable<GameChar
protected TextureRegion textureRegion;
public GameCharacter(String name, Faction faction, TextureRegion textureRegion, Ability... abilities) {
super();
this.name = name;
this.faction = faction;
this.abilities = new HashSet<>(Arrays.asList(abilities));
@@ -77,6 +78,8 @@ public abstract class GameCharacter extends Actor implements Comparable<GameChar
return "GameCharacter{" +
"name='" + name + '\'' +
", faction=" + faction +
", x=" + super.getX() +
", y=" + super.getY() +
'}';
}
}