ok im doing a tetris game and i want the piece to move left when i click 'a' and right when i click 'd' and turn clockwise when i click 'w' and turn counterclockwise when i click 's'. heres what i have
public class Movement extends JPanel implements KeyListener {
public Movement (){
setFocusable(this);
addnewKeyListener(this);
}
public void keyTyped (KeyEvent e){
if (e.getKeyCode == 'a')
//shift left code
else if (e.getKeyCode == 'd')
//shift right code
else if (e.getKeyCode == 'w')
//rotate clockwise code
else if (e.getKeyCode == 's')
//rotate counterclockwise code
}
//irrelevant keyPressed and key Realeased methods that i dont do anything in
in the frame i use the built in keyTyped method to call
move.keyTyped(evt)//evt being the KeyEvent the method uses
however it is not reading the keys being typed any key being typed for that matter. Please help!