The title may be a bit confusing, but I’ll explain. In my new game, Diamonds, I want the player to not be able to go through stone or supports. As is, my code can only handle one. A code sample is below.
if (keyCode == KeyEvent.VK_UP) {
if (!m.getMap(p.getTileX(), p.getTileY() - 1).equals("s")) { // "s" means stone.
p.move(0, -1); // I call a move() method from my player class
}
}
Thanks,
-DarkCart