
Originally Posted by
7.light
I am trying to write a scrabble game.
As the board for the scrabble game, I have draws grid using Canvas class.
How can I detect that which a letter ( A, B, c , d, ....) the user types on the squares of the board?
In the canvas, we can use game Action Constant as only
UP
DOWN
LEFT
RIGHT
FIRE
GAME_A
GAME_B
GAME_C
GAME_D
How can we determine whether we type a letter or not and which character we type?
In Canvas class you can overwrite the KepPressed methods like this to get to know which key is pressed?
Code:
public void keyPressed(int key)
{
int gameAction = getGameAction(key);
System.out.println("KEY: " + key + ", " + gameAction);
}