My problem is that program is not reading codes as i intended \"he\" would.
I have
if (hero.getPos() == (6 | 11 | 16)) {
move = new Object[] {\"Up\",
You cannot do it like that. It ors the 3 number bitwise.
You have to do like this :
if (hero.getPos() == 6 || hero.getPos() == 11 | hero.getPos() == 16)) {
move = new Object[] {"Up", "Right", "Left"};
} else {
move = new Object[] {"Up", "Down", "Right", "Left"};
}
You see the difference ? |
is a bitwise or while ||
is a logical or.
Note also that you have to rewrite the comparison each time.