Only allow unit actions if adjacent to that unit
This commit is contained in:
parent
e5e6fef3cc
commit
2db1135447
1 changed files with 8 additions and 6 deletions
|
@ -194,6 +194,7 @@ public class GameScreen implements Screen {
|
|||
|
||||
for(Unit unit : units) {
|
||||
if(unit.positionX == x && unit.positionY == y) {
|
||||
if(isAdjacent(currentUnit, unit)) {
|
||||
if (unit.team != currentUnit.team) {
|
||||
actions.add(new AttackAction(currentUnit, unit));
|
||||
} else {
|
||||
|
@ -204,6 +205,7 @@ public class GameScreen implements Screen {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
actions.add(new WaitAction());
|
||||
|
||||
|
|
Reference in a new issue