Wiki / Gameplay
Design keypad controls
Map number keys and directional actions, and make Canvas menus usable without a mouse.
Number keys and directions
Java ME names numeric keys Canvas.KEY_NUM0 through Canvas.KEY_NUM9. It also defines Canvas.UP, Canvas.DOWN, Canvas.LEFT, Canvas.RIGHT, and Canvas.FIRE. A keypad phone or emulator may map its physical buttons differently, so include a short control hint in your game and test the exported MIDlet. Checkpoint Run uses 4/6 for left and right and 2/8 for up and down.
A Java Behaviour can override onKeyPressed(int keyCode, int action) for a press and return true when it handles the key. Use isActionDown(action) in onUpdate for held actions. Named input actions can also be checked with isActionDown(String action) when the scene binds physical keys to action names.
Canvas focus
Canvas buttons and input fields can receive keypad focus. Direction keys move between interactable controls and FIRE activates the focused button. Test the menu in Test MIDlet, because mouse clicks in desktop preview do not prove keypad navigation. A button can use Color Tint or Sprite Swap for its visual transition.