You have to set flags in the keyPressed() method and reset them in the keyReleased() method, and poll those flags in your game loop:
Code:
boolean upPressed;
boolean leftPressed;
void keyPressed(int code) {
int action = getGameAction(code);
if (action == UP) upPressed = true;
// same for the rest of the keys you need
}
void keyReleased(int code) {
int action = getGameAction(code);
if (action == UP) upPressed = false;
// same for the rest of the keys you need
}
// one tick of the game loop:
void tick() {
if (upPressed && leftPressed) moveDiagonally();
// ...
}
Not all phones support multiple keypresses though, so the keyPressed() might not get called for the second key, and in that case there is nothing you can do.
shmoove