This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Nov 19th, 2012  |  syntax: Java  |  size: 0.63 KB  |  views: 5  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. package net.anyspieceofinter.unnamedgameproject.input;
  2.  
  3. import java.awt.event.KeyEvent;
  4. import java.awt.event.KeyListener;
  5.  
  6. public class Keyboard implements KeyListener{
  7.        
  8.         private boolean[] keys = new boolean[160];
  9.         public boolean w, a, s, d;
  10.        
  11.         public void update() {
  12.                
  13.                 w = keys[KeyEvent.VK_W];
  14.                 a = keys[KeyEvent.VK_A];
  15.                 s = keys[KeyEvent.VK_S];
  16.                 d = keys[KeyEvent.VK_D];
  17.                
  18.         }
  19.        
  20.         public void keyPressed(KeyEvent e) {
  21.                
  22.                 keys[e.getKeyCode()] = true;
  23.                
  24.         }
  25.  
  26.         public void keyReleased(KeyEvent e) {
  27.                
  28.                 keys[e.getKeyCode()] = false;
  29.                
  30.         }
  31.  
  32.         public void keyTyped(KeyEvent e) {
  33.                
  34.                
  35.                
  36.         }
  37.  
  38.        
  39.        
  40. }
clone this paste RAW Paste Data