The code is actually much longer but I decided to post a small snippet to avoid posting repetitive code. The idea is that the game detects which of the 26 alphabets was pressed and does a certain action upon key press. Code is in Java.
public void keyTyped(KeyEvent e) {
if(e.getKeyCode() == KeyEvent.VK_A)
{
}
else if( e.getKeyCode() == KeyEvent.VK_B)
{
}
}