Beispiel #1
0
 public void keyReleased(KeyEvent e) {
   int key = e.getKeyCode();
   if (key == KeyEvent.VK_A) super.setDX(0);
   if (key == KeyEvent.VK_D) super.setDX(0);
   if (key == KeyEvent.VK_W) super.setDY(0);
   if (key == KeyEvent.VK_S) super.setDY(0);
 }
Beispiel #2
0
 public void keyPressed(KeyEvent e) {
   int key = e.getKeyCode();
   if (key == KeyEvent.VK_A) super.setDX(-4);
   if (key == KeyEvent.VK_D) super.setDX(4);
   if (key == KeyEvent.VK_W) super.setDY(-4);
   if (key == KeyEvent.VK_S) super.setDY(4);
 }