When I hold multiple keys down, for example in this order:
left, right, up.
What happends is, the game does not register "up" as down. This also happends with other combinations like up,right,left and down -> down not registered.
I wrote a little test-class so you can see this, Just try holding down 3 or 4 keys.
Code:
package org.newdawn.slick.tests;
import org.newdawn.slick.BasicGame;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.util.Bootstrap;
public class KeysDownTest extends BasicGame {
private Input input;
private int x = 100;
private int y = 240;
private boolean l;
private boolean r;
private boolean u;
private boolean d;
public KeysDownTest() {
super("LRUD Test");
}
public void init(GameContainer container) throws SlickException {
input = container.getInput();
}
public void render(GameContainer container, Graphics g) {
g.drawString("left "+l, x, y);
g.drawString("right "+r, x, (y + 20));
g.drawString("up "+u, x, (y + 40));
g.drawString("down "+d, x, (y + 60));
}
public void update(GameContainer container, int delta) {
l = input.isKeyDown(Input.KEY_LEFT);
r = input.isKeyDown(Input.KEY_RIGHT);
u = input.isKeyDown(Input.KEY_UP);
d = input.isKeyDown(Input.KEY_DOWN);
}
public static void main(String[] argv) {
Bootstrap.runAsApplication(new KeysDownTest(), 400, 400, false);
}
}