I want to make a boolean!
The actor have to say true if there is a wall and false if there is no wall!
HELP!!
Thanks!
Joorror
...sorry for my English I´m just German! :)
public boolean nothingInTheWay(char direction) {
switch (direction) {
case 'w'://up;
Actor wall = getOneObjectAtOffset(0, -1, Wall.class);
return wall == null;
case 'a'://left;
Actor wall = getOneObjectAtOffset(-1, 0, Wall.class);
return wall == null;
case 's'://down;
Actor wall = getOneObjectAtOffset(0, 1, Wall.class);
return wall == null;
case 'd'://right;
Actor wall = getOneObjectAtOffset(1, 0, Wall.class);
return wall == null;
default:
return false;
}
}