| Summary: | Fail to select mode on laptops with no individual F1 and F2 | ||
|---|---|---|---|
| Product: | CS3343 2021/22 Group16 Greedy Snake | Reporter: | LI Ruoxin <ruoxinli3-c> |
| Component: | Action Package | Assignee: | Baron Qu <zhiyanqu2-c> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | ruoxinli3-c |
| Priority: | Normal | ||
| Version: | Ver 3.0 | ||
| Hardware: | PC | ||
| OS: | Windows | ||
|
Description
LI Ruoxin
2021-11-29 17:00:20 HKT
Suspect the F1 key and F2 key are multiple function keys. Therefore, sometimes the computer does not take the F1 or F2 as input, but the computer shortcut command. May just change the F1 key and F2 key to 1 key or 2 key. Or we change change the key to 'P' key or 'A' key. *** Bug 624 has been marked as a duplicate of this bug. *** *** Bug 625 has been marked as a duplicate of this bug. *** Changed key F1 & F2 to key 1 & 2.
Code impletment:
public void keyPressed(KeyEvent e) {
if (SConstant.SC_GAME_MODE_DEFAULT.equals(game.getMode())
|| SConstant.SC_GAME_MODE_PlAYER.equals(game.getMode())) {
keyLock = SConstant.SC_DEFAULT_KEYBOARD_LOCK;
} else {
keyLock = SConstant.SC_UPDATED_KEYBOARD_LOCK;
}
if (SConstant.SC_DEFAULT_KEYBOARD_LOCK.equals(keyLock)) {
switch (e.getKeyCode()) {
case KeyEvent.VK_1:
Press1KeyCommand.getInstance().execute(game);
break;
case KeyEvent.VK_2:
Press2KeyCommand.getInstance().execute(game);
break;
case KeyEvent.VK_DOWN:
PressDownKeyCommand.getInstance().execute(game);
break;
case KeyEvent.VK_LEFT:
PressLeftKeyCommand.getInstance().execute(game);
break;
case KeyEvent.VK_RIGHT:
PressRightKeyCommand.getInstance().execute(game);
break;
case KeyEvent.VK_UP:
PressUpKeyCommand.getInstance().execute(game);
break;
case KeyEvent.VK_SPACE:
timer.start();
break;
}
}
}
|