Hi guys, I am new here on the Java Gaming forums and could use a little help.
I am programming a game in LWJGL and I need help achieving tiled based moving. I obviously don’t want it just to jump a tile’s width, but as a smooth movement to the next tile (like Pokemon). I tried experimenting with some stuff and here is what I came up with.
if (Keyboard.isKeyDown(Keyboard.KEY_UP)) {
Keyboard.destroy();
for (int x = 0; x < 32; x += 4) { player.setY(player.getY() - 4); }
try {
Keyboard.create();
} catch (LWJGLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
This kind of works, but the problem is it just jumps the character to the next tile instead of a smooth movement. In theory, this seems like it should work because it moves it 4 pixels 8 times. I am not quite sure what I am doing wrong here.
Also, does Keyboard.destroy() disable the keyboard? I need something to disable movement of the character so you can’t interrupt the movement.